Compare commits

...

30 Commits

Author SHA1 Message Date
074dfd94fc sync 2022-08-15 10:14:17 +08:00
474380bd97 fix: 优化LoggerUtil工具类 2021-12-13 22:39:57 +08:00
48f56e7509 fix: 优化DateUtil工具类 2021-12-13 22:35:15 +08:00
2559721f48 fix 2021-11-19 23:45:49 +08:00
e31a8f5c08 fix DateUtil 2021-11-15 11:31:32 +08:00
5c9b0a3a2f Merge branch 'master' of https://github.com/carolcoral/CommonUtil 2021-11-15 10:48:12 +08:00
3aed9ee44b Create runConfigurations.xml 2021-11-15 10:47:45 +08:00
760dcf61dc add and fix 2021-10-29 14:17:02 +08:00
355d9bbd16 sync
remove .idea and target
2021-09-30 11:14:32 +08:00
02f89ae360 sync 2021-09-30 11:12:56 +08:00
ac7d67110c Merge branch 'master' of https://github.com/carolcoral/CommonUtil 2021-09-30 11:11:44 +08:00
bebc16d1b7 KafkaUtil
新增方法
2021-09-30 11:10:12 +08:00
4124a305a7
Update DateUtil.java 2021-09-22 13:14:19 +08:00
a633572919
Update DateUtil.java 2021-09-22 13:13:22 +08:00
f98a2927d3
Update DateUtil.java 2021-09-14 09:20:04 +08:00
23a0e2dbbf
Update DateUtil.java 2021-09-14 09:19:50 +08:00
5b48828c77 change 2021-09-01 13:30:04 +08:00
d212a43a62
Merge pull request #4 from carolcoral/dependabot/maven/org.bouncycastle-bcprov-jdk15on-1.67
Bump bcprov-jdk15on from 1.56 to 1.67
2021-08-31 17:00:11 +08:00
e1cc91d4c9
Rename src/main/java/site/cnkj/common.enumeration.ResponseStatusEnum.java to src/main/java/site/cnkj/common/enumeration/ResponseStatusEnum.java 2021-08-31 16:59:37 +08:00
0dfbe9dcd7
Create common.enumeration.ResponseStatusEnum.java 2021-08-31 16:59:10 +08:00
dependabot[bot]
1895701ba1
Bump bcprov-jdk15on from 1.56 to 1.67
Bumps [bcprov-jdk15on](https://github.com/bcgit/bc-java) from 1.56 to 1.67.
- [Release notes](https://github.com/bcgit/bc-java/releases)
- [Changelog](https://github.com/bcgit/bc-java/blob/master/docs/releasenotes.html)
- [Commits](https://github.com/bcgit/bc-java/commits)

---
updated-dependencies:
- dependency-name: org.bouncycastle:bcprov-jdk15on
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-13 15:33:30 +00:00
cbc9e82724
Merge pull request #2 from carolcoral/dependabot/maven/commons-io-commons-io-2.7
Bump commons-io from 2.6 to 2.7
2021-08-10 15:38:25 +08:00
5e732bb3b8
Merge pull request #3 from carolcoral/dependabot/maven/org.elasticsearch-elasticsearch-7.13.3
Bump elasticsearch from 7.12.0 to 7.13.3
2021-08-10 15:38:14 +08:00
dependabot[bot]
f00d846587
Bump elasticsearch from 7.12.0 to 7.13.3
Bumps [elasticsearch](https://github.com/elastic/elasticsearch) from 7.12.0 to 7.13.3.
- [Release notes](https://github.com/elastic/elasticsearch/releases)
- [Commits](https://github.com/elastic/elasticsearch/compare/v7.12.0...v7.13.3)

---
updated-dependencies:
- dependency-name: org.elasticsearch:elasticsearch
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 20:43:37 +00:00
dependabot[bot]
4f709ab2a6
Bump commons-io from 2.6 to 2.7
Bumps commons-io from 2.6 to 2.7.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 19:22:28 +00:00
a741fb0caa change es version to 7.12.0 2021-04-19 17:00:12 +08:00
liuxuewen
7ee8555339 Merge remote-tracking branch 'origin/master' 2021-03-24 15:21:52 +08:00
liuxuewen
8cabbe6b12 change MongoClientInit and fix some bug. 2021-03-24 15:21:35 +08:00
liuxuewen
80265f8fa3 change MongoClientInit and fix some bug. 2021-03-24 14:51:27 +08:00
liuxuewen
9c4eb562d4 change data folder 2021-03-23 18:00:46 +08:00
51 changed files with 1647 additions and 3443 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

25
.gitignore vendored
View File

@ -1,23 +1,2 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea
target

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="CommonUtil" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -1,84 +0,0 @@
Y
)src/main/resources/application.properties,0\6\06f65155ec73600b9fc5c4dc2883d4bb84d8e284
i
9src/test/java/site/cnkj/utils/CommonApplicationTests.java,6\f\6f823bd3fbefd4cf49e9d51ea41235329137be8c
7
LICENSE,0\3\0398ccd0f49298b10a3d76a47800d2ebecd49859
:
.gitignore,a\5\a5cc2925ca8258af241be7e5b0381edf30266302
>
.gitattributes,2\4\24139dae656713ba861751fb2c2ac38839349a7a
9
README.md,8\e\8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
7
pom.xml,4\4\442292b8a7efeabbe4cc176709b833b1792140ec
_
/src/main/java/cnkj/site/data/ProtobufOuter.java,5\a\5ac75731bc924d16ee247ba33055686cd1152925
h
8src/main/java/cnkj/site/data/ProtobufOuterOperation.java,b\a\ba55f3bf65bd51e1ae3ef25ad210a0f09762aa03
k
;src/main/java/site/cnkj/common/config/AsyncExecutePool.java,4\1\416390ba57649e9f4e6365934e9a6827cca3ffed
p
@src/main/java/site/cnkj/common/config/AsyncThreadPoolConfig.java,8\0\80bf55a45d89443866509f377d2b4f56db7fda1b
t
Dsrc/main/java/site/cnkj/common/config/ElasticsearchClientConfig.java,c\1\c131e8dffaaace66f248f9071023b60be7b277a4
h
8src/main/java/site/cnkj/common/config/MongodbConfig.java,5\e\5ea6818d32d6309aa2758cc5429b176d6328d51f
f
6src/main/java/site/cnkj/common/config/RedisConfig.java,2\b\2b5e0787fcb106c7e2c215b9201949810fe97d18
m
=src/main/java/site/cnkj/common/config/RestTemplateConfig.java,f\c\fc37a8cb3cd4e86789b6dcadf3271e6894269266
i
9src/main/java/site/cnkj/common/object/redis/Receiver.java,4\a\4a24c23f6158d7abc5657040e232691adcee44ac
m
=src/main/java/site/cnkj/common/object/servlet/BaseResult.java,1\9\19affac2f7e5749f37c36532ef281eec1befbd05
m
=src/main/java/site/cnkj/common/object/servlet/CommonInfo.java,6\b\6b5bb34dca0a1a09968bad0dc5ab4ad5434df80e
m
=src/main/java/site/cnkj/common/object/servlet/DataResult.java,1\c\1c4b500508bae883bea47d0637c267e8c57d7580
s
Csrc/main/java/site/cnkj/common/object/servlet/ResponseBodyCode.java,b\c\bc46480ac8ea27c54208391c0607483f70591f52
l
<src/main/java/site/cnkj/common/object/ReasonEnumeration.java,6\5\65fb0f3f093182fd2ca42f4eb1116d36adc8a868
h
8src/main/java/site/cnkj/common/service/ActuatorInfo.java,e\7\e7ba402f75a71f1f452cbf16986ed26aa0c6f1b5
h
8src/main/java/site/cnkj/common/utils/data/KafkaUtil.java,7\4\74438aca9f4a48488fe204b00a7429cabb247abb
o
?src/main/java/site/cnkj/common/utils/data/MongoClientsInit.java,4\9\490c965ee8a02ce158895987485283bb4b666ab6
j
:src/main/java/site/cnkj/common/utils/data/MongodbUtil.java,4\f\4f937c5ca0d0fe93235acbc7630afacda85e3134
g
7src/main/java/site/cnkj/common/utils/date/DateUtil.java,1\5\157e0e9285b69e300624f35e79300c0ed6098936
q
Asrc/main/java/site/cnkj/common/utils/file/FileEncryptDecrypt.java,e\a\eaa75651d9d6785c2bd75843529d61a722450af5
g
7src/main/java/site/cnkj/common/utils/file/FileUtil.java,d\f\df021943680d67b4f49e98599f4bb0e86803c590
m
=src/main/java/site/cnkj/common/utils/http/HttpCommonUtil.java,2\1\21fd7f9a07ee140f9ce9ae11bbe161bdd456cbc8
o
?src/main/java/site/cnkj/common/utils/http/RestTemplateUtil.java,7\7\776a6d7b367518db3108c641270f9c6311fa1150
g
7src/main/java/site/cnkj/common/utils/http/SSH2Util.java,4\4\444a1dc837650c123108b5f8df3ca011832638b7
e
5src/main/java/site/cnkj/common/utils/io/CopyUtil.java,1\1\1195786afcb95315b3ec156ea91e7166c2c2cf10
`
0src/main/java/site/cnkj/common/utils/io/DES.java,6\4\644b718a1d63acca44c411c399624e16ce98e11c
g
7src/main/java/site/cnkj/common/utils/io/RSAEncrypt.java,8\2\82864735cd8af377e6ad061ae189505a1e3e9d7c
g
7src/main/java/site/cnkj/common/utils/io/StringUtil.java,a\4\a43b6e3feeba3336586237a758acfa97b791be5b
k
;src/main/java/site/cnkj/common/utils/logger/LoggerUtil.java,4\f\4ffd3a6de814df96de78c74e6c16f964b4fe9a03
o
?src/main/java/site/cnkj/common/utils/serialize/JacksonUtil.java,8\9\899c5b5653c6a42950622470eb34ab3cd5851009
u
Esrc/main/java/site/cnkj/common/utils/serialize/SoapXmlFormatUtil.java,1\7\1759e0760a24aae1fd0b2b5d7d8622112c621b0e
q
Asrc/main/java/site/cnkj/common/utils/serialize/UrlDecodeUtil.java,1\4\14399913ca07717830f9b08ee87644884fc2959a
q
Asrc/main/java/site/cnkj/common/utils/system/GracefulShutdown.java,f\d\fdadf7a612307c5bb8e90739949b439a1891d886
h
8src/main/java/site/cnkj/common/utils/data/RedisUtil.java,e\0\e00232faab93cb27b9940f780c75123903d70b1c

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,1217 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="52b7c556-aac6-402c-b840-5f2564f1f5d7" name="Default" comment="" />
<ignored path="$PROJECT_DIR$/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="pom.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="295">
<caret line="15" column="46" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<folding>
<element signature="n#build#0;n#project#0;n#!!top" />
</folding>
</state>
</provider>
<provider editor-type-id="MavenHelperPluginDependencyAnalyzer" />
</entry>
</file>
<file leaf-file-name="CommonApplicationTests.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/test/java/site/cnkj/utils/CommonApplicationTests.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SoapXmlFormatUtil.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/serialize/SoapXmlFormatUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1720">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="DataResult.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/object/servlet/DataResult.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
<caret line="8" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RestTemplateUtil.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/http/RestTemplateUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="196">
<caret line="36" column="40" selection-start-line="36" selection-start-column="40" selection-end-line="36" selection-end-column="40" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RedisUtil.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/RedisUtil.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="120">
<caret line="6" column="54" selection-start-line="6" selection-start-column="54" selection-end-line="6" selection-end-column="54" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RedisConfig.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/RedisConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="231">
<caret line="91" column="49" selection-start-line="91" selection-start-column="49" selection-end-line="91" selection-end-column="49" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#3878#3879#0" expanded="true" />
<element signature="e#3949#3950#0" expanded="true" />
<element signature="e#4064#4065#0" expanded="true" />
<element signature="e#4136#4137#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Receiver.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/object/redis/Receiver.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="5" column="17" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ElasticsearchClientConfig.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/ElasticsearchClientConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="309">
<caret line="105" column="50" selection-start-line="105" selection-start-column="50" selection-end-line="105" selection-end-column="50" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>range</find>
<find>size</find>
<find>redisTemplate.delete</find>
<find>listRemove</find>
<find>public long rightPush</find>
<find>MongoClient</find>
<find>group</find>
<find>get</find>
<find>BOOTSTRAP_SERVERS_CONFIG</find>
<find>----------------------------------------------------</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/config/AsyncExecutePool.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/FileEncryptDecrypt.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/FileUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/HttpCommonUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/RedisUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/config/RedisConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/config/MongodbConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/service/ActuatorInfo.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/SSH2Util.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/KafkaUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/cnkj/site/data/ProtobufOuter.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/StringUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/cnkj/site/data/ProtobufOuterOperation.java" />
<option value="$PROJECT_DIR$/repository/site/cnkj/CommonUtil/maven-metadata-local.xml" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/MongoClientsInit.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/utils/MongodbUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/common/utils/http/HttpCommonUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/config/RedisConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/config/RestTemplateConfig.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/service/ActuatorInfo.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/io/CopyUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/io/StringUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/KafkaUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/file/FileUtil.java" />
<option value="$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/logger/LoggerUtil.java" />
<option value="$PROJECT_DIR$/pom.xml" />
<option value="$PROJECT_DIR$/src/test/java/site/cnkj/utils/CommonApplicationTests.java" />
<option value="$PROJECT_DIR$/README.md" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="alwaysUpdateSnapshots" value="true" />
<option name="localRepository" value="C:\Users\Carol\.m2\repository" />
<option name="userSettingsFile" value="C:\Users\Carol\.m2\settings.xml" />
</MavenGeneralSettings>
</option>
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="MavenProjectNavigator">
<treeState>
<expand>
<path>
<item name="" type="16c1761:MavenProjectsStructure$RootNode" />
<item name="CommonUtil" type="9519ce18:MavenProjectsStructure$ProjectNode" />
</path>
<path>
<item name="" type="16c1761:MavenProjectsStructure$RootNode" />
<item name="CommonUtil" type="9519ce18:MavenProjectsStructure$ProjectNode" />
<item name="Lifecycle" type="58874e2:MavenProjectsStructure$LifecycleNode" />
</path>
</expand>
<select />
</treeState>
</component>
<component name="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="168" />
<option name="y" value="25" />
<option name="width" value="1693" />
<option name="height" value="1056" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="AndroidView" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="data" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="common" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="common" type="462c0819:PsiDirectoryNode" />
<item name="config" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="CommonUtil" type="b2602c69:ProjectViewProjectNode" />
<item name="CommonUtil" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="utils" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="LombokPluginEnabledInProject" value="true" />
<property name="LombokPluginIS_ANNOTATION_PROCESSING_CHECK_Enabled" value="true" />
<property name="LombokPluginIS_BUILDER_Enabled" value="true" />
<property name="LombokPluginIS_CONSTRUCTOR_Enabled" value="true" />
<property name="LombokPluginIS_DELEGATE_Enabled" value="true" />
<property name="LombokPluginIS_LOG_Enabled" value="true" />
<property name="LombokPluginIS_LOMBOK_VERSION_CHECK_Enabled" value="false" />
<property name="LombokPluginIS_MISSING_LOMBOK_CHECK_Enabled" value="true" />
<property name="LombokPluginIS_VAL_Enabled" value="true" />
<property name="SONARLINT_PRECOMMIT_ANALYSIS" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.standard" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.standard" value="project" />
<property name="node.js.selected.package.eslint" value="C:\Users\Carol\AppData\Roaming\npm\node_modules\eslint" />
<property name="node.js.selected.package.standard" value="" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="fileTemplates" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="F:\mine\CommonUtil\src\main\java" />
<recent name="F:\CommonUtil\repository\site\cnkj\CommonUtil" />
<recent name="F:\CommonUtil\maven" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="F:\CommonUtil\repository\site\cnkj\CommonUtil\1.1.0" />
<recent name="F:\CommonUtil\repository\site\cnkj\CommonUtil" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Application.KafkaUtil">
<configuration name="HttpCommonUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="site.cnkj.utils.HttpCommonUtil" />
<module name="CommonUtil" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="site.cnkj.common.utils.data.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</configuration>
<configuration name="KafkaUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="site.cnkj.utils.KafkaUtil" />
<module name="CommonUtil" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="site.cnkj.common.utils.data.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</configuration>
<configuration name="SSH2Util" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="site.cnkj.common.utils.http.SSH2Util" />
<module name="CommonUtil" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="site.cnkj.common.utils.data.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<patterns />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
<option name="OUTPUT_DIRECTORY" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<properties />
<listeners />
</configuration>
<list>
<item itemvalue="Application.HttpCommonUtil" />
<item itemvalue="Application.KafkaUtil" />
<item itemvalue="Application.SSH2Util" />
</list>
<recent_temporary>
<list>
<item itemvalue="Application.KafkaUtil" />
<item itemvalue="Application.SSH2Util" />
<item itemvalue="Application.HttpCommonUtil" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="52b7c556-aac6-402c-b840-5f2564f1f5d7" name="Default" comment="" />
<created>1574318981558</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1574318981558</updated>
<workItem from="1574318985781" duration="20983000" />
<workItem from="1574645677739" duration="20147000" />
<workItem from="1574752879588" duration="2458000" />
<workItem from="1574835832018" duration="761000" />
<workItem from="1575510784503" duration="16722000" />
<workItem from="1575597300473" duration="4388000" />
<workItem from="1576052386425" duration="1344000" />
<workItem from="1577177015630" duration="4911000" />
<workItem from="1577415273846" duration="2628000" />
<workItem from="1577437512143" duration="1157000" />
<workItem from="1578970199029" duration="617000" />
<workItem from="1579241019347" duration="2236000" />
<workItem from="1579419449173" duration="2484000" />
<workItem from="1597628550773" duration="1330000" />
<workItem from="1612775343578" duration="692000" />
<workItem from="1612838922198" duration="1250000" />
</task>
<task id="LOCAL-00001" summary="repair some lombok questions">
<created>1574320188766</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1574320188766</updated>
</task>
<task id="LOCAL-00002" summary="SonarLint">
<created>1574321436529</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1574321436529</updated>
</task>
<task id="LOCAL-00003" summary="new info for use it">
<created>1574323845093</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1574323845093</updated>
</task>
<task id="LOCAL-00004" summary="download">
<created>1574324452589</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1574324452589</updated>
</task>
<task id="LOCAL-00005" summary="note">
<created>1574324574660</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1574324574660</updated>
</task>
<task id="LOCAL-00006" summary="Merge branch 'master' of https://github.com/carolcoral/CommonUtil&#10;&#10;# Conflicts:&#10;#&#9;README.md">
<created>1574325130810</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1574325130810</updated>
</task>
<task id="LOCAL-00007" summary="Merge branch 'master' of https://github.com/carolcoral/CommonUtil&#10;&#10;# Conflicts:&#10;#&#9;README.md">
<created>1574325149223</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1574325149223</updated>
</task>
<task id="LOCAL-00008" summary="repair methods`name and result of return in RedisUtil.class">
<created>1574407956134</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1574407956134</updated>
</task>
<task id="LOCAL-00009" summary="pom.xml had change">
<created>1574411837384</created>
<option name="number" value="00009" />
<option name="presentableId" value="LOCAL-00009" />
<option name="project" value="LOCAL" />
<updated>1574411837384</updated>
</task>
<task id="LOCAL-00010" summary="change README">
<created>1574411942406</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1574411942406</updated>
</task>
<task id="LOCAL-00011" summary="new MongoDBUtil">
<created>1574672317445</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1574672317445</updated>
</task>
<task id="LOCAL-00012" summary="1.0.2">
<created>1574672730578</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1574672730578</updated>
</task>
<task id="LOCAL-00013" summary="1.0.2">
<created>1574819212177</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1574819212177</updated>
</task>
<task id="LOCAL-00014" summary="change result for KafkaUtil from &quot;TopicPartition&quot; to &quot;String&quot;">
<created>1574835930667</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1574835930667</updated>
</task>
<task id="LOCAL-00015" summary="add new method to get offset from kafka">
<created>1575513135743</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1575513135743</updated>
</task>
<task id="LOCAL-00016" summary="readme.md">
<created>1576052500071</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1576052500071</updated>
</task>
<task id="LOCAL-00017" summary="readme.md">
<created>1576053081227</created>
<option name="number" value="00017" />
<option name="presentableId" value="LOCAL-00017" />
<option name="project" value="LOCAL" />
<updated>1576053081227</updated>
</task>
<task id="LOCAL-00018" summary="readme.md">
<created>1576053595567</created>
<option name="number" value="00018" />
<option name="presentableId" value="LOCAL-00018" />
<option name="project" value="LOCAL" />
<updated>1576053595567</updated>
</task>
<task id="LOCAL-00019" summary="get offset from kafka by timestamp">
<created>1577179466914</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1577179466914</updated>
</task>
<task id="LOCAL-00020" summary="demo for protobuf operation">
<created>1577438196875</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1577438196875</updated>
</task>
<task id="LOCAL-00021" summary="maven">
<created>1579420465866</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1579420465866</updated>
</task>
<task id="LOCAL-00022" summary="new class for multi mongo-client">
<created>1597628792278</created>
<option name="number" value="00022" />
<option name="presentableId" value="LOCAL-00022" />
<option name="project" value="LOCAL" />
<updated>1597628792278</updated>
</task>
<task id="LOCAL-00023" summary="new class for multi mongo-client">
<created>1597629876924</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1597629876924</updated>
</task>
<task id="LOCAL-00024" summary="change folder and fix some bug">
<created>1612840009845</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1612840009845</updated>
</task>
<task id="LOCAL-00025" summary="change folder and fix some bug">
<created>1612840186807</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1612840186807</updated>
</task>
<option name="localTasksCounter" value="26" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="84108000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="RestServices" order="4" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="right" id="Maven Projects" order="3" weight="0.32995737" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info id="Capture Tool" order="2" />
<window_info id="Designer" order="2" />
<window_info anchor="bottom" id="Statistic" order="7" />
<window_info anchor="right" id="Database" order="3" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info id="UI Designer" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.3991276" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Messages" order="7" weight="0.3293348" />
<window_info anchor="right" id="Palette&#9;" order="3" />
<window_info id="Image Layers" order="2" />
<window_info anchor="bottom" id="Java Enterprise" order="7" />
<window_info anchor="right" id="Capture Analysis" order="3" />
<window_info active="true" anchor="bottom" id="Version Control" order="7" visible="true" weight="0.32606325" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3642312" />
<window_info anchor="bottom" id="Spring" order="7" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.3293348" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19989339" />
<window_info id="Web" order="2" side_tool="true" />
<window_info anchor="bottom" id="SonarLint" order="7" weight="0.3293348" />
<window_info anchor="right" id="Theme Preview" order="3" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="right" id="Bean Validation" order="3" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="bottom" id="Find" order="1" />
</layout>
<layout-to-restore>
<window_info id="Designer" order="0" />
<window_info anchor="right" id="Palette" order="0" />
<window_info anchor="bottom" id="Spring" order="0" />
<window_info id="Image Layers" order="1" />
<window_info anchor="bottom" id="Run" order="11" weight="0.519084" />
<window_info anchor="bottom" id="Cvs" order="13" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="8" weight="0.25" />
<window_info id="UI Designer" order="2" />
<window_info id="Favorites" order="3" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info id="Capture Tool" order="4" />
<window_info anchor="right" id="Capture Analysis" order="1" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="7" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
<window_info anchor="bottom" id="Statistic" order="3" />
<window_info anchor="bottom" id="TODO" order="15" />
<window_info anchor="bottom" id="SonarLint" order="4" weight="0.3293348" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="9" weight="0.25" />
<window_info anchor="bottom" id="Java Enterprise" order="5" />
<window_info anchor="bottom" id="Database Changes" order="6" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="7" visible="true" weight="0.3293348" />
<window_info anchor="right" id="Maven Projects" order="2" weight="0.32995737" />
<window_info active="true" content_ui="combo" id="Project" order="6" visible="true" weight="0.20415778" />
<window_info anchor="bottom" id="Messages" order="8" weight="0.3293348" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="bottom" id="Message" order="9" />
<window_info id="Web" order="5" side_tool="true" />
<window_info anchor="right" id="Palette&#9;" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info id="Structure" order="7" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="14" weight="0.4" />
<window_info anchor="bottom" id="Find" order="10" />
<window_info anchor="right" id="Bean Validation" order="6" />
<window_info anchor="bottom" id="Debug" order="12" weight="0.4" />
</layout-to-restore>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
<option name="COLUMN_ORDER">
<list>
<option value="0" />
<option value="1" />
<option value="2" />
<option value="3" />
</list>
</option>
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="repair some lombok questions" />
<MESSAGE value="SonarLint" />
<MESSAGE value="new info for use it" />
<MESSAGE value="download" />
<MESSAGE value="note" />
<MESSAGE value="Merge branch 'master' of https://github.com/carolcoral/CommonUtil&#10;&#10;# Conflicts:&#10;#&#9;README.md" />
<MESSAGE value="repair methods`name and result of return in RedisUtil.class" />
<MESSAGE value="pom.xml had change" />
<MESSAGE value="change README" />
<MESSAGE value="new MongoDBUtil" />
<MESSAGE value="1.0.2" />
<MESSAGE value="change result for KafkaUtil from &quot;TopicPartition&quot; to &quot;String&quot;" />
<MESSAGE value="add new method to get offset from kafka" />
<MESSAGE value="readme.md" />
<MESSAGE value="get offset from kafka by timestamp" />
<MESSAGE value="demo for protobuf operation" />
<MESSAGE value="maven" />
<MESSAGE value="new class for multi mongo-client" />
<MESSAGE value="change folder and fix some bug" />
<option name="LAST_COMMIT_MESSAGE" value="change folder and fix some bug" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/http/SSH2Util.java</url>
<line>153</line>
<properties />
<option name="timeStamp" value="6" />
</line-breakpoint>
</breakpoints>
<option name="time" value="7" />
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="jar://$MAVEN_REPOSITORY$/ch/ethz/ganymed/ganymed-ssh2/262/ganymed-ssh2-262-sources.jar!/ch/ethz/ssh2/SCPInputStream.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="340">
<caret line="23" column="11" selection-start-line="23" selection-start-column="11" selection-end-line="23" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_171/src.zip!/java/io/File.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9240">
<caret line="497" column="16" selection-start-line="497" selection-start-column="16" selection-end-line="497" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="jar://$MAVEN_REPOSITORY$/ch/ethz/ganymed/ganymed-ssh2/262/ganymed-ssh2-262-sources.jar!/ch/ethz/ssh2/SCPClient.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3420">
<caret line="177" column="27" selection-start-line="177" selection-start-column="27" selection-end-line="177" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_171/src.zip!/java/util/Objects.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-120">
<caret line="197" column="46" selection-start-line="197" selection-start-column="46" selection-end-line="197" selection-end-column="46" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/service/ActuatorInfo.java" />
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/domain/BaseResult.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/HttpCommonUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
<caret line="13" column="13" selection-start-line="13" selection-start-column="13" selection-end-line="13" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/wiki/ElasticSearch.md" />
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/1.1.1/kafka-clients-1.1.1-sources.jar!/org/apache/kafka/clients/consumer/OffsetAndTimestamp.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="23" column="19" selection-start-line="23" selection-start-column="19" selection-end-line="23" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/1.1.1/kafka-clients-1.1.1-sources.jar!/org/apache/kafka/clients/consumer/internals/Fetcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6360">
<caret line="404" column="44" selection-start-line="404" selection-start-column="44" selection-end-line="404" selection-end-column="44" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/KafkaUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="388">
<caret line="181" column="20" selection-start-line="181" selection-start-column="20" selection-end-line="181" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="jar://C:/Program Files/Java/jdk1.8.0_171/src.zip!/java/util/Map.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="245">
<caret line="295" column="9" selection-start-line="295" selection-start-column="9" selection-end-line="295" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/RedisUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="620">
<caret line="39" column="29" selection-start-line="39" selection-start-column="29" selection-end-line="39" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/repository/site/cnkj/CommonUtil/1.1.0/_remote.repositories" />
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/1.1.1/kafka-clients-1.1.1-sources.jar!/org/apache/kafka/common/TopicPartition.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="280">
<caret line="29" column="49" selection-start-line="29" selection-start-column="49" selection-end-line="29" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="jar://$MAVEN_REPOSITORY$/org/apache/kafka/kafka-clients/1.1.1/kafka-clients-1.1.1-sources.jar!/org/apache/kafka/clients/consumer/KafkaConsumer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20">
<caret line="1608" column="99" selection-start-line="1608" selection-start-column="99" selection-end-line="1608" selection-end-column="99" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/repository/site/cnkj/CommonUtil/1.1.0/CommonUtil-1.1.0.pom" />
<entry file="file://$PROJECT_DIR$/repository/site/cnkj/CommonUtil/maven-metadata-local.xml" />
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/cnkj/site/data/ProtobufOuter.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1320">
<caret line="66" column="19" selection-start-line="66" selection-start-column="19" selection-end-line="66" selection-end-column="19" />
<folding>
<element signature="e#0#37264#0" expanded="true" />
<element signature="e#2522#2523#0" expanded="true" />
<element signature="e#2560#2561#0" expanded="true" />
<element signature="e#2595#2596#0" expanded="true" />
<element signature="e#2663#2664#0" expanded="true" />
<element signature="e#2778#2779#0" expanded="true" />
<element signature="e#2827#2828#0" expanded="true" />
<element signature="e#7896#7897#0" expanded="true" />
<element signature="e#7963#7964#0" expanded="true" />
<element signature="e#8469#8470#0" expanded="true" />
<element signature="e#8515#8516#0" expanded="true" />
<element signature="e#10109#10110#0" expanded="true" />
<element signature="e#10145#10146#0" expanded="true" />
<element signature="e#17539#17540#0" expanded="true" />
<element signature="e#17598#17599#0" expanded="true" />
<element signature="e#20418#20419#0" expanded="true" />
<element signature="e#20483#20484#0" expanded="true" />
<element signature="e#22670#22671#0" expanded="true" />
<element signature="e#22732#22733#0" expanded="true" />
<element signature="e#25105#25106#0" expanded="true" />
<element signature="e#25148#25149#0" expanded="true" />
<element signature="e#27129#27130#0" expanded="true" />
<element signature="e#27204#27205#0" expanded="true" />
<element signature="e#27762#27763#0" expanded="true" />
<element signature="e#27816#27817#0" expanded="true" />
<element signature="e#30029#30030#0" expanded="true" />
<element signature="e#30111#30112#0" expanded="true" />
<element signature="e#31356#31357#0" expanded="true" />
<element signature="e#31400#31401#0" expanded="true" />
<element signature="e#33176#33177#0" expanded="true" />
<element signature="e#33223#33224#0" expanded="true" />
<element signature="e#33860#33861#0" expanded="true" />
<element signature="e#33897#33898#0" expanded="true" />
<element signature="e#34005#34006#0" expanded="true" />
<element signature="e#34042#34043#0" expanded="true" />
<element signature="e#34160#34161#0" expanded="true" />
<element signature="e#34207#34208#0" expanded="true" />
<element signature="e#34935#34936#0" expanded="true" />
<element signature="e#34968#34969#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/MongoClientsInit.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="200">
<caret line="20" column="5" selection-start-line="20" selection-start-column="5" selection-end-line="20" selection-end-column="5" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/cnkj/site/data/ProtobufOuterOperation.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" column="13" selection-start-line="16" selection-start-column="13" selection-end-line="16" selection-end-column="13" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/AsyncExecutePool.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/AsyncThreadPoolConfig.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/MongoClientsInit.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/object/servlet/BaseResult.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/serialize/UrlDecodeUtil.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/http/HttpCommonUtil.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/StringUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="451">
<caret line="111" selection-start-line="111" selection-end-line="111" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/MongodbUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
<caret line="17" column="13" selection-start-line="17" selection-start-column="13" selection-end-line="17" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/config/ElasticsearchConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1040">
<caret line="32" column="13" selection-start-line="32" selection-start-column="13" selection-end-line="32" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/MongodbConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="21" column="28" selection-start-line="21" selection-start-column="28" selection-end-line="21" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/utils/LoggerUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="23" column="31" lean-forward="true" selection-start-line="23" selection-start-column="31" selection-end-line="23" selection-end-column="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/http/SSH2Util.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="280">
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
<folding>
<element signature="imports" expanded="true" />
<element signature="class#ConnectEntity#0;class#SSH2Util#0" />
<element signature="method#login#0;class#SSH2Util#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/RestTemplateConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1540">
<caret line="77" column="19" selection-start-line="77" selection-start-column="19" selection-end-line="77" selection-end-column="19" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/service/ActuatorInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="24" column="22" selection-start-line="24" selection-start-column="22" selection-end-line="24" selection-end-column="22" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/io/CopyUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="24" column="12" selection-start-line="24" selection-start-column="12" selection-end-line="24" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/io/StringUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20">
<caret line="1" selection-start-line="1" selection-end-line="1" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/KafkaUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2305">
<caret line="122" column="39" selection-start-line="122" selection-start-column="39" selection-end-line="122" selection-end-column="39" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/file/FileUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="307" column="16" selection-start-line="307" selection-start-column="16" selection-end-line="307" selection-end-column="16" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/logger/LoggerUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="188">
<caret line="306" column="36" selection-start-line="306" selection-start-column="36" selection-end-line="306" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/RedisConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="231">
<caret line="91" column="49" selection-start-line="91" selection-start-column="49" selection-end-line="91" selection-end-column="49" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#3878#3879#0" expanded="true" />
<element signature="e#3949#3950#0" expanded="true" />
<element signature="e#4064#4065#0" expanded="true" />
<element signature="e#4136#4137#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/object/redis/Receiver.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="5" column="17" selection-start-line="5" selection-start-column="17" selection-end-line="5" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/config/ElasticsearchClientConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="309">
<caret line="105" column="50" selection-start-line="105" selection-start-column="50" selection-end-line="105" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="295">
<caret line="15" column="46" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<folding>
<element signature="n#build#0;n#project#0;n#!!top" />
</folding>
</state>
</provider>
<provider editor-type-id="MavenHelperPluginDependencyAnalyzer" />
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/site/cnkj/utils/CommonApplicationTests.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/serialize/SoapXmlFormatUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1720">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/object/servlet/DataResult.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="140">
<caret line="8" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/http/RestTemplateUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="196">
<caret line="36" column="40" selection-start-line="36" selection-start-column="40" selection-end-line="36" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/site/cnkj/common/utils/data/RedisUtil.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="120">
<caret line="6" column="54" selection-start-line="6" selection-start-column="54" selection-end-line="6" selection-end-column="54" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
<component name="mavenExecuteGoalHistory">
<option value="" />
</component>
</project>

188
CommonUtil.iml Normal file
View File

@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="CheckStyle-IDEA-Module">
<option name="configuration">
<map />
</option>
</component>
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.37" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.37" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.3" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.8.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.51.Final" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.7" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.client:elasticsearch-rest-high-level-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.plugin:mapper-extras-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.plugin:parent-join-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.plugin:aggs-matrix-stats-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.plugin:rank-eval-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.plugin:lang-mustache-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: com.github.spullara.mustache.java:compiler:0.9.6" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.client:elasticsearch-rest-client:7.9.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.13" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch:7.13.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch-core:7.13.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch-secure-sm:7.13.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch-x-content:7.13.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.11.1" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch-geo:7.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-core:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-analyzers-common:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-backward-codecs:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-grouping:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-highlighter:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-join:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-memory:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-misc:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queries:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queryparser:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-sandbox:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-spatial-extras:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-spatial3d:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-suggest:8.8.2" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:elasticsearch-cli:7.13.3" level="project" />
<orderEntry type="library" name="Maven: net.sf.jopt-simple:jopt-simple:5.0.2" level="project" />
<orderEntry type="library" name="Maven: com.carrotsearch:hppc:0.8.1" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.10" level="project" />
<orderEntry type="library" name="Maven: com.tdunning:t-digest:3.2" level="project" />
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch:jna:5.7.0-1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.elasticsearch:elasticsearch-plugin-classloader:7.13.3" level="project" />
<orderEntry type="library" name="Maven: org.elasticsearch.client:elasticsearch-rest-client-sniffer:7.9.3" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.5.0" level="project" />
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.4-7" level="project" />
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.7.1" level="project" />
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.5.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.47" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.67" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:4.0.5" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:4.0.5" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:4.0.5" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-legacy:4.0.5" level="project" />
<orderEntry type="library" name="Maven: ch.ethz.ganymed:ganymed-ssh2:262" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.protobuf-java-format:protobuf-java-format:1.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:3.8.2" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
</component>
</module>

View File

@ -3,14 +3,23 @@
## [WIKI](https://github.com/carolcoral/CommonUtil/wiki)
## Download
* [CommonUtil.jar](https://github.com/carolcoral/CommonUtil/releases/download/2.0.2/CommonUtil-2.0.2.jar)
* [CommonUtil-javadoc.jar](https://github.com/carolcoral/CommonUtil/releases/download/2.0.2/CommonUtil-2.0.2-javadoc.jar)
* [CommonUtil-sources.jar](https://github.com/carolcoral/CommonUtil/releases/download/2.0.2/CommonUtil-2.0.2-sources.jar)
## Log
> `2021年2月9日 11:09:13` change folder and fix some bug.
> `2021-10-29 13:51:03` add and fix some methods.Update version to 2.1.0.
> `2020年8月20日 16:49:23` new class [MongoClientsInit](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/MongoClientsInit.java) for create muti mongoClient.More info to see [How to use MongoClientsInit](https://carolcoral.github.io/Article/JAVA/Java%E6%9E%84%E5%BB%BA%E5%A4%9Amongo%E6%95%B0%E6%8D%AE%E6%BA%90%E5%AE%A2%E6%88%B7%E7%AB%AF)
> `2021-3-24 11:24:53` fix some bugs and change mongoClient init. [Use MongoClientInit](https://github.com/carolcoral/CommonUtil/wiki/MongoClientInit).
> `2020年7月21日 11:20:14` fix some expire bug from [RedisUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/RedisUtil.java).
> `2021-2-9 11:09:13` change folder and fix some bug.
> `2020年7月20日 14:17:00` New date function `String formatDateByReg(String date_format, int parseInt)` for format date by The date-format [DateUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/DateUtil.java).For example like this:
> `2020-8-20 16:49:23` new class [MongoClientsInit](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/MongoClientsInit.java) for create muti mongoClient.More info to see [How to use MongoClientsInit](https://carolcoral.github.io/Article/JAVA/Java%E6%9E%84%E5%BB%BA%E5%A4%9Amongo%E6%95%B0%E6%8D%AE%E6%BA%90%E5%AE%A2%E6%88%B7%E7%AB%AF)
> `2020-7-21 11:20:14` fix some expire bug from [RedisUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/RedisUtil.java).
> `2020-7-20 14:17:00` New date function `String formatDateByReg(String date_format, int parseInt)` for format date by The date-format [DateUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/DateUtil.java) .For example like this:
```java
public static void main(String[] args) {
@ -43,7 +52,7 @@ current date_format is: YYYY-MM-dd HH:mm:ss
current format result is:2020-07-20 14:15:08
```
> `2019年12月27日 17:20:34` Demo to show how to operation Protobuf in java.[Java中使用ProtoBuf数据](https://github.com/carolcoral/CommonUtil/wiki/Java中使用ProtoBuf数据)
> `2019-12-27 17:20:34` Demo to show how to operation Protobuf in java.[Java中使用ProtoBuf数据](https://github.com/carolcoral/CommonUtil/wiki/Java中使用ProtoBuf数据)
> `2019-12-05 14:33:23` New class for remotely connect to the server and execute the script.[SSH2Util](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/SSH2Util.java)
@ -65,6 +74,6 @@ mvn install:install-file -Dfile=/User/carol/Desktop/CommonUtil-1.0.jar -DgroupId
<dependency>
<groupId>site.cnkj</groupId>
<artifactId>CommonUtil</artifactId>
<version>1.0</version>
<version>2.0.2</version>
</dependency>
```

23
pom.xml
View File

@ -7,7 +7,7 @@
<groupId>site.cnkj</groupId>
<artifactId>CommonUtil</artifactId>
<packaging>jar</packaging>
<version>2.0.1</version>
<version>2.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
@ -64,7 +64,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<version>2.7</version>
</dependency>
<!--es-->
@ -81,7 +81,7 @@
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.11.0</version>
<version>7.13.3</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
@ -114,7 +114,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.56</version>
<version>1.67</version>
</dependency>
<!--import lombok instant of to get/set-->
@ -125,11 +125,11 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!--<version>2.1.3.RELEASE</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.mongodb</groupId>
@ -173,6 +173,11 @@
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.8.RELEASE</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,78 @@
package site.cnkj.common.config;
import com.mongodb.MongoClientOptions;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import site.cnkj.common.utils.data.MongoClientsInit;
import java.util.HashMap;
/*
* @author LXW
* @create 2021/3/24 10:51
* @Description
* 1. 使用本bean的时候需要在启动类上加上下面这行注解否则会自动链接本地mongo出现异常
* <code>@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})</code>
* 2. 使用MongoClient的时候不能同时使用SpringMongo如果存在SpringMongo的maven依赖需要去除
*/
@Setter
@Configuration
@ConfigurationProperties(prefix = "spring.data.mongodb")
public class MongoClientConfig {
private HashMap<String, String> uri = new HashMap<>();
private String applicationName;
private Boolean retryWrites = true;
private Boolean retryReads = true;
private Integer minConnectionsPerHost;
private Integer maxConnectionsPerHost = 100;
private Integer serverSelectionTimeout = 1000 * 30;
private Integer maxWaitTime = 1000 * 60 * 2;
private Integer maxConnectionIdleTime;
private Integer maxConnectionLifeTime;
private Integer connectTimeout = 1000 * 10;
private Integer socketTimeout = 0;
private Boolean sslEnabled = false;
private Boolean sslInvalidHostNameAllowed = false;
private Integer heartbeatFrequency = 10000;
private Integer minHeartbeatFrequency = 500;
private Integer heartbeatConnectTimeout = 20000;
private Integer heartbeatSocketTimeout = 20000;
private Integer localThreshold = 15;
private MongoClientOptions.Builder builder(){
//配制连接池
MongoClientOptions.Builder mongoClientBuilder = new MongoClientOptions.Builder();
mongoClientBuilder.applicationName(applicationName);
mongoClientBuilder.connectionsPerHost(maxConnectionsPerHost);
mongoClientBuilder.connectTimeout(connectTimeout);
mongoClientBuilder.heartbeatConnectTimeout(heartbeatConnectTimeout);
mongoClientBuilder.heartbeatFrequency(heartbeatFrequency);
mongoClientBuilder.heartbeatSocketTimeout(heartbeatSocketTimeout);
mongoClientBuilder.localThreshold(localThreshold);
mongoClientBuilder.maxConnectionIdleTime(maxConnectionIdleTime);
mongoClientBuilder.maxConnectionLifeTime(maxConnectionLifeTime);
mongoClientBuilder.maxWaitTime(maxWaitTime);
mongoClientBuilder.minConnectionsPerHost(minConnectionsPerHost);
mongoClientBuilder.minHeartbeatFrequency(minHeartbeatFrequency);
mongoClientBuilder.retryReads(retryReads);
mongoClientBuilder.retryWrites(retryWrites);
mongoClientBuilder.serverSelectionTimeout(serverSelectionTimeout);
mongoClientBuilder.socketTimeout(socketTimeout);
mongoClientBuilder.sslEnabled(sslEnabled);
mongoClientBuilder.sslInvalidHostNameAllowed(sslInvalidHostNameAllowed);
return mongoClientBuilder;
}
@Bean(name = "mongoClientsInit")
public MongoClientsInit mongoClientsInit(){
return new MongoClientsInit(uri, builder());
}
}

View File

@ -1,44 +0,0 @@
package site.cnkj.common.config;
import com.mongodb.MongoClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import site.cnkj.common.utils.data.MongodbUtil;
/*
* @version 1.0 created by LXW on 2019/11/22 16:50
*/
@Configuration
@ConditionalOnProperty(prefix="spring.data.mongodb", name = "uri")
public class MongodbConfig {
private String host;
private int port;
private String database;
/**
* 默认集合名称前缀
*/
private String mongoName = "";
@Bean
public MongoDbFactory mongoDbFactory() throws Exception {
return new SimpleMongoDbFactory(new MongoClient(host, port), database);
}
@Bean
public MongoTemplate getMongoTemplate() throws Exception {
return new MongoTemplate(mongoDbFactory());
}
@Bean(name = "mongodbUtil")
public MongodbUtil mongodbUtil(MongoTemplate mongoTemplate) {
return new MongodbUtil(mongoTemplate, mongoName);
}
}

View File

@ -12,10 +12,12 @@ import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import site.cnkj.common.object.redis.Receiver;
import site.cnkj.common.object.Receiver;
import site.cnkj.common.utils.data.RedisUtil;
/**
* Created by rx on 2018/8/22.
*/
@Configuration
public class RedisConfig {

View File

@ -0,0 +1,89 @@
package site.cnkj.common.enumeration;
/**
* 返回报文状态码枚举值
*
* @author Carol, 2021-08-31
**/
public enum ResponseStatusEnum {
CONTINUE(100, "服务器已经接收到请求头, 并且客户端应继续发送请求主体."),
SWITCHING_PROTOCOLS(101, "服务器已经理解了客户端的请求, 并将通过Upgrade消息头通知客户端采用不同的协议来完成这个请求."),
PROCESSION(102, "WebDAV请求可能包含许多涉及文件操作的子请求, 需要很长时间才能完成请求."),
EARLY_HINTS(103, "用来在最终的HTTP消息之前返回一些响应头."),
SUCCESS(200, "请求已成功, 请求所希望的响应头或数据体将随此响应返回."),
CREATED(201, "请求已经被实现, 而且有一个新的资源已经依据请求的需要而创建, 且其URI已经随Location头信息返回."),
ACCEPTED(202, "服务器已接受请求, 但尚未处理。最终该请求可能会也可能不会被执行, 并且可能在处理发生时被禁止."),
NON_AUTHORITATIVE_INFORMATION(203, "服务器是一个转换代理服务器, 以200 OK状态码为起源, 但回应了原始响应的修改版本."),
NO_CONTENT(204, "服务器成功处理了请求, 没有返回任何内容."),
RESET_CONTENT(205, "服务器成功处理了请求, 但没有返回任何内容."),
PARTIAL_CONTENT(206, "服务器已经成功处理了部分GET请求."),
MULTI_STATUS(207, "代表之后的消息体将是一个XML消息, 并且可能依照之前子请求数量的不同, 包含一系列独立的响应代码."),
ALREADY_REPORTED(208, "DAV绑定的成员已经在多状态响应之前的部分被列举, 且未被再次包含."),
IM_USED(226, "服务器已经接收到请求头, 并且客户端应继续发送请求主体."),
MULTIPLE_CHOICES(300, "被请求的资源有一系列可供选择的回馈信息."),
MOVED_PERMANENTLY(301, "被请求的资源已永久移动到新位置."),
FOUND(302, "要求客户端执行临时重定向."),
SEE_OTHER(303, "对应当前请求的响应可以在另一个URI上被找到."),
NOT_MODIFIED(304, "表示资源在由请求头中的If-Modified-Since或If-None-Match参数指定的这一版本之后, 未曾被修改."),
USE_PROXY(305, "被请求的资源必须通过指定的代理才能被访问."),
SWITCH_PROXY(306, "后续请求应使用指定的代理."),
TEMPORARY_REDIRECT(307, "请求应该与另一个URI重复, 但后续的请求应仍使用原始的URI."),
PERMANENT_REDIRECT(308, "请求和所有将来的请求应该使用另一个URI重复."),
BAD_REQUEST(400, "由于明显的客户端错误, 服务器不能或不会处理该请求."),
UNAUTHORIZED(401, "当前请求需要用户验证."),
FORBIDDEN(403, "服务器已经理解请求, 但是拒绝执行它."),
NOT_FOUND(404, "请求所希望得到的资源未被在服务器上发现."),
METHOD_NOT_ALLOWED(405, "请求行中指定的请求方法不能被用于请求相应的资源."),
NOT_ACCEPTABLE(406, "请求的资源的内容特性无法满足请求头中的条件."),
PROXY_AUTHENTICATION_REQUIRED(407, "客户端必须在代理服务器上进行身份验证."),
REQUEST_TIMEOUT(408, "请求超时."),
CONFLICT(409, "请求存在冲突无法处理该请求."),
GONE(410, "所请求的资源不再可用."),
LENGTH_REQUIRED(411, "服务器拒绝在没有定义Content-Length头的情况下接受请求."),
PRECONDITION_FAILED(412, "服务器在验证在请求的头字段中给出先决条件时, 没能满足其中的一个或多个."),
REQUEST_ENTITY_TOO_LARGE(413, "服务器拒绝处理当前请求, 该请求提交的实体数据大小超过了服务器愿意或者能够处理的范围."),
REQUEST_URL_TOO_LONG(414, "请求的URI长度超过了服务器能够解释的长度."),
UNSUPPORTED_MEDIA_TYPE(415, "请求中提交的互联网媒体类型并不是服务器中所支持的格式."),
REQUESTED_RANG_NOT_SATISFIABLE(416, "客户端已经要求文件的一部分Byte serving, 但服务器不能提供该部分."),
EXPECTATION_FAILED(417, "在请求头Expect中指定的预期内容无法被服务器满足."),
MISDIRECTED_REQUEST(421, "无法产生响应的服务器."),
UNPROCESSABLE_ENTITY(422, "请求格式正确, 但是由于含有语义错误, 无法响应."),
LOCKED(423, "当前资源被锁定."),
FAILED_DEPENDENCE(424, "由于之前的某个请求发生的错误, 导致当前请求失败."),
TOO_EARLY(425, "服务器拒绝处理在Early Data中的请求."),
UPGRADE_REQUIRED(426, "客户端应切换到Upgrade头字段中给出的不同协议."),
PRECONDITION_REQUIRED(428, "原服务器要求该请求满足一定条件."),
TOO_MANY_REQUESTS(429, "给定的时间内发送了太多的请求."),
REQUEST_HEADER_FIELDS_TOO_LARGE(431, "服务器不愿处理请求, 因为一个或多个头字段过大."),
LOGIN_TIMEOUT(440, "客户端session超时失效, 需要重新登录."),
UNAVAILABLE_FOR_LEGAL_REASONS(451, "该访问因法律的要求而被拒绝."),
INTERNAL_SERVER_ERROR(500, "服务器通用错误消息."),
NOT_IMPLEMENTED(501, "服务器不支持当前请求所需要的某个功能."),
BAD_GATEWAY(502, "作为网关或者代理工作的服务器尝试执行请求时, 从上游服务器接收到无效的响应."),
SERVICE_UNAVAILABLE(503, "由于临时的服务器维护或者过载, 服务器当前无法处理请求."),
GATEWAY_TIMEOUT(504, "作为网关或者代理工作的服务器尝试执行请求时, 未能及时从上游服务器收到响应."),
HTTP_VERSION_NOT_SUPPORTED(505, "服务器不支持, 或者拒绝支持在请求中使用的HTTP版本."),
VARIANT_ALSO_NEGOTIATES(506, "服务器存在内部配置错误."),
INSUFFICIENT_STORAGE(507, "服务器无法存储完成请求所必须的内容."),
LOOP_ERECTED(508, "服务器在处理请求时陷入死循环."),
NOT_EXTENDED(510, "获取资源所需要的策略并没有被满足."),
NETWORK_AUTHENTICATION_REQUIRED(511, "客户端需要进行身份验证才能获得网络访问权限.");
private final int code;
private final String desc;
ResponseStatusEnum(int code, String desc){
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@ -0,0 +1,16 @@
package site.cnkj.common.object;
import lombok.Data;
import java.io.Serializable;
/**
* Created by rx on 2018/9/17.
*/
@Data
public class BaseResult implements Serializable {
private int code;
private String desc;
}

View File

@ -1,87 +0,0 @@
package site.cnkj.common.object;
import java.util.HashMap;
/*
* @author LXW
* @create 2020/4/21 11:16
* @Description 异常原因枚举值
*/
public class ReasonEnumeration {
public static HashMap<String, String> reasonEnumeration = new HashMap<>();
public static final class CODE{
public static final class Header{
public static final String IMEI = "100001";
public static final String IMSI = "100002";
public static final String IDFA = "100003";
public static final String OAID = "100004";
public static final String HWID = "100005";
public static final String UID = "100006";
}
/**
* params
*/
public static final class Params{
public static final String contentId = "200001";
public static final String marketingId = "200002";
public static final String songListId = "200003";
public static final String songId = "200004";
public static final String songName = "200005";
public static final String contentIdRange = "200006";
public static final String rateLevelRange = "200007";
public static final String isOnlineRange = "200008";
public static final String beginTime = "200009";
public static final String logId = "200010";
public static final String videoIdMvIdConcertId = "200011";
public static final String rateLevel = "200012";
public static final String vmsParamsE = "200013";
public static final String vmsParamsERange = "200014";
public static final String codeRange = "200015";
public static final String requestTimeRange = "200016";
public static final String requestTime = "200017";
public static final String resourceTypeRange = "200018";
}
/**
* RequestParams
*/
public static final class RequestParams{}
/**
* ResponseBody
*/
public static final class ResponseBody{}
}
static {
reasonEnumeration.put(CODE.Header.IMEI, "IMEI的值不符合规范数据丢弃");
reasonEnumeration.put(CODE.Header.IMSI, "IMSI的值不符合规范数据丢弃");
reasonEnumeration.put(CODE.Header.IDFA, "IDFA的值长度不符合规范数据丢弃");
reasonEnumeration.put(CODE.Header.OAID, "OAID的值不符合规范数据丢弃");
reasonEnumeration.put(CODE.Header.HWID, "HWID的值不符合规范数据丢弃");
reasonEnumeration.put(CODE.Header.UID, "UID的值等于15586008224920247234882,UID被强制转换成空值");
reasonEnumeration.put(CODE.Params.contentId, "params.contentId字段不存在或值为空数据丢弃");
reasonEnumeration.put(CODE.Params.marketingId, "params.marketingId字段不存在数据丢弃");
reasonEnumeration.put(CODE.Params.songListId, "params.songListId字段不存在设置默认值为空值");
reasonEnumeration.put(CODE.Params.songId, "params.songId字段不存在设置默认值为空值");
reasonEnumeration.put(CODE.Params.songName, "params.songName字段不存在数据丢弃");
reasonEnumeration.put(CODE.Params.contentIdRange, "params.contentId字段值不在范围内数据丢弃");
reasonEnumeration.put(CODE.Params.rateLevel, "params.rateLevel字段不存在或值为空");
reasonEnumeration.put(CODE.Params.rateLevelRange, "params.rateLevel字段不在范围内");
reasonEnumeration.put(CODE.Params.isOnlineRange, "params.isOnline字段不存在或不在范围内params.isOnline设置默认值");
reasonEnumeration.put(CODE.Params.beginTime, "params.beginTime字段不存在或值为空数据丢弃");
reasonEnumeration.put(CODE.Params.logId, "params.logId字段不存在或值为空数据丢弃");
reasonEnumeration.put(CODE.Params.videoIdMvIdConcertId, "params中不存在videoId、mvId、concertId或对应的值为空数据丢弃");
reasonEnumeration.put(CODE.Params.vmsParamsE, "params.E字段参位值数量不正确");
reasonEnumeration.put(CODE.Params.vmsParamsERange, "params.E字段参位值不在范围内");
reasonEnumeration.put(CODE.Params.codeRange, "params.code字段不存在或值为空");
reasonEnumeration.put(CODE.Params.requestTimeRange, "params.requestTime字段不符合时间戳格式");
reasonEnumeration.put(CODE.Params.requestTime, "params.requestTime字段不存在或值为空");
reasonEnumeration.put(CODE.Params.resourceTypeRange, "params.resourceType字段值不在范围内");
}
}

View File

@ -1,4 +1,4 @@
package site.cnkj.common.object.redis;
package site.cnkj.common.object;
/*
* @version 1.0 created by LXW on 2019/1/9 16:17

View File

@ -0,0 +1,27 @@
package site.cnkj.common.object;
import lombok.Data;
import lombok.EqualsAndHashCode;
import site.cnkj.common.enumeration.ResponseStatusEnum;
/*
* @version 1.0 created by LXW on 2019/7/22 11:04
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ResponseDataResult<T> extends BaseResult {
private T data;
public ResponseDataResult(ResponseStatusEnum responseStatusEnum) {
this.setCode(responseStatusEnum.getCode());
this.setDesc(responseStatusEnum.getDesc());
}
public ResponseDataResult(T data) {
this.data = data;
}
public ResponseDataResult() {
}
}

View File

@ -1,14 +0,0 @@
package site.cnkj.common.object.servlet;
import lombok.Data;
/**
* Created by rx on 2018/9/17.
*/
@Data
public class BaseResult {
private String code;
private String desc;
}

View File

@ -1,45 +0,0 @@
package site.cnkj.common.object.servlet;
/*
* @version 1.0 created by LXW on 2019/3/12 14:17
*/
@Deprecated
public class CommonInfo {
/**
* @Desc ResponseCode for servlet request callback
* @Version delete from 0.3.5 version and replace by cn.migu.log.ResponseBodyCode
*/
@Deprecated
public static class ResponseCode{
public static final String SUCCESS = "000000";//成功
public static final String FAILED = "100000";//结果异常
public static final String WARNING = "200000";//警告
public static final String ERROR = "300000";//程序故障
public static final String TIMEOUT = "999999"; //登录过期
public class Desc{
public static final String SUCCESS = "SUCCESS";//成功
public static final String FAILED = "FAILED";//结果异常
public static final String WARNING = "WARNING";//警告
public static final String ERROR = "ERROR";//程序故障
public static final String NULL_URL = "请求URL不存在";
public static final String EXIST_ERROR = "该条目已存在";
public static final String NOT_EXIST_ERROR = "该条目不存在";
public static final String NOT_NUMERIC = "分隔符数量不是正整数";
public static final String OUT_RANGE_ERROR = "分隔符数量过长";
public static final String NOT_EQUAL_ERROR = "分隔符数量不一致";
public static final String NULL_PARAM = "必填字段不存在";
public static final String PARAM_ERROR = "字段值错误";
public static final String ITEM_REFERENCE = "该条目已被引用";
public static final String NOT_REFRESH_ITEM = "存在未刷新的条目";
public static final String OFFLINE_MACHINE = "机器已下线";
public static final String NOT_OFFLINE_ITEM = "该条目未下线";
public static final String RUNNING_REFRESH = "上次刷新未完成";
public static final String REFRESH_TIMEOUT = "刷新超时";
public static final String SCRIPT_ERROR = "请求脚本执行失败";
public static final String ERROR_CRON = "cron表达式错误";
}
}
}

View File

@ -1,18 +0,0 @@
package site.cnkj.common.object.servlet;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
/*
* @version 1.0 created by LXW on 2019/7/22 11:04
*/
@Data
public class DataResult extends BaseResult {
private Object data;
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}

View File

@ -1,37 +0,0 @@
package site.cnkj.common.object.servlet;
/*
* @author LXW
* @create 2021/2/8 15:04
* @Description
*/
public enum ResponseBodyCode {
SUCCESS{
@Override
public String getCode() {
return "000000";
}
},
FAILED{
@Override
public String getCode() {
return "100000";
}
},
WARNING{
@Override
public String getCode() {
return "200000";
}
},
ERROR{
@Override
public String getCode() {
return "300000";
}
};
public abstract String getCode();
}

View File

@ -0,0 +1,137 @@
package site.cnkj.common.utils.bean;
import org.springframework.util.ReflectionUtils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class ReflectionUtil extends ReflectionUtils {
/**
* 类上是否包含注解
*
* @date 2021-08-10 15:30:34
* @author liuzhengyang
* @param clazz 类Class
* @param aClazz 注解Class
* @return boolean
*/
public static boolean containsAnnotation(Class<?> clazz, Class<? extends Annotation> aClazz) {
Annotation[] annotations = clazz.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.annotationType() == aClazz) {
return true;
}
}
return false;
}
public static Type getGenericParameter(Class<?> clazz) {
while(clazz != null && !(clazz.getGenericSuperclass() instanceof ParameterizedType)) {
clazz = clazz.getSuperclass();
}
if (clazz != null) {
return ((ParameterizedType)clazz.getGenericSuperclass()).getActualTypeArguments()[0];
} else {
throw new IllegalArgumentException("Invalid argument, argument's super class must specify type parameters");
}
}
public static Class getSuperClassGenericType(final Class clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
for(Class superClass = clazz; !(genType instanceof ParameterizedType); genType = superClass.getGenericSuperclass()) {
if (superClass == Object.class) {
return Object.class;
}
superClass = superClass.getSuperclass();
}
Type[] params = ((ParameterizedType)genType).getActualTypeArguments();
if (index < params.length && index >= 0) {
if (!(params[index] instanceof Class) && params[index] instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType)params[index];
return (Class)pType.getRawType();
} else {
return (Class)params[index];
}
} else {
return Object.class;
}
}
public static Class getSuperClassGenericTypeCollectionGenType(final Class clazz, final int index, final int collectionGenindex) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
return Object.class;
} else {
Type[] params = ((ParameterizedType)genType).getActualTypeArguments();
if (index < params.length && index >= 0) {
if (!(params[index] instanceof Class) && params[index] instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType)params[index];
return (Class)pType.getActualTypeArguments()[collectionGenindex];
} else {
return (Class)params[index];
}
} else {
return Object.class;
}
}
}
public static Object newInstance(final Class clazz, final int index) {
try {
return getSuperClassGenericType(clazz, index).newInstance();
} catch (IllegalAccessException | InstantiationException var3) {
var3.printStackTrace();
}
return null;
}
public static List<Field> getAllField(Object obj) {
List<Field> fieldList = new ArrayList();
for(Class tempClass = obj.getClass(); tempClass != null; tempClass = tempClass.getSuperclass()) {
fieldList.addAll(Arrays.asList(tempClass.getDeclaredFields()));
}
return fieldList;
}
public static List<Field> getAllFieldByClazz(Class clazz) {
List<Field> fieldList = new ArrayList();
for(Class tempClass = clazz; tempClass != null; tempClass = tempClass.getSuperclass()) {
fieldList.addAll(Arrays.asList(tempClass.getDeclaredFields()));
}
return fieldList;
}
public static Field findFieldForAll(Object obj, String name) {
List<Field> fieldList = getAllField(obj);
Iterator var3 = fieldList.iterator();
Field f;
do {
if (!var3.hasNext()) {
return null;
}
f = (Field)var3.next();
} while(!f.getName().equals(name));
return f;
}
public static Object getFieldValueForAll(Object obj, String name) {
Field f = findFieldForAll(obj, name);
f.setAccessible(true);
try {
return f.get(obj);
} catch (Exception var4) {
var4.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,167 @@
package site.cnkj.common.utils.data;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.StringJoiner;
public class GlobalId {
private static final Logger log = LoggerFactory.getLogger(GlobalId.class);
private long twepoch = 1420041600000L;
private static long workerIdBits = 5L;
private static long datacenterIdBits = 5L;
private static long maxWorkerId;
private static long maxDatacenterId;
private long sequenceBits = 12L;
private long workerIdShift;
private long datacenterIdShift;
private long timestampLeftShift;
private long sequenceMask;
private long workerId;
private long datacenterId;
private long sequence;
private long lastTimestamp;
private static GlobalId defaultGlobalId;
public GlobalId() {
this.workerIdShift = this.sequenceBits;
this.sequenceMask = ~(-1L << (int)this.sequenceBits);
this.sequence = 0L;
this.lastTimestamp = -1L;
this.workerId = 0L;
this.datacenterId = 0L;
this.build();
}
public static long getDatacenterIdByIp(String ipAddr) {
byte[] mac = (ipAddr + UUIDUtil.longUuid()).getBytes();
long id = (255L & (long)mac[mac.length - 2] | 65280L & (long)mac[mac.length - 1] << 8) >> 6;
id %= maxDatacenterId + 1L;
return id;
}
public static long getDatacenterIdByIp() {
return getDatacenterIdByIp(getIpAddress());
}
public static String getIpAddress() {
String ipAddr = "0.0.0.0";
try {
InetAddress ip = InetAddress.getLocalHost();
ipAddr = ip.getHostAddress();
} catch (Exception var2) {
log.warn("获取ip错误");
}
return ipAddr;
}
public static long getMaxWorkerId(long datacenterId) {
StringBuilder mpid = new StringBuilder();
mpid.append(datacenterId);
String mac = getMac();
mpid.append(StringUtils.isEmpty(mac) ? UUIDUtil.longUuid() : mac);
mpid.append(UUIDUtil.longUuid());
return (long)(mpid.toString().hashCode() & '\uffff') % (maxWorkerId + 1L);
}
public static String getMac() {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
if (network == null) {
return "";
}
byte[] mac = network.getHardwareAddress();
if (null != mac) {
StringJoiner j = new StringJoiner("-");
for(int i = 0; i < mac.length; ++i) {
j.add(String.format("%02X", mac[i]));
}
return j.toString();
}
} catch (Exception var5) {
log.warn(" get Mac: " + var5.getMessage());
}
return "";
}
public GlobalId(long workerId, long datacenterId) {
this.workerIdShift = this.sequenceBits;
this.sequenceMask = ~(-1L << (int)this.sequenceBits);
this.sequence = 0L;
this.lastTimestamp = -1L;
this.build();
if (workerId <= maxWorkerId && workerId >= 0L) {
if (datacenterId <= maxDatacenterId && datacenterId >= 0L) {
this.workerId = workerId;
this.datacenterId = datacenterId;
} else {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
} else {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
}
private void build() {
this.datacenterIdShift = this.sequenceBits + workerIdBits;
this.timestampLeftShift = this.sequenceBits + workerIdBits + datacenterIdBits;
}
public synchronized long nextId() {
long timestamp = this.timeGen();
if (timestamp < this.lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", this.lastTimestamp - timestamp));
} else {
if (this.lastTimestamp == timestamp) {
this.sequence = this.sequence + 1L & this.sequenceMask;
if (this.sequence == 0L) {
timestamp = this.tilNextMillis(this.lastTimestamp);
}
} else {
this.sequence = 0L;
}
this.lastTimestamp = timestamp;
return timestamp - this.twepoch << (int)this.timestampLeftShift | this.datacenterId << (int)this.datacenterIdShift | this.workerId << (int)this.workerIdShift | this.sequence;
}
}
protected long tilNextMillis(long lastTimestamp) {
long timestamp;
for(timestamp = this.timeGen(); timestamp <= lastTimestamp; timestamp = this.timeGen()) {
}
return timestamp;
}
protected long timeGen() {
return System.currentTimeMillis();
}
public static GlobalId initialDefault(long datacenterId, long workerId) {
defaultGlobalId = new GlobalId(workerId, datacenterId);
return defaultGlobalId;
}
public static long generateNextId() {
return defaultGlobalId.nextId();
}
static {
maxWorkerId = ~(-1L << (int)workerIdBits);
maxDatacenterId = ~(-1L << (int)datacenterIdBits);
defaultGlobalId = new GlobalId(getMaxWorkerId(getDatacenterIdByIp()), getDatacenterIdByIp());
}
}

View File

@ -1,13 +1,26 @@
package site.cnkj.common.utils.data;
import com.alibaba.fastjson.JSONObject;
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.PartitionInfo;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.errors.AuthorizationException;
import org.apache.kafka.common.errors.IllegalSaslStateException;
import org.apache.kafka.common.errors.OutOfOrderSequenceException;
import org.apache.kafka.common.errors.ProducerFencedException;
import site.cnkj.common.utils.http.HttpCommonUtil;
import site.cnkj.common.utils.logger.LoggerUtil;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.stream.Collectors;
/*
* @version 1.0 created by LXW on 2019/11/20 10:20
@ -20,6 +33,52 @@ public class KafkaUtil {
private static final String VALUE_DESERIALIZER = "value.deserializer";
private static final String STRING_DESERIALIZER = "org.apache.kafka.common.serialization.StringDeserializer";
public static boolean producer(Map<String, Object> properties, Object source, String... topics){
KafkaProducer<Object, Object> producer = new KafkaProducer<>(properties);
try {
producer.beginTransaction();
for (String topic : topics) {
ProducerRecord record = new ProducerRecord(topic, source);
producer.send(record);
}
producer.commitTransaction();
} catch (ProducerFencedException | OutOfOrderSequenceException | AuthorizationException e) {
// We can't recover from these exceptions, so our only option is to close the producer and exit.
producer.close();
} catch (KafkaException e) {
// For all other exceptions, just abort the transaction and try again.
producer.abortTransaction();
}
producer.close();
return true;
}
public static void consumer(Map<String, Object> properties, Map<String, ? extends Queue<Object>> sources, long timeout, String... topics) {
List<String> collect = Arrays.stream(topics).collect(Collectors.toList());
for (String topic : collect) {
if (!sources.containsKey(topic)){
throw new NullPointerException("current topic is not exists.topic is: " + topic);
}
}
//构建消费者客户端
KafkaConsumer<String, Object> consumer = new KafkaConsumer<>(properties);
//填充消费监听topic
consumer.subscribe(collect);
while (true){
//消费数据
ConsumerRecords<String, Object> records = consumer.poll(Duration.ofMillis(timeout));
//数据放入队列中
for (ConsumerRecord<String, Object> record : records) {
String topic = record.topic();
Object value = record.value();
boolean offer = sources.get(topic).offer(value);
if (Boolean.FALSE.equals(offer)){
throw new IllegalSaslStateException("current queue size is max.");
}
}
}
}
/**
* 获取当前topic下的全部分区的偏移量信息

View File

@ -1,15 +1,10 @@
package site.cnkj.common.utils.data;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoClientURI;
import com.mongodb.client.MongoDatabase;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
/*
@ -17,18 +12,8 @@ import java.util.HashMap;
* @create 2020/8/17 9:50
* @Description
*/
@Component
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
@Configuration
@ConfigurationProperties(prefix = "spring.data.mongodb")
public class MongoClientsInit {
private HashMap<String, String> uri = new HashMap<>();
public void setUri(HashMap<String, String> uri) {
this.uri = uri;
}
private HashMap<String, MongoDatabase> mongoClientDatabases = new HashMap<>();
public HashMap<String, MongoDatabase> getMongoClientDatabases() {
@ -48,17 +33,24 @@ public class MongoClientsInit {
return databaseName;
}
public MongoClientsInit(HashMap<String, String> uri, MongoClientOptions.Builder mongoClientBuilder){
try {
init(uri, mongoClientBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
@PostConstruct
public void init() throws Exception{
private void init(HashMap<String, String> uri, MongoClientOptions.Builder mongoClientBuilder) throws Exception{
if (uri.size() > 0){
for (String name : uri.keySet()) {
String url = uri.get(name);
MongoClient mongoClient = MongoClients.create(url);
//支持ssl连接
MongoClient mongoClient = new MongoClient(new MongoClientURI(url, mongoClientBuilder));
MongoDatabase mongoClientDatabase = mongoClient.getDatabase(getDatabase(url));
mongoClientDatabases.put(name, mongoClientDatabase);
}
}
}
}
}

View File

@ -1,636 +0,0 @@
package site.cnkj.common.utils.data;
import com.mongodb.client.ClientSession;
import com.mongodb.client.result.UpdateResult;
import org.apache.commons.lang.StringUtils;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import java.util.Collection;
import java.util.List;
/*
* @version 1.0 created by LXW on 2019/11/22 17:21
*/
public class MongodbUtil {
private MongoTemplate mongoTemplate;
private final String mongoName;
public MongodbUtil(MongoTemplate mongoTemplate, String mongoName){
this.mongoTemplate = mongoTemplate;
this.mongoName = mongoName;
}
public Class save(Class document){
try {
String collectionName = mongoTemplate.getCollectionName(document);
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
return mongoTemplate.save(document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public Class save(Class c, String collectionName){
try {
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
return mongoTemplate.save(c, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> Collection<T> insert(Collection<? extends T> batchToSave, String collectionName){
try {
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
return mongoTemplate.insert(batchToSave, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 删除指定名称下执行值的数据
* @param key 名字
* @param value
* @param document 文档对象
* @return 成功删除的文档数量
*/
public <T> Long removeByQuery(String key, String value, Class<T> document){
try {
Query query = Query.query(Criteria.where(key).is(value));
return mongoTemplate.remove(query, document).getDeletedCount();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 删除指定名称下执行值的数据
* @param key 名字
* @param value
* @param collectionName 集合名称
* @return 成功删除的文档数量
*/
public Long removeByQuery(String key, String value, String collectionName){
try {
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(key).is(value));
return mongoTemplate.remove(query, collectionName).getDeletedCount();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 通过对象删除文档
* @param document 对象
*/
public <T> void dropCollection(Class<T> document){
try {
mongoTemplate.dropCollection(document);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 通过集合名删除文档
* @param collectionName 集合名
*/
public void dropCollection(String collectionName){
try {
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
mongoTemplate.dropCollection(collectionName);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 删除当前数据库
*/
public void dropDataBase(){
try {
mongoTemplate.getDb().drop();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 删除当前数据库
*/
public void dropDataBase(ClientSession clientSession){
try {
mongoTemplate.getDb().drop(clientSession);
} catch (Exception e) {
e.printStackTrace();
}
}
public <T> T findAndRemoveByQuery(String key, String value, Class<T> document){
return findAndRemoveByQuery(key, value, document, mongoTemplate.getCollectionName(document));
}
/**
* 查询出符合条件的第一个结果并将符合条件的数据删除,只会删除第一条
* @param key 索引
* @param value
* @param document 文档
* @param collectionName 集合名
* @return 返回删除的记录
*/
public <T> T findAndRemoveByQuery(String key, String value, Class<T> document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(key).is(value));
return mongoTemplate.findAndRemove(query, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> List<T> findAllAndRemoveByQuery(String key, String value, Class<T> document){
return findAllAndRemoveByQuery(key, value, document, mongoTemplate.getCollectionName(document));
}
/**
* 查询出符合条件的所有结果并将符合条件的所有数据删除
* @param key 索引
* @param value
* @param document 文档
* @param collectionName 集合名
* @return 返回删除的记录
*/
public <T> List<T> findAllAndRemoveByQuery(String key, String value, Class<T> document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(key).is(value));
return mongoTemplate.findAllAndRemove(query, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult updateFirstByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document){
return updateFirstByQuery(findKey, findValue, updateKey, updateValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 修改查询到的结果中的第一条记录
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult updateFirstByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue);
return mongoTemplate.updateFirst(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult updateAllByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document){
return updateAllByQuery(findKey, findValue, updateKey, updateValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 更新查询到的全部结果
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult updateAllByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult updateOrInsertByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document){
return updateOrInsertByQuery(findKey, findValue, updateKey, updateValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 特殊更新更新数据如果没有数据则以此条件创建一条新的数据
* 当没有符合条件的文档就以这个条件和更新文档为基础创建一个新的文档如果找到匹配的文档就正常的更新
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult updateOrInsertByQuery(String findKey, String findValue, String updateKey, String updateValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue);
return mongoTemplate.upsert(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult setByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Object setValue, Class document){
return setByQuery(findKey, findValue, updateKey, updateValue, setKey, setValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 更新指定内容的数据如果更新的setKey不存在则创建一个新的key
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param setKey 设置key
* @param setValue 设置value
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult setByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Object setValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue).set(setKey, setValue);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult incByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Number setValue, Class document){
return incByQuery(findKey, findValue, updateKey, updateValue, setKey, setValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 累加单条数据中的指定setKey的值
* inc方法用于做累加操作将setKey的值在之前的基础上加上setValue
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param setKey 设置key
* @param setValue 增长的值
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult incByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Number setValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue).inc(setKey, setValue);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult renameByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, String setValue, Class document){
return renameByQuery(findKey, findValue, updateKey, updateValue, setKey, setValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 修改单条数据中的setKey的名称
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param setKey 修改前的名字
* @param setValue 修改后的名字
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult renameByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, String setValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue).rename(setKey, setValue);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult unsetByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Class document){
return unsetByQuery(findKey, findValue, updateKey, updateValue, setKey, document, mongoTemplate.getCollectionName(document));
}
/**
* 删除指定内容数据中的key
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param setKey 需要删除的key
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult unsetByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue).unset(setKey);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public UpdateResult pullByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, String setValue, Class document){
return pullByQuery(findKey, findValue, updateKey, updateValue, setKey, setValue, document, mongoTemplate.getCollectionName(document));
}
/**
* update的pull方法用于删除数组中的值
*
* @param findKey 查询key
* @param findValue 查询value
* @param updateKey 更新key
* @param updateValue 更新value
* @param setKey 数组名
* @param setValue 删除的值
* @param document 文档对象
* @param collectionName 集合名称
* @return 更新结果
*/
public UpdateResult pullByQuery(String findKey, String findValue, String updateKey, String updateValue, String setKey, String setValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
Update update = Update.update(updateKey, updateValue).pull(setKey, setValue);
return mongoTemplate.updateMulti(query, update, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> List<T> findByQuery(String findKey, String findValue, Class<T> document){
return findByQuery(findKey, findValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 查询符合条件的数据集合
*
* @param findKey
* @param findValue
* @param document
* @param collectionName
* @param <T>
* @return
*/
public <T> List<T> findByQuery(String findKey, String findValue, Class<T> document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
return mongoTemplate.find(query, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> T findOneByQuery(String findKey, String findValue, Class<T> document){
return findOneByQuery(findKey, findValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 查询符合条件的一条数据
*
* @param findKey
* @param findValue
* @param document
* @param collectionName
* @param <T>
* @return
*/
public <T> T findOneByQuery(String findKey, String findValue, Class<T> document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
return mongoTemplate.findOne(query, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> List<T> findAll(Class<T> document){
return findAll(document, mongoTemplate.getCollectionName(document));
}
/**
* 查询符合条件的一条数据
*
* @param document
* @param collectionName
* @param <T>
* @return
*/
public <T> List<T> findAll(Class<T> document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
return mongoTemplate.findAll(document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public Long countByQuery(String findKey, String findValue, Class document){
return countByQuery(findKey, findValue, document, mongoTemplate.getCollectionName(document));
}
/**
* 统计符合查询条件的数据数量
*
* @param findKey
* @param findValue
* @param document
* @param collectionName
* @return
*/
public Long countByQuery(String findKey, String findValue, Class document, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
return mongoTemplate.count(query, document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public Long countByQuery(String findKey, String findValue, String collectionName){
try {
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
Query query = Query.query(Criteria.where(findKey).is(findValue));
return mongoTemplate.count(query, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> T findById(Class<T> document, String id){
return findById(document, id, mongoTemplate.getCollectionName(document));
}
/**
* 通过主键id进行查询
*
* @param document
* @param id
* @param collectionName
* @param <T>
* @return
*/
public <T> T findById(Class<T> document, String id, String collectionName){
try {
if (StringUtils.isEmpty(collectionName)){
collectionName = mongoTemplate.getCollectionName(document);
}
if (StringUtils.isNotEmpty(mongoName)){
collectionName = mongoName + ":" + collectionName;
}
return mongoTemplate.findById(new ObjectId(id), document, collectionName);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -3,6 +3,7 @@ package site.cnkj.common.utils.data;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
@ -13,9 +14,9 @@ import java.util.concurrent.TimeUnit;
public class RedisUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(RedisUtil.class);
private RedisTemplate<String, Object> redisTemplate;
private final RedisTemplate<String, Object> redisTemplate;
private String redisName;
private final String redisName;
public RedisUtil(RedisTemplate<String, Object> redisTemplate, String redisName) {
this.redisTemplate = redisTemplate;
@ -24,15 +25,18 @@ public class RedisUtil {
/**
* 获取链接的redis的信息等于Command <info>
* @return
* @return .
*/
public Properties info(){
try {
return redisTemplate.getConnectionFactory().getConnection().info();
RedisConnectionFactory connectionFactory = redisTemplate.getConnectionFactory();
if (null != connectionFactory){
return connectionFactory.getConnection().info();
}
}catch (Exception e){
e.printStackTrace();
}
return null;
return new Properties();
}

View File

@ -0,0 +1,64 @@
package site.cnkj.common.utils.data;
import org.apache.commons.codec.binary.Base64;
public class UUIDUtil {
public UUIDUtil() {
}
public static String longUuid() {
java.util.UUID uuid = java.util.UUID.randomUUID();
return uuid.toString().replace("-", "");
}
public static String shortUuid() {
java.util.UUID uuid = java.util.UUID.randomUUID();
return compressedUUID(uuid);
}
private static String compressedUUID(java.util.UUID uuid) {
byte[] byUuid = new byte[16];
long least = uuid.getLeastSignificantBits();
long most = uuid.getMostSignificantBits();
long2bytes(most, byUuid, 0);
long2bytes(least, byUuid, 8);
String compressUUID = Base64.encodeBase64URLSafeString(byUuid);
return compressUUID;
}
private static void long2bytes(long value, byte[] bytes, int offset) {
for(int i = 7; i > -1; --i) {
bytes[offset++] = (byte)((int)(value >> 8 * i & 255L));
}
}
public static String longUuid2short(String longUuid) {
java.util.UUID uuid = java.util.UUID.fromString(longUuid);
return compressedUUID(uuid);
}
public static String shortUuid2long(String shortUuid) {
if (shortUuid.length() != 22) {
throw new IllegalArgumentException("Invalid uuid!");
} else {
byte[] byUuid = Base64.decodeBase64(shortUuid + "==");
long most = bytes2long(byUuid, 0);
long least = bytes2long(byUuid, 8);
java.util.UUID uuid = new java.util.UUID(most, least);
return uuid.toString();
}
}
private static long bytes2long(byte[] bytes, int offset) {
long value = 0L;
for(int i = 7; i > -1; --i) {
value |= (long)((bytes[offset++] & 255) << 8 * i);
}
return value;
}
}

View File

@ -1,89 +1,72 @@
package site.cnkj.common.utils.date;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
/*
* @version 1.0 created by LXW on 2018/11/8 16:11
/**
* 日期工具类
*
* @author Liu XueWen, 2021/12/13
*/
public class DateUtil {
public static class FORMAT{
//基本单位
public static final String BASETIME_yyyy = "yyyy";
//基本单位
public static final String BASETIME_MM = "MM";
//基本单位
public static final String BASETIME_dd = "dd";
//基本单位
public static final String BASETIME_HH = "HH";
//基本单位
public static final String BASETIME_mm = "mm";
//基本单位
public static final String BASETIME_ss = "ss";
//基本单位 毫秒
public static final String BASETIME_SSS = "SSS";
//--
public static final String FULLTIMEBY_yMd = "yyyy-MM-dd";
//--
public static final String FULLTIMEBY_yMdH = "yyyy-MM-dd HH";
//-- :
public static final String FULLTIMEBY_yMdHm = "yyyy-MM-dd HH:mm";
//-
public static final String FULLTIMEBY_yM = "yyyy-MM";
//-
public static final String FULLTIMEBY_Md = "MM-dd";
//::
public static final String FULLTIMEBY_Hms = "HH:mm:ss";
//:
public static final String FULLTIMEBY_Hm = "HH:mm";
//:
public static final String FULLTIMEBY_ms = "mm:ss";
//::.毫秒
public static final String FULLTIMEBY_HmsS = "HH:mm:ss.SSS";
//年月 无分割
public static final String NOSEGMENTATION_yM = "yyyyMM";
//年月日 无分割
public static final String NOSEGMENTATION_yMd = "yyyyMMdd";
//时分 无分割
public static final String NOSEGMENTATION_Hm = "HHmm";
//时分秒 无分割
public static final String NOSEGMENTATION_Hms = "HHmmss";
//时分秒毫秒 无分割
public static final String NOSEGMENTATION_HmsS = "HHmmssSSS";
//年月日时分 无分割
public static final String NOSEGMENTATION_yMdHm = "yyyyMMddHHmm";
//年月日时分秒 无分割
public static final String NOSEGMENTATION_yMdHms = "yyyyMMddHHmmss";
//年月日时分秒毫秒 无分割
public static final String NOSEGMENTATION_yMdHmsS = "yyyyMMddHHmmssSSS";
//年月日 点分割
public static final String POINT_yMd = "yyyy.MM.dd";
//时分秒 点分割
public static final String POINT_Hms = "HH.mm.ss";
//-- ::
public static final String FULLTIMEBY_yMdHms = "yyyy-MM-dd HH:mm:ss";
//-- ::.毫秒
public static final String FULLTIMEBY_yMdHmsS = "yyyy-MM-dd HH:mm:ss.SSS";
//格式化 --
public static final String FULLTIMEFORMAT_yMd = "yyyy年MM月dd日";
//格式化 ::
public static final String FULLTIMEFORMAT_Hms = "HH时mm分ss秒";
//格式化 -- ::
public static final String FULLTIMEFORMAT_yMdHms = "yyyy年MM月dd日 HH时mm分ss秒";
//格式化 -- ::.毫秒
public static final String FULLTIMEFORMAT_yMdHmsS = "yyyy年MM月dd日 HH时mm分ss秒SSS毫秒";
/**
* 日期格式枚举值
*/
@Getter
@AllArgsConstructor
public enum FORMAT{
BASE_TIME_YEAR("yyyy"),
BASE_TIME_MONTH("MM"),
BASE_TIME_DAY("dd"),
BASE_TIME_HH("HH"),
BASE_TIME_MINUTES("mm"),
BASE_TIME_SECONDS("ss"),
BASE_TIME_MILLIONS_SECONDS("SSS"),
FULL_TIME_YMD("yyyy-MM-dd"),
FULL_TIME_YMD_H("yyyy-MM-dd HH"),
FULL_TIME_YMD_HM("yyyy-MM-dd HH:mm"),
FULL_TIME_YMD_HMS("yyyy-MM-dd HH:mm:ss"),
FULL_TIME_YMD_HMS_S("yyyy-MM-dd HH:mm:ss.SSS"),
FULL_TIME_YM("yyyy-MM"),
FULL_TIME_MD("MM-dd"),
FULL_TIME_HMS("HH:mm:ss"),
FULL_TIME_HM("HH:mm"),
FULL_TIME_MS("mm:ss"),
FULL_TIME_HMS_S("HH:mm:ss.SSS"),
NO_SEGMENTATION_YM("yyyyMM"),
NO_SEGMENTATION_YMD("yyyyMMdd"),
NO_SEGMENTATION_HM("HHmm"),
NO_SEGMENTATION_HMS("HHmmss"),
NO_SEGMENTATION_HMS_S("HHmmssSSS"),
NO_SEGMENTATION_YMD_HM("yyyyMMddHHmm"),
NO_SEGMENTATION_YMD_HMS("yyyyMMddHHmmss"),
NO_SEGMENTATION_YMD_HMS_S("yyyyMMddHHmmssSSS"),
POINT_YMD("yyyy.MM.dd"),
POINT_HMS("HH.mm.ss"),
FULL_TIME_FORMAT_YMD("yyyy年MM月dd日"),
FULL_TIME_FORMAT_HMS("HH时mm分ss秒"),
FULL_TIME_FORMAT_YMD_HMS("yyyy年MM月dd日 HH时mm分ss秒"),
FULL_TIME_FORMAT_YMD_HMS_S("yyyy年MM月dd日 HH时mm分ss秒SSS毫秒");
private final String value;
}
/**
* 日期字符串转日期格式
* @param date 日期字符串
* @param timeFormat 转换后的日期格式
* @return
* @return date
*/
public static Date dateStringToDate(String date, String timeFormat){
try {
@ -97,8 +80,14 @@ public class DateUtil {
return null;
}
public static String timeStamp2fulltime(Date date){
SimpleDateFormat sdf = new SimpleDateFormat(FORMAT.FULLTIMEBY_yMdHms);
/**
* 按照yyyy-MM-dd HH:mm:ss 格式格式化日期对象
*
* @param date 日期对象
* @return 日期字符串
*/
public static String dateToString(Date date){
SimpleDateFormat sdf = new SimpleDateFormat(FORMAT.FULL_TIME_YMD_HMS.getValue());
return sdf.format(date);
}
@ -110,10 +99,14 @@ public class DateUtil {
* @return 零点时间戳(0:0:0)
*/
public static long getTodayEarlyMorning(String time, String timeFormat){
long current=translateDateToTimestamp(time, timeFormat);//当前时间毫秒数
long zero=current/(1000*3600*24)*(1000*3600*24)-TimeZone.getDefault().getRawOffset();//前一天的零点零分零秒的毫秒数
long startTime = zero + 24*60*60*1000;
return startTime;
//当前时间毫秒数
Long current = translateDateToTimestamp(time, timeFormat);
if (null != current){
//前一天的零点零分零秒的毫秒数
long zero=current/(1000*3600*24)*(1000*3600*24)-TimeZone.getDefault().getRawOffset();
return zero + 24*60*60*1000;
}
return 0L;
}
@ -125,10 +118,14 @@ public class DateUtil {
* @return 当天24点的时间戳(23:59:59)
*/
public static long getTodayLaterMorning(String time, String timeFormat){
long current=translateDateToTimestamp(time, timeFormat);//当前时间毫秒数
long zero=current/(1000*3600*24)*(1000*3600*24)-TimeZone.getDefault().getRawOffset();//前一天的零点零分零秒的毫秒数
long endTime = zero + 24*60*60*1000*2 - 1;
return endTime;
//当前时间毫秒数
Long current=translateDateToTimestamp(time, timeFormat);
if (null != current){
//前一天的零点零分零秒的毫秒数
long zero=current/(1000*3600*24)*(1000*3600*24)-TimeZone.getDefault().getRawOffset();
return zero + 24*60*60*1000*2 - 1;
}
return 0L;
}
@ -139,13 +136,14 @@ public class DateUtil {
*/
public static long getLastDaysTimestamp(int maxDays){
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
long time = calendar.getTime().getTime();
return time - 24*60*60*1000*(maxDays);
return time - 24L * 60 * 60 * 1000 * maxDays;
}
/**
@ -153,36 +151,51 @@ public class DateUtil {
* @param pastTime 指定的时间数量 5
* @param type 时间的类型 d日 H时 m分 s秒 S毫秒 不写默认单位秒
* @param timeFormat 转换后的时间戳格式化的标准 不写默认格式 -- ::
* @return
* @return 过去指定时间的时间戳
*/
public static String getThePastTime(int pastTime, String type, String timeFormat){
public static String getThePastTime(long pastTime, String type, String timeFormat){
if (type == null){
type = "s";
}
if (timeFormat == null){
timeFormat = FORMAT.FULLTIMEBY_yMdHmsS;
timeFormat = FORMAT.FULL_TIME_YMD_HMS_S.getValue();
}
long date = System.currentTimeMillis();
Long now_time = new Long(1);
long nowTime = 1L;
if ("S".equals(type)){
now_time = date - pastTime;
nowTime = date - pastTime;
}else if ("s".equals(type)){
now_time = date - pastTime*1000;
nowTime = date - pastTime* 1000L;
}else if ("m".equals(type)){
now_time = date - pastTime*1000*60;
nowTime = date - pastTime *1000*60;
}else if ("H".equals(type)){
now_time = date - pastTime*1000*60*60;
nowTime = date - pastTime *1000*60*60;
}else if ("d".equals(type)){
now_time = date - pastTime*1000*60*60*24;
nowTime = date - pastTime *1000*60*60*24;
}
String finalTime = translateTimeToDate(now_time, timeFormat);
return finalTime;
return translateTimeToDate(nowTime, timeFormat);
}
/**
* 获取过去指定时间的时间戳
* 默认日期格式: com.acca.opra.mch.utils.DateUtils.FORMAT.FULL_TIME_YMD_HMS_S
* 默认日期级别: s
*
* @param pastTime 指定的时间数量 5
* @return 过去指定时间的时间戳
*/
public static String getThePastTime(int pastTime){
return getThePastTime(pastTime, null, null);
}
/**
* 获取过去指定时间的时间戳
* 默认日期格式: com.acca.opra.mch.utils.DateUtils.FORMAT.FULL_TIME_YMD_HMS_S
*
* @param pastTime 指定的时间数量 5
* @param type 时间的类型 d日 H时 m分 s秒 S毫秒 不写默认单位秒
* @return 过去指定时间的时间戳
*/
public static String getThePastTime(int pastTime, String type){
return getThePastTime(pastTime, type, null);
}
@ -195,15 +208,17 @@ public class DateUtil {
return System.currentTimeMillis();
}
/**
* 获取指定格式的当前时间
* @return 时间
*
* @param timeFormat 日期格式
* @return 当前时间
*/
public static String getNowTimeByFormat(String timeFormat){
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat);
String today = simpleDateFormat.format(date);
return today;
return simpleDateFormat.format(date);
}
/**
@ -214,8 +229,7 @@ public class DateUtil {
*/
public static String translateTimeToDate(Long timestamp, String timeFormat){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat);
String da = simpleDateFormat.format(timestamp);
return da;
return simpleDateFormat.format(timestamp);
}
/**
@ -226,8 +240,7 @@ public class DateUtil {
*/
public static String translateDateToString(Date date, String timeFormat){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat);
String da = simpleDateFormat.format(date);
return da;
return simpleDateFormat.format(date);
}
/**
@ -251,7 +264,7 @@ public class DateUtil {
* 13位时间戳转date格式
* @param timestamp 时间戳
* @param timeFormat 时间格式
* @return
* @return .
*/
public static Date translateTimestampToDate(Long timestamp, String timeFormat){
try {
@ -277,10 +290,11 @@ public class DateUtil {
Date date = null;
try {
date = simpleDateFormat.parse(time);
return date.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
return date.getTime();
return null;
}
@ -288,16 +302,15 @@ public class DateUtil {
* 序列化字符串为时间格式
* @param time 需要转换的字符串 (20181011 10:11:12.013)
* @param timeFormat 字符串对应的时间格式 (yyyyMMdd HH:mm:ss.SSS)
* @param timeTranselate 转换后需要的字符串格式 (yyyy年M月dd日 HH时mm分ss秒SSS毫秒)
* @param timeTranslate 转换后需要的字符串格式 (yyyy年M月dd日 HH时mm分ss秒SSS毫秒)
* @return 2018年10月11日 10时11分12秒13毫秒
*/
public static String serializationDate(String time, String timeFormat, String timeTranselate){
public static String serializationDate(String time, String timeFormat, String timeTranslate){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat);
try {
Date date = simpleDateFormat.parse(time);
SimpleDateFormat dateFormat = new SimpleDateFormat(timeTranselate);
String formatTime = dateFormat.format(date);
return formatTime;
SimpleDateFormat dateFormat = new SimpleDateFormat(timeTranslate);
return dateFormat.format(date);
} catch (ParseException e) {
e.printStackTrace();
}
@ -312,51 +325,20 @@ public class DateUtil {
* @param timeTranslate 输出格式
* @return 日期集合
*/
public static List getDesignationDay(int num, String time, String timeFormat, String timeTranslate){
List days = new ArrayList();
Long timestamp_time = translateDateToTimestamp(time, timeFormat);
for (int i = 0; i < num; i++) {
Long new_time = timestamp_time - i*24*60*60*1000;
String today = translateTimeToDate(new_time, timeTranslate);
days.add(today);
public static List<String> getDesignationDay(int num, String time, String timeFormat, String timeTranslate){
List<String> days = new ArrayList<>();
Long timestampTime = translateDateToTimestamp(time, timeFormat);
if (null != timestampTime){
for (int i = 0; i < num; i++) {
long newTime = timestampTime - (long) i *24*60*60*1000;
String today = translateTimeToDate(newTime, timeTranslate);
days.add(today);
}
}
return days;
}
/**
* 时间切割机小时切割
*
* @param cutTime 切割小时数 2小时 = 2
* @param startTime 开始时间戳 10位
* @param endTime 结束时间戳 10位
* @return 切割后时间段列表
*/
public static List<String> splitTimestamp(int cutTime, long startTime, long endTime) {
List<String> timeList = new ArrayList<>();
startTime = startTime * 1000;
endTime = endTime * 1000;
if (cutTime <= 0){
timeList.add(String.valueOf(String.valueOf(startTime).concat(",").concat(String.valueOf(endTime))));
}else if (cutTime > 0 && endTime > startTime){
long cut = ((endTime - startTime) / 3600000 /cutTime) + ((endTime - startTime) / 3600000 % cutTime);
long timeInterval = (endTime - startTime) / cut;
while(true){
if (startTime < endTime){
if ((startTime + timeInterval) > endTime){
timeList.add(String.valueOf(String.valueOf(startTime).concat(",").concat(String.valueOf(endTime))));
}else {
timeList.add(String.valueOf( String.valueOf(startTime).concat(",").concat(String.valueOf(startTime + timeInterval))));
}
}else if (startTime >= endTime){
break;
}
startTime = startTime + timeInterval;
}
}
return timeList;
}
/**
* 当前时间与周期时间的时间差
* 最大支持3600秒
@ -365,58 +347,17 @@ public class DateUtil {
* @param executorTime 执行周期
* @return 等待秒
*/
public static long waitingTimeBySeconds(int executorTime){
public static long waitingTimeBySeconds(long executorTime){
if (executorTime <= 3600 && executorTime >=0){
//获取当前时间与周期时间的差
long nowTime = System.currentTimeMillis();
int timeDiscrepancy = Integer.parseInt(String.valueOf(nowTime%(executorTime*1000)/1000));
long timeDiscrepancy = Integer.parseInt(String.valueOf(nowTime%(executorTime*1000)/1000));
return executorTime-timeDiscrepancy;
}else {
return 0;
}
}
/**
* 等待开始周期执行的时间
* 最大限制24h
* 单位 小时
*
* @param executorTime 周期
* @return 等待秒
*/
public static long waitingTimeByHours(int executorTime){
long delayTime = 0;
if (executorTime <= 24 && executorTime>0){
int num = 24 / executorTime;
long tomorrowEarlyMorning = getTodayEarlyMorning(translateTimeToDate(getCurrentTime(), FORMAT.FULLTIMEBY_yMdHmsS), FORMAT.FULLTIMEBY_yMdHmsS);
long todayEarlyMorning = tomorrowEarlyMorning - 24*60*60*1000;
long todayHour = num * executorTime * 3600000 + todayEarlyMorning;
if (todayHour < getCurrentTime() && getCurrentTime() < tomorrowEarlyMorning){
delayTime = (tomorrowEarlyMorning - getCurrentTime()) / 1000 / 60;
}else {
for (int i = 0; i <= num; i++) {
long current = i * executorTime * 3600000 + todayEarlyMorning;
if (getCurrentTime() == current){
delayTime = 0;
break;
}else if (current > getCurrentTime()){
delayTime = (current - getCurrentTime()) / 1000 / 60;
break;
}
}
}
}else {
delayTime = 0;
}
if (delayTime <= 0){
return 0;
}else {
delayTime = delayTime * 60 + waitingTimeBySeconds(60);
return delayTime;
}
}
/**
* 判断传入的字符串是时间格式还是时间戳格式
* 时间戳格式根据设置的format转换成对应的时间格式
@ -429,15 +370,20 @@ public class DateUtil {
String time = "";
if (date.length() == 14){
//20190613171965
time = date.substring(0, 4) + "-" +
date.substring(4, 6) + "-" +
date.substring(6, 8) + " " +
date.substring(8, 10) + ":" +
date.substring(10, 12) + ":" +
date.substring(12, 14);
time = date.substring(0, 4)
+ "-"
+ date.substring(4, 6)
+ "-"
+ date.substring(6, 8)
+ " "
+ date.substring(8, 10)
+ ":"
+ date.substring(10, 12)
+ ":"
+ date.substring(12, 14);
}else if (date.length() == 13){
//1560390240760
time = DateUtil.translateTimeToDate(Long.valueOf(date), format);
time = translateTimeToDate(Long.valueOf(date), format);
}
return time;
} catch (NumberFormatException e) {
@ -446,132 +392,50 @@ public class DateUtil {
return null;
}
/**
* 时间格式转换
* @param time 2020-03-24T11:24:31.000Z
* @return 2020-03-24 19:24:31
* @throws ParseException e
*/
public static String switchTime(String time) throws ParseException {
SimpleDateFormat format2 = new SimpleDateFormat(FORMAT.FULLTIMEBY_yMdHms);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");//格式化的表达式
time = time.replace("Z", " UTC");//是空格+UTC
SimpleDateFormat format2 = new SimpleDateFormat(FORMAT.FULL_TIME_YMD_HMS_S.getValue());
//格式化的表达式
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
//是空格+UTC
time = time.replace("Z", " UTC");
Date data = format.parse(time);
String format1 = format2.format(data);
return format1;
return format2.format(data);
}
/**
* 转化时间格式
* @param time 2020-01-15T15:16:23+08:00
* @return 2020-01-15 15:16:23
* @throws ParseException
* @throws java.text.ParseException e
*/
public static String switchLineTime(String time) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = df.parse(time);
SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
Date date = df.parse(time);
SimpleDateFormat df1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
Date date1 = df1.parse(date.toString());
SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String format = df2.format(date1);
return format;
return df2.format(date1);
}
/**
* 根据日期格式自动转换时间
* 最大精确到秒不支持毫秒最小精确到年不支持世纪
* @param date_format 日期格式例如 YYYY-MM-dd
* @param parseInt / 多少例如 1 根据date_format格式表达为当天时间的前一天
* @return 格式化后的时间
*/
public static String formatDateByReg(String date_format, int parseInt){
String translateTimeToDate = "";
Long current_time = System.currentTimeMillis();
if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
date_format.contains("MM") &&
date_format.contains("dd") &&
date_format.contains("HH") &&
date_format.contains("mm") &&
date_format.contains("ss")){
//
long real_time = current_time + parseInt * 1000;
translateTimeToDate = DateUtil.translateTimeToDate(real_time, date_format);
}else if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
date_format.contains("MM") &&
date_format.contains("dd") &&
date_format.contains("HH") &&
date_format.contains("mm") &&
!date_format.contains("ss")){
//分钟
long real_time = current_time + parseInt * 60 * 1000;
translateTimeToDate = DateUtil.translateTimeToDate(real_time, date_format);
}else if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
date_format.contains("MM") &&
date_format.contains("dd") &&
date_format.contains("HH") &&
!date_format.contains("mm") &&
!date_format.contains("ss")){
//小时
long real_time = current_time + parseInt * 60 * 60 * 1000;
translateTimeToDate = DateUtil.translateTimeToDate(real_time, date_format);
}else if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
date_format.contains("MM") &&
date_format.contains("dd") &&
!date_format.contains("HH") &&
!date_format.contains("mm") &&
!date_format.contains("ss")){
//
long real_time = current_time + parseInt * 24 * 60 * 60 * 1000;
translateTimeToDate = DateUtil.translateTimeToDate(real_time, date_format);
}else if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
date_format.contains("MM") &&
!date_format.contains("dd") &&
!date_format.contains("HH") &&
!date_format.contains("mm") &&
!date_format.contains("ss")){
//
String toDate = DateUtil.translateTimeToDate(current_time, DateUtil.FORMAT.FULLTIMEBY_yM);
Integer year = Integer.valueOf(toDate.split("-")[0]);
Integer month = Integer.valueOf(toDate.split("-")[1]);
int shang = parseInt / 12;
int yu = parseInt % 12;
year = year + shang;
month = month + yu;
if (month<0){
year = year - 1;
month = 12 + month;
}else if (month>12){
year = year + 1;
month = month - 12;
}
String i5 = month<10?"0"+String.valueOf(month):String.valueOf(month);
Long translateDateToTimestamp = DateUtil.translateDateToTimestamp(String.valueOf(year) + "-" + i5, DateUtil.FORMAT.FULLTIMEBY_yM);
translateTimeToDate = DateUtil.translateTimeToDate(translateDateToTimestamp, date_format);
}else if ((date_format.contains("YYYY")||date_format.contains("yyyy")) &&
!date_format.contains("MM") &&
!date_format.contains("dd") &&
!date_format.contains("HH") &&
!date_format.contains("mm") &&
!date_format.contains("ss")){
//
String year = DateUtil.translateTimeToDate(current_time, FORMAT.BASETIME_yyyy);
String value = String.valueOf(Integer.valueOf(year) + parseInt);
Long aLong = DateUtil.translateDateToTimestamp(value, FORMAT.BASETIME_yyyy);
translateTimeToDate = DateUtil.translateTimeToDate(aLong, date_format);
}else {
translateTimeToDate = DateUtil.translateTimeToDate(current_time, date_format);
}
return translateTimeToDate;
}
/**
* 转换String类型的Date格式数据为指定格式
*
* @param time Date 格式日期字符串
* @param date_format 格式化后类型
* @param dateFormat 格式化后类型
* @return 格式化后字符串
* @throws ParseException e
*/
public static String changeDateStringToFormatString(String time, String date_format) throws Exception{
public static String changeDateStringToFormatString(String time, String dateFormat) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
SimpleDateFormat format2 = new SimpleDateFormat(date_format);
SimpleDateFormat format2 = new SimpleDateFormat(dateFormat);
Date data = format.parse(time);
return format2.format(data);
}
@ -585,9 +449,26 @@ public class DateUtil {
public static String getFirstDayByMonth(int month, String format){
//获取当前月第一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天
return DateUtil.translateDateToString(c.getTime(), format);
c.set(Calendar.MONTH, month);
//设置为1号,当前日期既为本月第一天
c.set(Calendar.DAY_OF_MONTH, 1);
return translateDateToString(c.getTime(), format);
}
/**
* 获取指定月份的第一天的当前时间
* @param year 指定年
* @param month 指定月1 当前月加1
* @param format 转换后时间格式
* @return 转换后的时间
*/
public static String getFirstDayByMonth(int year, int month, String format){
//获取当前月最后一天
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, 1);
return translateDateToString(c.getTime(), format);
}
/**
@ -599,37 +480,151 @@ public class DateUtil {
public static String getLastDayByMonth(int month, String format){
//获取当前月最后一天
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, month);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
return DateUtil.translateDateToString(c.getTime(), format);
return translateDateToString(c.getTime(), format);
}
/**
* 按小時切割时间段
* @param startTime 开始时间 yyyy-MM-dd HH:mm:ss
* @param endTime 结束时间 yyyy-MM-dd HH:mm:ss
* @return 时间段集合
* [
* {
* "startTime": Date,
* "endTime": Date
* }
* ]
* 计算月份区间
*
* @param startMonth 起始月
* @param endMonth 结束月
* @param inputFormat 输入日期格式
* @param outputFormat 输出日期格式
* @return 月份区间集合
*/
public static List<JSONObject> getAroundTimeList(String startTime, String endTime, int cut){
List<JSONObject> times = new LinkedList<>();
Long startTimestamp = DateUtil.translateDateToTimestamp(startTime, DateUtil.FORMAT.FULLTIMEBY_yMdHms)/1000;
Long endTimestamp = DateUtil.translateDateToTimestamp(endTime, DateUtil.FORMAT.FULLTIMEBY_yMdHms)/1000;
List<String> list = DateUtil.splitTimestamp(cut, startTimestamp, endTimestamp);
for (String s : list) {
String[] split = s.split(",");
Date start_time = DateUtil.translateTimestampToDate(Long.valueOf(split[0]), DateUtil.FORMAT.FULLTIMEBY_yMdHms);
Date end_time = DateUtil.translateTimestampToDate(Long.valueOf(split[1]), DateUtil.FORMAT.FULLTIMEBY_yMdHms);
JSONObject jsonObject = new JSONObject();
jsonObject.put("startTime", start_time);
jsonObject.put("endTime", end_time);
times.add(jsonObject);
public static List<String> computerMonth(String startMonth,
String endMonth,
String inputFormat,
String outputFormat) {
List<String> months = new ArrayList<>();
Long startTimestamp = translateDateToTimestamp(startMonth, inputFormat);
Long endTimestamp = translateDateToTimestamp(endMonth, inputFormat);
if (null == startTimestamp || null == endTimestamp){
throw new NullPointerException("one of startMonth or endMonth parsed resulr is null.");
}
return times;
Calendar startDate = Calendar.getInstance();
startDate.setTimeInMillis(startTimestamp);
int year = startDate.get(Calendar.YEAR);
int month = startDate.get(Calendar.MONTH) + 1;
long currentTimestamp;
Calendar calendar = Calendar.getInstance();
calendar.clear();
while (true){
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
currentTimestamp = calendar.getTimeInMillis();
if (currentTimestamp > endTimestamp){
break;
}
months.add(translateTimeToDate(currentTimestamp, outputFormat));
month = month + 1;
if (month > 12){
year = year + 1;
month = 1;
}
}
return months;
}
/**
* 计算两个日期之间的天数不包含结束日期当天.
* 如果结束日期小于开始日期则返回负数天数.
*
* @param startDay 开始日期
* @param endDay 结束日期
* @param format 日期格式开始日期和结束日期格式必须保持一致
* @return 天数.
*/
public static long computerDaysBetween(String startDay, String endDay, String format){
Long startTimestamp = translateDateToTimestamp(startDay, format);
Long endTimestamp = translateDateToTimestamp(endDay, format);
if (null != endTimestamp && null != startTimestamp){
long change = endTimestamp - startTimestamp;
return change / (3600 * 24 * 1000);
}
throw new NullPointerException("one of startDay or endDay is null.");
}
/**
* 计算两个日期之间的天数不包含结束日期当天.
* 如果结束日期小于开始日期则返回负数天数.
*
* @param startDay 开始日期
* @param endDay 结束日期
* @param format 日期格式开始日期和结束日期格式必须保持一致
* @return 天数.
*/
public static long computerDaysBetween(Date startDay, Date endDay, String format){
String startString = translateDateToString(startDay, format);
String endString = translateDateToString(endDay, format);
return computerDaysBetween(startString, endString, format);
}
/**
* 判断当前时间是否在范围内.
* 包含开始时间和结束时间的时间点.
*
* @param format 时间格式
* @param startTime 开始时间
* @param endTime 结束时间
* @param checkTime 待判断时间
* @return 判断结果范围内 true 不在范围内 false
*/
public static boolean checkDateInRange(String format, String startTime, String endTime, String checkTime){
Long startTimestamp = translateDateToTimestamp(startTime, format);
Long endTimestamp = translateDateToTimestamp(endTime, format);
Long checkTimestamp = translateDateToTimestamp(checkTime, format);
if (null == startTimestamp || null == endTimestamp || null == checkTimestamp){
throw new NullPointerException();
}
return startTimestamp <= checkTimestamp && checkTimestamp <= endTimestamp;
}
/**
* 判断当前时间是否在范围内.
* 包含开始时间和结束时间的时间点.
*
* @param format 时间格式
* @param startTime 开始时间
* @param endTime 结束时间
* @param checkTime 待判断时间
* @return 判断结果范围内 true 不在范围内 false
*/
public static boolean checkDateInRange(String format, Date startTime, Date endTime, Date checkTime){
String startDate = translateDateToString(startTime, format);
String endDate = translateDateToString(endTime, format);
String checkDate = translateDateToString(checkTime, format);
return checkDateInRange(format, startDate, endDate, checkDate);
}
/**
* 判断当前时间是否在范围内.
* 包含开始时间和结束时间的时间点.
* 如果checkEnd=true,则rangeTime为结束时间表示1970-01-01 00:00:00 rangeTime的时间
* 如果checkEnd=false,则rangeTime为开始时间时间表示rangeTime 系统当前时间
*
* @param format 时间格式
* @param rangeTime 开始/结束时间
* @param checkTime 待判断时间
* @param checkEnd 当前范围为结束时间还是开始时间
* @return 判断结果范围内 true 不在范围内 false
*/
public static boolean checkDateInRange(String format, Date rangeTime, Date checkTime, boolean checkEnd){
String rangeDate = translateDateToString(rangeTime, format);
String checkDate = translateDateToString(checkTime, format);
if (checkEnd){
Calendar calendar = Calendar.getInstance();
calendar.set(1970, Calendar.JANUARY, 1, 0, 0, 0);
String judgeDate = translateDateToString(calendar.getTime(), format);
return checkDateInRange(format, judgeDate, rangeDate, checkDate);
}else {
Date date = new Date();
String judgeDate = translateDateToString(date, format);
return checkDateInRange(format, rangeDate, judgeDate, checkDate);
}
}
}

View File

@ -44,7 +44,7 @@ public class FileEncryptDecrypt {
public static boolean encrypt(String keyPath, String input, String output){
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
List<String> list = new ArrayList();
List<String> list = new ArrayList<>();
try {
byte[] buffer = Files.readAllBytes(Paths.get(keyPath));
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
@ -53,20 +53,28 @@ public class FileEncryptDecrypt {
File inputFile = new File(input);
File outputFile = new File(output);
fileInputStream = new FileInputStream(inputFile);
fileOutputStream = new FileOutputStream(outputFile);
byte[] inputByte = new byte[116];
int len;
while((len = fileInputStream.read(inputByte)) != -1){
list.add(new String(inputByte, 0, len));
try {
fileInputStream = new FileInputStream(inputFile);
fileOutputStream = new FileOutputStream(outputFile);
byte[] inputByte = new byte[116];
int len;
while((len = fileInputStream.read(inputByte)) != -1){
list.add(new String(inputByte, 0, len));
}
for (String s : list) {
byte [] encrypted = encrypt(publicKey, s);
fileOutputStream.write(encrypted);
fileOutputStream.flush();
}
}finally {
if (fileInputStream != null){
fileInputStream.close();
}
if (fileOutputStream != null){
fileOutputStream.close();
}
}
for (String s : list) {
byte [] encrypted = encrypt(publicKey, s);
fileOutputStream.write(encrypted);
fileOutputStream.flush();
}
fileOutputStream.close();
fileInputStream.close();
return true;
} catch (Exception e) {
e.printStackTrace();

View File

@ -278,12 +278,12 @@ public class FileUtil {
}
public static File getRecoverFileName(String templateName, String paramsNum, String path) throws Exception{
String translateTimeToDate = DateUtil.translateTimeToDate(DateUtil.getLastDaysTimestamp(1), DateUtil.FORMAT.NOSEGMENTATION_yMd);
String translateTimeToDate = DateUtil.translateTimeToDate(DateUtil.getLastDaysTimestamp(1), DateUtil.FORMAT.NO_SEGMENTATION_YMD.getValue());
List<String> fileNames = Arrays.asList(
templateName,
translateTimeToDate,
"00",
DateUtil.translateTimeToDate(System.currentTimeMillis(), DateUtil.FORMAT.NOSEGMENTATION_yMdHms),
DateUtil.translateTimeToDate(System.currentTimeMillis(), DateUtil.FORMAT.NO_SEGMENTATION_YMD_HMS.getValue()),
HttpCommonUtil.hostName,
paramsNum
);
@ -297,14 +297,14 @@ public class FileUtil {
public static String getLogFileName(String templateName, String paramsNum, String date_format, int date_num) throws Exception{
if (StringUtils.isEmpty(date_format)){
date_format = DateUtil.FORMAT.NOSEGMENTATION_yMdHms;
date_format = DateUtil.FORMAT.NO_SEGMENTATION_YMD_HMS.getValue();
}
String translateTimeToDate = DateUtil.translateTimeToDate(DateUtil.getLastDaysTimestamp(date_num), date_format);
List<String> fileNames = Arrays.asList(
templateName,
translateTimeToDate,
"00",
DateUtil.translateTimeToDate(System.currentTimeMillis(), DateUtil.FORMAT.NOSEGMENTATION_yMdHmsS),
DateUtil.translateTimeToDate(System.currentTimeMillis(), DateUtil.FORMAT.NO_SEGMENTATION_YMD_HMS_S.getValue()),
HttpCommonUtil.hostName,
paramsNum
);

View File

@ -37,13 +37,15 @@ public class HttpCommonUtil {
ip = request.getRemoteAddr();
if(ip.equals("127.0.0.1")){
//根据网卡取本机配置的IP
InetAddress inet=null;
InetAddress interNet=null;
try {
inet = InetAddress.getLocalHost();
interNet = InetAddress.getLocalHost();
} catch (Exception e) {
e.printStackTrace();
}
ip= inet.getHostAddress();
if (interNet != null){
ip= interNet.getHostAddress();
}
}
}
// 多个代理的情况第一个IP为客户端真实IP,多个IP按照','分割
@ -60,10 +62,11 @@ public class HttpCommonUtil {
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
return address.getHostAddress();
} catch (Exception e) {
e.printStackTrace();
}
return address.getHostAddress();
return null;
}
//获取本地机器名
@ -75,10 +78,11 @@ public class HttpCommonUtil {
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
return address.getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return address.getHostName();
return null;
}
/**

View File

@ -21,10 +21,10 @@ public class RestTemplateUtil {
private RestTemplate restTemplate;
@Value("${restTemplate.remote.alarm.url.email}")
@Value("${restTemplate.remote.alarm.url.email:''}")
private String alarmEmailUrl = "";
@Value("${restTemplate.remote.alarm.url.sms}")
@Value("${restTemplate.remote.alarm.url.sms:''}")
private String alarmSMSUrl = "";
public void setRestTemplate(RestTemplate restTemplate) {

View File

@ -1,254 +0,0 @@
package site.cnkj.common.utils.http;
import ch.ethz.ssh2.*;
import ch.ethz.ssh2.auth.AgentProxy;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.lang.Nullable;
import java.io.*;
import java.util.Objects;
/*
* @version 1.0 created by LXW on 2019/12/5 14:35
*/
public class SSH2Util {
private static String DEFAULT_CHARTSET = "UTF-8";
private static Connection connection;
@Data
public static class ConnectEntity{
/**
* the hostname of the SSH-2 server.
*/
String hostname;
/**
* port on the server, normally 22.
*/
int port = 22;
/**
* Allows you to set a custom "softwareversion" string as defined in RFC 4253.
* <b>NOTE: As per the RFC, the "softwareversion" string MUST consist of printable
* US-ASCII characters, with the exception of whitespace characters and the minus sign (-).</b>
*/
@Nullable String softwareversion = null;
@Nullable HTTPProxyData proxy = null;
/**
* A <code>String</code> holding the username.
*/
String username;
/**
* 1. The password to login in.
* 2. If the PEM structure is encrypted ("Proc-Type: 4,ENCRYPTED") then
* you must specify a password. Otherwise, this argument will be ignored
* and can be set to <code>null</code>.
* 3. If the PEM file is encrypted then you must specify the password.
* Otherwise, this argument will be ignored and can be set to <code>null</code>.
*/
@Nullable String password = null;
@Nullable AgentProxy au_proxy = null;
/**
* An <code>InteractiveCallback</code> which will be used to determine the responses to the questions asked by the server.
*/
@Nullable InteractiveCallback cb = null;
/**
* An array of submethod names, see
* draft-ietf-secsh-auth-kbdinteract-XX. May be <code>null</code>
* to indicate an empty list.
*/
@Nullable String[] submethods = null;
/**
* A <code>char[]</code> containing a DSA or RSA private key of the
* user in OpenSSH key format (PEM, you can't miss the
* "-----BEGIN DSA PRIVATE KEY-----" or "-----BEGIN RSA PRIVATE KEY-----"
* tag). The char array may contain linebreaks/linefeeds.
*/
@Nullable char[] pemPrivateKey = null;
/**
* A <code>File</code> object pointing to a file containing a DSA or RSA
* private key of the user in OpenSSH key format (PEM, you can't miss the
* "-----BEGIN DSA PRIVATE KEY-----" or "-----BEGIN RSA PRIVATE KEY-----"
* tag).
*/
@Nullable File pemFile = null;
}
private static String toString(InputStream inputStream){
InputStream stream = new StreamGobbler(inputStream);
StringBuffer stringBuffer = new StringBuffer();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, DEFAULT_CHARTSET));
while (true){
String line = bufferedReader.readLine();
if (StringUtils.isEmpty(line)){
break;
}
stringBuffer.append(line+"\n");
}
return stringBuffer.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Remote login to server with username and password.
* @param connectEntity Connection entity class
* @return Connection
*/
public static Connection login(ConnectEntity connectEntity){
try {
//create connection
if (connectEntity.getProxy() == null && StringUtils.isEmpty(connectEntity.getSoftwareversion())){
connection = new Connection(connectEntity.getHostname(), connectEntity.getPort());
}else if (connectEntity.getProxy() != null && StringUtils.isEmpty(connectEntity.getSoftwareversion())){
connection = new Connection(connectEntity.getHostname(), connectEntity.getPort(), connectEntity.getProxy());
}else if (connectEntity.getProxy() != null && StringUtils.isNotEmpty(connectEntity.getSoftwareversion())){
connection = new Connection(connectEntity.getHostname(), connectEntity.getPort(), connectEntity.getSoftwareversion(), connectEntity.getProxy());
}else if (connectEntity.getProxy() == null && StringUtils.isNotEmpty(connectEntity.getSoftwareversion())){
connection = new Connection(connectEntity.getHostname(), connectEntity.getPort(), connectEntity.getSoftwareversion());
}
connection.connect();
//authenticate
boolean authenticate = false;
if (StringUtils.isEmpty(connectEntity.getPassword()) && connectEntity.getAu_proxy() == null && connectEntity.getCb() == null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithNone(connectEntity.getUsername());
}else if (StringUtils.isEmpty(connectEntity.getPassword()) && connectEntity.getAu_proxy() == null && connectEntity.getCb() != null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithKeyboardInteractive(connectEntity.getUsername(), connectEntity.getCb());
}else if (StringUtils.isEmpty(connectEntity.getPassword()) && connectEntity.getAu_proxy() == null && connectEntity.getCb() != null && connectEntity.getSubmethods() != null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithKeyboardInteractive(connectEntity.getUsername(), connectEntity.getSubmethods(), connectEntity.getCb());
}else if (StringUtils.isEmpty(connectEntity.getPassword()) && connectEntity.getAu_proxy() != null && connectEntity.getCb() == null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithAgent(connectEntity.getUsername(), connectEntity.getAu_proxy());
}else if (StringUtils.isNotEmpty(connectEntity.getPassword()) && connectEntity.getAu_proxy() == null && connectEntity.getCb() == null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithPassword(connectEntity.getUsername(), connectEntity.getPassword());
}else if (connectEntity.getAu_proxy() == null && connectEntity.getCb() == null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() != null && connectEntity.getPemFile() == null){
authenticate = connection.authenticateWithPublicKey(connectEntity.getUsername(), connectEntity.getPemPrivateKey(), connectEntity.getPassword());
}else if (connectEntity.getAu_proxy() == null && connectEntity.getCb() == null && connectEntity.getSubmethods() == null && connectEntity.getPemPrivateKey() == null && connectEntity.getPemFile() != null){
authenticate = connection.authenticateWithPublicKey(connectEntity.getUsername(), connectEntity.getPemFile(), connectEntity.getPassword());
}
if (!authenticate){
throw new RuntimeException("Failed to verify login");
}
return connection;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* Execute script.
* NOTE: If result is empty or null, it will be throw.
* WARN: If it is not a command that comes with Linux, there may be unrecognized problems.
* For Example: ll: command not found, even it can be used in your servers.
* @param connection Connection object
* @param cmd script
* @return Results of the script
*/
public static String execute(Connection connection, String cmd){
try {
Session session = connection.openSession();
session.execCommand(cmd, DEFAULT_CHARTSET);
String out = toString(session.getStdout());
if (StringUtils.isEmpty(out)){
throw new RuntimeException("Execution failed, return value is NULL."+toString(session.getStderr()));
}
session.close();
connection.close();
return out;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Upload file to the specified path on the remote server by use scp.
* @param connection Connection object
* @param local Local file
* @param remote Remote directory path
* @return result of upload
*/
public static Boolean upload(Connection connection, File local, String remote){
try {
SCPClient scpClient = new SCPClient(connection);
SCPOutputStream scpOutputStream = scpClient.put(local.getName(), local.length(), remote, "0600");
scpOutputStream.close();
connection.close();
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* Batch upload files to the specified path on the specified server.
* @param connection connection Connection object
* @param local local directory path or file path
* @param remote remote directory path
* @return result of upload
*/
public static Boolean batchUpload(Connection connection, String local, String remote){
try {
File localDir = new File(local);
if (localDir.isFile()){
return upload(connection, localDir, remote);
}else if (localDir.isDirectory()){
for (File file : Objects.requireNonNull(localDir.listFiles())) {
upload(connection, file, remote);
}
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* Download file to local from remote server.
* @param connection Connection object
* @param local local file path
* @param remote remote file path
* @return result for download
*/
public static Boolean download(Connection connection, String local, String remote){
FileOutputStream fileOutputStream = null;
try {
SCPClient scpClient = new SCPClient(connection);
SCPInputStream scpInputStream = scpClient.get(remote);
File localFile = new File(local);
if (!localFile.getParentFile().exists()){
localFile.getParentFile().mkdirs();
}
fileOutputStream = new FileOutputStream(localFile);
byte[] b = new byte[1024];
while (true){
int read = scpInputStream.read(b);
if (read == -1){
break;
}
fileOutputStream.write(b, 0, read);
}
fileOutputStream.flush();
scpInputStream.close();
return true;
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (fileOutputStream != null){
fileOutputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
connection.close();
}
return false;
}
}

View File

@ -1,7 +1,7 @@
package site.cnkj.common.utils.io;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import sun.misc.BASE64Decoder;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
@ -18,15 +18,19 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* RSA非对称数据加解密
* @version 1.0 created by LXW on 2019/4/15 15:31
*/
public class RSAEncrypt {
private static final String DEFAULT_PUBLIC_KEY=
public static final String DEFAULT_PUBLIC_KEY=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChDzcjw/rWgFwnxunbKp7/4e8w" + "\r" +
"/UmXx2jk6qEEn69t6N2R1i/LmcyDT1xr/T2AHGOiXNQ5V8W4iCaaeNawi7aJaRht" + "\r" +
"Vx1uOH/2U378fscEESEG8XDqll0GCfB1/TjKI2aitVSzXOtRs8kYgGU78f7VmDNg" + "\r" +
"XIlk3gdhnzh+uoEQywIDAQAB" + "\r";
private static final String DEFAULT_PRIVATE_KEY=
public static final String DEFAULT_PRIVATE_KEY=
"MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAKEPNyPD+taAXCfG" + "\r" +
"6dsqnv/h7zD9SZfHaOTqoQSfr23o3ZHWL8uZzINPXGv9PYAcY6Jc1DlXxbiIJpp4" + "\r" +
"1rCLtolpGG1XHW44f/ZTfvx+xwQRIQbxcOqWXQYJ8HX9OMojZqK1VLNc61GzyRiA" + "\r" +
@ -42,6 +46,8 @@ public class RSAEncrypt {
"Fae7oAqkMAd3xCNY6ec180tAe57hZ6kS+SYLKwb4gGzYaCxc22vMtYksXHtUeamo" + "\r" +
"1NMLzI2ZfUoX" + "\r";
/**
* 私钥
*/
@ -84,169 +90,145 @@ public class RSAEncrypt {
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
keyPairGen.initialize(1024, new SecureRandom());
KeyPair keyPair= keyPairGen.generateKeyPair();
this.privateKey= (RSAPrivateKey) keyPair.getPrivate();
this.publicKey= (RSAPublicKey) keyPair.getPublic();
if (keyPairGen != null){
keyPairGen.initialize(2048, new SecureRandom());
KeyPair keyPair= keyPairGen.generateKeyPair();
this.privateKey= (RSAPrivateKey) keyPair.getPrivate();
this.publicKey= (RSAPublicKey) keyPair.getPublic();
}
}
private StringBuilder loadKey(InputStream in) throws IOException {
BufferedReader br= new BufferedReader(new InputStreamReader(in));
String readLine= null;
StringBuilder sb= new StringBuilder();
while((readLine= br.readLine())!=null){
if(readLine.charAt(0)!='-'){
sb.append(readLine);
sb.append('\r');
}
}
return sb;
}
/**
* 从文件中输入流中加载公钥
* @param in 公钥输入流
* @throws Exception 加载公钥时产生的异常
* @throws IOException e
* @throws NoSuchAlgorithmException e
* @throws InvalidKeySpecException e
*/
public void loadPublicKey(InputStream in) throws Exception{
try {
BufferedReader br= new BufferedReader(new InputStreamReader(in));
String readLine= null;
StringBuilder sb= new StringBuilder();
while((readLine= br.readLine())!=null){
if(readLine.charAt(0)=='-'){
continue;
}else{
sb.append(readLine);
sb.append('\r');
}
}
loadPublicKey(sb.toString());
} catch (IOException e) {
throw new Exception("公钥数据流读取错误");
} catch (NullPointerException e) {
throw new Exception("公钥输入流为空");
}
public void loadPublicKey(InputStream in) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
loadPublicKey(loadKey(in).toString());
}
/**
* 从字符串中加载公钥
* @param publicKeyStr 公钥数据字符串
* @throws Exception 加载公钥时产生的异常
* @throws NoSuchAlgorithmException e
* @throws InvalidKeySpecException e
*/
public void loadPublicKey(String publicKeyStr) throws Exception{
try {
BASE64Decoder base64Decoder= new BASE64Decoder();
byte[] buffer= base64Decoder.decodeBuffer(publicKeyStr);
KeyFactory keyFactory= KeyFactory.getInstance("RSA");
X509EncodedKeySpec keySpec= new X509EncodedKeySpec(buffer);
this.publicKey= (RSAPublicKey) keyFactory.generatePublic(keySpec);
} catch (NoSuchAlgorithmException e) {
throw new Exception("无此算法");
} catch (InvalidKeySpecException e) {
throw new Exception("公钥非法");
} catch (IOException e) {
throw new Exception("公钥数据内容读取错误");
} catch (NullPointerException e) {
throw new Exception("公钥数据为空");
}
public void loadPublicKey(String publicKeyStr) throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] buffer= Base64.decodeBase64(publicKeyStr);
KeyFactory keyFactory= KeyFactory.getInstance("RSA");
X509EncodedKeySpec keySpec= new X509EncodedKeySpec(buffer);
this.publicKey= (RSAPublicKey) keyFactory.generatePublic(keySpec);
}
/**
* 从文件中加载私钥
* @param in 输入流
* @return 是否成功
* @throws Exception
* @throws NoSuchAlgorithmException e
* @throws InvalidKeySpecException e
* @throws IOException e
*/
public void loadPrivateKey(InputStream in) throws Exception{
try {
BufferedReader br= new BufferedReader(new InputStreamReader(in));
String readLine= null;
StringBuilder sb= new StringBuilder();
while((readLine= br.readLine())!=null){
if(readLine.charAt(0)=='-'){
continue;
}else{
sb.append(readLine);
sb.append('\r');
}
}
loadPrivateKey(sb.toString());
} catch (IOException e) {
throw new Exception("私钥数据读取错误");
} catch (NullPointerException e) {
throw new Exception("私钥输入流为空");
}
public void loadPrivateKey(InputStream in) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException{
loadPrivateKey(loadKey(in).toString());
}
public void loadPrivateKey(String privateKeyStr) throws Exception{
public void loadPrivateKey(String privateKeyStr) throws NoSuchAlgorithmException, InvalidKeySpecException {
try {
BASE64Decoder base64Decoder= new BASE64Decoder();
byte[] buffer= base64Decoder.decodeBuffer(privateKeyStr);
byte[] buffer= Base64.decodeBase64(privateKeyStr);
PKCS8EncodedKeySpec keySpec= new PKCS8EncodedKeySpec(buffer);
KeyFactory keyFactory= KeyFactory.getInstance("RSA");
this.privateKey= (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
} catch (NoSuchAlgorithmException e) {
throw new Exception("无此算法");
throw new NoSuchAlgorithmException("无此算法");
} catch (InvalidKeySpecException e) {
throw new Exception("私钥非法");
} catch (IOException e) {
throw new Exception("私钥数据内容读取错误");
throw new InvalidKeySpecException("私钥非法");
} catch (NullPointerException e) {
throw new Exception("私钥数据为空");
throw new NullPointerException("私钥数据为空");
}
}
/**
* 加密过程
* @param publicKey 公钥
* @param plainTextData 明文数据
* @return
* @throws Exception 加密过程中的异常信息
* @return 加密后字节
* @throws NoSuchAlgorithmException e
* @throws InvalidKeyException e
* @throws IllegalBlockSizeException e
* @throws BadPaddingException e
* @throws NoSuchPaddingException e
*/
public byte[] encrypt(RSAPublicKey publicKey, byte[] plainTextData) throws Exception{
public byte[] encrypt(RSAPublicKey publicKey, byte[] plainTextData) throws NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException {
if(publicKey== null){
throw new Exception("加密公钥为空, 请设置");
throw new NullPointerException("加密公钥为空, 请设置");
}
Cipher cipher= null;
try {
cipher= Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding", new BouncyCastleProvider());
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] output= cipher.doFinal(plainTextData);
return output;
return cipher.doFinal(plainTextData);
} catch (NoSuchAlgorithmException e) {
throw new Exception("无此加密算法");
} catch (NoSuchPaddingException e) {
e.printStackTrace();
return null;
throw new NoSuchAlgorithmException("无此加密算法");
} catch (InvalidKeyException e) {
throw new Exception("加密公钥非法,请检查");
throw new InvalidKeyException("加密公钥非法,请检查");
} catch (IllegalBlockSizeException e) {
throw new Exception("明文长度非法");
throw new IllegalBlockSizeException("明文长度非法");
} catch (BadPaddingException e) {
throw new Exception("明文数据已损坏");
} catch (Exception e){
e.printStackTrace();
return null;
throw new BadPaddingException("明文数据已损坏");
} catch (NoSuchPaddingException e) {
throw new NoSuchPaddingException("无此类填充");
}
}
/**
* 解密过程
* @param privateKey 私钥
* @param cipherData 密文数据
* @return 明文
* @throws Exception 解密过程中的异常信息
* @throws NoSuchAlgorithmException e
* @throws NoSuchPaddingException e
* @throws InvalidKeyException e
* @throws IllegalBlockSizeException e
* @throws BadPaddingException e
*/
public byte[] decrypt(RSAPrivateKey privateKey, byte[] cipherData) throws Exception{
public byte[] decrypt(RSAPrivateKey privateKey, byte[] cipherData) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
if (privateKey== null){
throw new Exception("解密私钥为空, 请设置");
throw new NullPointerException("解密私钥为空, 请设置");
}
Cipher cipher= null;
try {
cipher= Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding", new BouncyCastleProvider());
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] output= cipher.doFinal(cipherData);
return output;
return cipher.doFinal(cipherData);
} catch (NoSuchAlgorithmException e) {
throw new Exception("无此解密算法");
throw new NoSuchAlgorithmException("无此解密算法");
} catch (NoSuchPaddingException e) {
e.printStackTrace();
return null;
throw new NoSuchPaddingException("无此类填充");
}catch (InvalidKeyException e) {
throw new Exception("解密私钥非法,请检查");
throw new InvalidKeyException("解密私钥非法,请检查");
} catch (IllegalBlockSizeException e) {
throw new Exception("密文长度非法");
throw new IllegalBlockSizeException("密文长度非法");
} catch (BadPaddingException e) {
throw new Exception("密文数据已损坏");
throw new BadPaddingException("密文数据已损坏");
}
}

View File

@ -184,4 +184,15 @@ public class StringUtil {
return null;
}
public static String CapitalizeFirstLetter(String input){
try {
char[] chars = input.toCharArray();
chars[0]-=32;
return String.valueOf(chars);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}

View File

@ -1,399 +1,309 @@
package site.cnkj.common.utils.logger;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.MDC;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import site.cnkj.common.object.ReasonEnumeration;
import site.cnkj.common.utils.bean.ReflectionUtil;
import site.cnkj.common.utils.date.DateUtil;
import site.cnkj.common.utils.http.HttpCommonUtil;
import site.cnkj.common.utils.io.StringUtil;
/*
* @version 1.0 created by LXW on 2019/4/1 9:13
*/
@Component
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
/**
* 日志打印
*
* @author Liu XueWen, 2021-12-06
* @version EasyUtil v0.3.0
**/
@Slf4j
public class LoggerUtil {
@Value("${spring.application.name}")
private String serviceName;//服务名
enum Level{
INFO("INFO"),
WARN("WARN"),
ERROR("ERROR"),
DEBUG("DEBUG");
private static final Logger LOGGER = LoggerFactory.getLogger(LoggerUtil.class);
private final String value;
public static class Level{
public static final String INFO = "INFO";
public static final String WARN = "WARN";
public static final String ERROR = "ERROR";
public static final String DEBUG = "DEBUG";
Level(String value){
this.value = value;
}
}
public static class Status{
public static final String SUCCESS = "000000";//成功
private static final String HOST_NAME = getHostName();
public static final String FAILED = "100000";//执行失败
public static final String FAILED_INSERTMD5 = "100001";//插入流水号失败
public static final String FAILED_VERIFYSEPARATOR = "100002";//校验分隔符数量失败
public static final String FAILED_INCLUDDIRTYDATA = "100003";//校验脏数据失败
public static final String FAILED_ANALYZESOURCE = "100004";//校验数据失败
public static final String ERROR = "200000";//错误
public static final String DEBUG = "300000";//调试开发
public static final String WARN = "400000";//警告
public static final String WARN_SOURCE = "400001";//警告,针对异常数据情况
}
public static class Type{
public static final String ERROR_MESSAGE = "error_message";
public static final String SCHEDULE = "schedule";
public static final String BUSINESS = "business";
private static String getHostName(){
InetAddress address = null;
try {
address = InetAddress.getLocalHost();
return address.getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return null;
}
/**
* 数据处理方式枚举值
* 格式化Exception为String
* @param e Exception
* @return e.toString
*/
public static class HandleEnumeration{
public static final String discard = "0";//丢弃
public static final String replicate = "1";//复制
private static String formatException(Exception e){
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
return StringEscapeUtils.escapeJava(str);
}
@Data
public static class MonitorEntity {
private String hostName = HttpCommonUtil.getLocalHostName();//机器名
private String timestamp = DateUtil.translateTimeToDate(DateUtil.getCurrentTime(), DateUtil.FORMAT.FULLTIMEBY_yMdHmsS);//时间
private String time = DateUtil.translateTimeToDate(DateUtil.getCurrentTime(), DateUtil.FORMAT.FULLTIMEBY_yMdHmsS);//时间
private static class LoggerEntity {
private String traceId = getMDC();
private String requestId = MDC.get("requestId");
private String hostName = HOST_NAME;//机器名
private String time = DateUtil.translateDateToString(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");//时间
private Long timestamp = new Date().getTime();
private String className = new Throwable().getStackTrace()[4].getClassName();
private String methodName = new Throwable().getStackTrace()[4].getMethodName();
private String level;//级别
@Nullable private String status;//状态枚举值
@Nullable private String type;//类型
@Nullable private String info;//信息
@Nullable private String logName;//标识
@Nullable private String topicName;//topic名
@Nullable private String stackTrace;//异常信息如果没有则为NULL
@Nullable private String filterName;//数据特殊处理条件名称
@Nullable private String prefix;//数据模版前缀
@Nullable private String source;//原始数据
@Nullable private String message;//解析处理后的数据
@Nullable private String templateName;//模版名称
@Nullable private String serviceName;//服务名
@Nullable private String handleEnumeration;//枚举值0 剪切/1 复制
@Nullable private String reasonEnumeration;//异常原因枚举值
@Nullable private String separatorNum;//分隔符数量
@Nullable private String exceptionKeyWordName;//异常字段名字
@Nullable private String exceptionKeyWordValue;//异常字段值
@Nullable private String exceptionKeyWordTemplateArea;//异常字段在模版中的位数
private void setReasonEnumeration(String reasonEnumeration) {
this.reasonEnumeration = reasonEnumeration;
this.info = ReasonEnumeration.reasonEnumeration.get(getReasonEnumeration());
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
return JSON.toJSONString(this);
}
}
private static final String TRACE_ID = "TraceID";
/**
* 处理异常数据情况的告警
* @param logName id或uri标识
* @param topic topic名字
* @param filterName 过滤条件名字
* @param prefix 模版前缀
* @param source 原始数据
* @param message 解析后数据
* @param templateName 模版名称
* @param handleEnumeration 数据处理枚举值
* @param reasonEnumeration 异常原因枚举值
* @param exceptionKeyWordName 异常字段名字 同一个字段上可能存在多个名字"|"拼接 params.videoId|params.mvId|params.concertId
* @param exceptionKeyWordValue 异常字段名字 同一个字段上可能存在多个名字"|"拼接 params.videoId|params.mvId|params.concertId
* @param exceptionKeyWordTemplateArea 异常字段在模版中的位数
*/
public static void monitor(String logName,
String topic,
String filterName,
String prefix,
String source,
String message,
String templateName,
String handleEnumeration,
String reasonEnumeration,
String separatorNum,
String exceptionKeyWordName,
String exceptionKeyWordValue,
String exceptionKeyWordTemplateArea){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.WARN);
monitorEntity.setStatus(Status.WARN_SOURCE);
monitorEntity.setType(Type.BUSINESS);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topic);
monitorEntity.setFilterName(filterName);
monitorEntity.setPrefix(prefix);
monitorEntity.setSource(source);
monitorEntity.setMessage(message);
monitorEntity.setTemplateName(templateName);
monitorEntity.setHandleEnumeration(handleEnumeration);
monitorEntity.setReasonEnumeration(reasonEnumeration);
monitorEntity.setSeparatorNum(separatorNum);
monitorEntity.setExceptionKeyWordName(exceptionKeyWordName);
monitorEntity.setExceptionKeyWordValue(exceptionKeyWordValue);
monitorEntity.setExceptionKeyWordTemplateArea(exceptionKeyWordTemplateArea);
LOGGER.warn(monitorEntity.toString());
static String getMDC(){
if (StringUtils.isEmpty(MDC.get(TRACE_ID))){
String traceID = "TraceID: " + UUID.randomUUID().toString();
MDC.put(TRACE_ID, traceID);
}
return MDC.get(TRACE_ID).split(":")[1].trim();
}
public static void message(String level, String info, String status, String type, String logName, String topicName, Exception e, String id, String uri, String filterName, String prefix, String source, String message, String templateName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(level);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(type);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
monitorEntity.setStackTrace(StringUtil.formatException(e));
monitorEntity.setFilterName(filterName);
monitorEntity.setPrefix(prefix);
monitorEntity.setSource(source);
monitorEntity.setMessage(message);
monitorEntity.setTemplateName(templateName);
if ((Level.ERROR).equals(level)){
LOGGER.error(monitorEntity.toString());
}else if ((Level.INFO).equals(level)){
LOGGER.info(monitorEntity.toString());
}else if ((Level.WARN).equals(level)){
LOGGER.warn(monitorEntity.toString());
}else if ((Level.DEBUG).equals(level)){
LOGGER.debug(monitorEntity.toString());
static void checkFields(Map<String, Object> fields){
for (Field field : ReflectionUtil.getAllFieldByClazz(LoggerEntity.class)) {
if (field.isSynthetic()){
continue;
}
if (fields.containsKey(field.getName())){
throw new IllegalArgumentException("current field can not be use as key: " + field.getName());
}
}
}
public static void message(MonitorEntity monitorEntity){
String level = monitorEntity.getLevel();
switch(level){
case Level.DEBUG:
LOGGER.debug(monitorEntity.toString());
case Level.ERROR:
LOGGER.error(monitorEntity.toString());
case Level.WARN:
LOGGER.warn(monitorEntity.toString());
default:
LOGGER.info(monitorEntity.toString());
private static void logger(Level level, String source){
if (Level.INFO.value.equals(level.value)){
log.info(source);
}else if (Level.WARN.value.equals(level.value)){
log.warn(source);
}else if (Level.ERROR.value.equals(level.value)){
log.error(source);
}else if (Level.DEBUG.value.equals(level.value)){
log.debug(source);
}
}
public static void warn(MonitorEntity monitorEntity){
monitorEntity.setLevel(Level.WARN);
monitorEntity.setStatus(Status.WARN);
LOGGER.warn(monitorEntity.toString());
private static void message(Level level, String message){
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
logger(level, loggerEntity.toString());
}
public static void warn(String info, String type, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.WARN);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.WARN);
monitorEntity.setType(type);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
LOGGER.warn(monitorEntity.toString());
private static void map(Level level, String message, Map<String, Object> fields){
checkFields(fields);
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
JSONObject jsonSource = JSON.parseObject(loggerEntity.toString());
for (Map.Entry<String, Object> entry : fields.entrySet()) {
jsonSource.put(entry.getKey(), entry.getValue());
}
logger(level, JSON.toJSONString(jsonSource));
}
public static void warn(String info, String type, String logName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.WARN);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.WARN);
monitorEntity.setType(type);
monitorEntity.setLogName(logName);
LOGGER.warn(monitorEntity.toString());
private static void throwable(Level level, String message, Throwable throwable){
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
loggerEntity.setStackTrace(throwable.getMessage());
logger(level, loggerEntity.toString());
}
public static void warn(String info, String type){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.WARN);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.WARN);
monitorEntity.setType(type);
LOGGER.warn(monitorEntity.toString());
private static void exception(Level level, String message, Exception e){
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
loggerEntity.setStackTrace(formatException(e));
logger(level, loggerEntity.toString());
}
public static void warn(String info){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.WARN);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.WARN);
monitorEntity.setType(Type.BUSINESS);
LOGGER.warn(monitorEntity.toString());
private static void mapThrowable(Level level, String message, Map<String, Object> fields, Throwable throwable){
checkFields(fields);
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
loggerEntity.setStackTrace(throwable.getMessage());
JSONObject jsonSource = JSON.parseObject(loggerEntity.toString());
jsonSource.putAll(fields);
logger(level, JSON.toJSONString(jsonSource));
}
public static void error(MonitorEntity monitorEntity){
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setType(Type.ERROR_MESSAGE);
LOGGER.error(monitorEntity.toString());
private static void mapException(Level level, String message, Map<String, Object> fields, Exception e){
checkFields(fields);
LoggerEntity loggerEntity = new LoggerEntity();
loggerEntity.setLevel(level.value);
loggerEntity.setInfo(message);
loggerEntity.setStackTrace(formatException(e));
JSONObject jsonSource = JSON.parseObject(loggerEntity.toString());
jsonSource.putAll(fields);
logger(level, JSON.toJSONString(jsonSource));
}
public static void error(String info, String status, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
LOGGER.error(monitorEntity.toString());
private static String formatInputString(String message, Object... args){
StringBuilder stringBuilder = new StringBuilder();
String[] messages = message.split("\\{\\}", -1);
for (int i = 0; i < messages.length; i++) {
stringBuilder.append(messages[i]);
if (i < args.length){
Object arg = args[i];
stringBuilder.append(String.valueOf(arg));
}
}
return stringBuilder.toString();
}
public static void error(String info){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.ERROR);
monitorEntity.setType(Type.ERROR_MESSAGE);
LOGGER.error(monitorEntity.toString());
public static void info(String message, Object... args){
String inputString = formatInputString(message, args);
message(Level.INFO, inputString);
}
public static void error(String info, Exception e, String status, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
monitorEntity.setStackTrace(StringUtil.formatException(e));
LOGGER.error(monitorEntity.toString());
public static void info(String message){
message(Level.INFO, message);
}
public static void error(String info, Exception e, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.ERROR);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
monitorEntity.setStackTrace(StringUtil.formatException(e));
LOGGER.error(monitorEntity.toString());
public static void info(String message, Map<String, Object> fields){
map(Level.INFO, message, fields);
}
public static void error(String info, Exception e, String status){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setStackTrace(StringUtil.formatException(e));
LOGGER.error(monitorEntity.toString());
public static void info(String message, Throwable throwable){
throwable(Level.INFO, message, throwable);
}
public static void error(String info, Exception e){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.ERROR);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setStackTrace(StringUtil.formatException(e));
LOGGER.error(monitorEntity.toString());
public static void info(String message, Exception e){
exception(Level.INFO, message, e);
}
public static void error(String info, Exception e, String source, String result, String topic, String logName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.ERROR);
monitorEntity.setType(Type.ERROR_MESSAGE);
monitorEntity.setStackTrace(StringUtil.formatException(e));
monitorEntity.setLogName(logName);
monitorEntity.setMessage(result);
monitorEntity.setSource(source);
monitorEntity.setTopicName(topic);
LOGGER.error(monitorEntity.toString());
public static void info(String message, Map<String, Object> fields, Throwable throwable){
mapThrowable(Level.INFO, message, fields, throwable);
}
public static void error(String info, String status){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.ERROR);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.ERROR_MESSAGE);
LOGGER.error(monitorEntity.toString());
public static void info(String message, Map<String, Object> fields, Exception e){
mapException(Level.INFO, message, fields, e);
}
public static void info(MonitorEntity monitorEntity){
monitorEntity.setLevel(Level.INFO);
monitorEntity.setStatus(Status.SUCCESS);
monitorEntity.setType(Type.BUSINESS);
LOGGER.info(monitorEntity.toString());
public static void warn(String message){
message(Level.WARN, message);
}
public static void info(String info, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.INFO);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.SUCCESS);
monitorEntity.setType(Type.BUSINESS);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
LOGGER.info(monitorEntity.toString());
public static void warn(String message, Object... args){
String inputString = formatInputString(message, args);
message(Level.WARN, inputString);
}
public static void info(String info, String logName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.INFO);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.SUCCESS);
monitorEntity.setType(Type.BUSINESS);
monitorEntity.setLogName(logName);
LOGGER.info(monitorEntity.toString());
public static void warn(String message, Map<String, Object> fields){
fields.remove("data");
map(Level.WARN, message, fields);
}
public static void info(String info){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.INFO);
monitorEntity.setInfo(info);
monitorEntity.setStatus(Status.SUCCESS);
monitorEntity.setType(Type.BUSINESS);
LOGGER.info(monitorEntity.toString());
public static void warn(String message, Throwable throwable){
throwable(Level.WARN, message, throwable);
}
public static void debug(String info, String status, String logName, String topicName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.DEBUG);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.BUSINESS);
monitorEntity.setLogName(logName);
monitorEntity.setTopicName(topicName);
LOGGER.debug(monitorEntity.toString());
public static void warn(String message, Exception e){
exception(Level.WARN, message, e);
}
public static void debug(String info, String status, String logName){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.DEBUG);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.BUSINESS);
monitorEntity.setLogName(logName);
LOGGER.debug(monitorEntity.toString());
public static void warn(String message, Map<String, Object> fields, Throwable throwable){
mapThrowable(Level.WARN, message, fields, throwable);
}
public static void debug(String info, String status){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.DEBUG);
monitorEntity.setInfo(info);
monitorEntity.setStatus(status);
monitorEntity.setType(Type.BUSINESS);
LOGGER.debug(monitorEntity.toString());
public static void warn(String message, Map<String, Object> fields, Exception e){
mapException(Level.WARN, message, fields, e);
}
public static void debug(String info){
MonitorEntity monitorEntity = new MonitorEntity();
monitorEntity.setLevel(Level.DEBUG);
monitorEntity.setInfo(info);
monitorEntity.setType(Type.BUSINESS);
LOGGER.debug(monitorEntity.toString());
public static void debug(String message){
message(Level.DEBUG, message);
}
public static void debug(String message, Object... args){
String inputString = formatInputString(message, args);
message(Level.DEBUG, inputString);
}
public static void debug(String message, Map<String, Object> fields){
map(Level.DEBUG, message, fields);
}
public static void debug(String message, Throwable throwable){
throwable(Level.DEBUG, message, throwable);
}
public static void debug(String message, Exception e){
exception(Level.DEBUG, message, e);
}
public static void debug(String message, Map<String, Object> fields, Throwable throwable){
mapThrowable(Level.DEBUG, message, fields, throwable);
}
public static void debug(String message, Map<String, Object> fields, Exception e){
mapException(Level.DEBUG, message, fields, e);
}
public static void error(String message){
message(Level.ERROR, message);
}
public static void error(String message, Object... args){
String inputString = formatInputString(message, args);
message(Level.ERROR, inputString);
}
public static void error(String message, Map<String, Object> fields){
map(Level.ERROR, message, fields);
}
public static void error(String message, Throwable throwable){
throwable(Level.ERROR, message, throwable);
}
public static void error(String message, Exception e){
exception(Level.ERROR, message, e);
}
public static void error(String message, Map<String, Object> fields, Throwable throwable){
mapThrowable(Level.ERROR, message, fields, throwable);
}
public static void error(String message, Map<String, Object> fields, Exception e){
mapException(Level.ERROR, message, fields, e);
}
}

View File

@ -33,7 +33,7 @@ public class GracefulShutdown implements TomcatConnectorCustomizer, ApplicationL
// 指定执行的方法
shutdown();
//手动清理内存
System.gc();
Runtime.getRuntime().gc();
LOGGER.warn("清理内存完毕,正在退出服务......");
if (this.connector == null){
return;
@ -42,20 +42,18 @@ public class GracefulShutdown implements TomcatConnectorCustomizer, ApplicationL
LOGGER.warn("关闭全部连接......");
Executor executor = this.connector.getProtocolHandler().getExecutor();
if (executor instanceof ThreadPoolExecutor) {
try {
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
threadPoolExecutor.shutdown();
LOGGER.warn("当前服务线程池被关闭");
if (!threadPoolExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
LOGGER.warn("Tomcat thread pool did not shut down gracefully within 30 seconds. Proceeding with forceful shutdown");
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
threadPoolExecutor.shutdown();
LOGGER.warn("当前服务线程池被关闭");
if (!threadPoolExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
LOGGER.warn("Tomcat thread pool did not shut down gracefully within 30 seconds. Proceeding with forceful shutdown");
}
}
this.connector.stop();
} catch (LifecycleException e) {
e.printStackTrace();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
@ -78,5 +76,7 @@ public class GracefulShutdown implements TomcatConnectorCustomizer, ApplicationL
* 2.flush内存中全部的未处理数据
* 3.清理服务中全部待处理的数据
*/
public void shutdown(){}
public void shutdown(){
//do something
}
}

View File

@ -0,0 +1,4 @@
spring.data.mongodb.uri[test1]=mongodb://127.0.0.1:27017/test1
spring.data.mongodb.uri[test2]=mongodb://127.0.0.1:27018/test2
spring.data.mongodb.uri[test3]=mongodb://127.0.0.1:27019/test3
spring.data.mongodb.uri[test4]=mongodb://127.0.0.1:27020/test4

View File

@ -1,8 +1,17 @@
package site.cnkj.utils;
import com.mongodb.*;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import org.apache.commons.lang.StringUtils;
import org.bson.Document;
import site.cnkj.common.utils.io.DES;
import site.cnkj.common.utils.io.RSAEncrypt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CommonApplicationTests {
private static final String DEFAULT_PUBLIC_KEY=
@ -83,4 +92,59 @@ public class CommonApplicationTests {
}
}
private static HashMap<String, MongoDatabase> mongoClientDatabases = new HashMap<>();
private static String getDatabase(String url) {
String databaseName = "";
String substring = url.substring(10, url.length());
String[] split = substring.split("/");
String database = split[1];
if (database.contains("?")){
databaseName = database.split("\\?")[0];
}else {
databaseName = database;
}
return databaseName;
}
private static List<ServerAddress> createServerAddress(String url){
List<ServerAddress> serverAddresses = new ArrayList<>();
String substring = url.substring(10, url.length());
String[] split = substring.split("/");
String[] hosts = split[0].split(",", -1);
for (String host : hosts) {
if (StringUtils.isNotEmpty(host)){
String[] strings = host.split(":", -1);
ServerAddress serverAddress = new ServerAddress(strings[0], Integer.valueOf(strings[1]));
serverAddresses.add(serverAddress);
}
}
return serverAddresses;
}
private static void test3(){
String url = "mongodb://10.25.245.121:17017/log_storage_stable?connectTimeoutMS=50&maxPoolSize=5&waitQueueTimeoutMS=100&socketTimeoutMS=1000&maxIdleTimeMS=60000";
try {
//配制连接池
MongoClientOptions.Builder mongoClientBuilder = new MongoClientOptions.Builder();
mongoClientBuilder.connectionsPerHost(30);
mongoClientBuilder.connectTimeout(30000);
mongoClientBuilder.retryWrites(true);
//MongoClientOptions mongoClientOptions = mongoClientBuilder.build();
MongoClient mongoClient = new MongoClient(new MongoClientURI(url, mongoClientBuilder));
MongoDatabase mongoClientDatabase = mongoClient.getDatabase(getDatabase(url));
MongoCursor<Document> cursor = mongoClientDatabase.getCollection("a_10000_00062").find().limit(10).iterator();
while (cursor.hasNext()){
System.out.println(cursor.next().toJson());
}
}catch (MongoClientException e){
e.printStackTrace();
}
}
public static void main(String[] args) {
test3();
}
}