Commit b3c8aae9 authored by bbbytest's avatar bbbytest

initial commit

parent ba1a6ad1
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/commons-beanutils-1.9.2.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-dbcp2-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-dbutils-1.6.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.5.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/commons-pool2-2.4.2.jar"/>
<classpathentry kind="lib" path="lib/ezmorph-1.0.6.jar"/>
<classpathentry kind="lib" path="lib/httpclient-4.5.2.jar"/>
<classpathentry kind="lib" path="lib/httpcore-4.4.4.jar"/>
<classpathentry kind="lib" path="lib/jackson-annotations-2.8.0.jar"/>
<classpathentry kind="lib" path="lib/jackson-core-2.8.7.jar"/>
<classpathentry kind="lib" path="lib/jackson-databind-2.8.7.jar"/>
<classpathentry kind="lib" path="lib/json-lib-2.4-jdk15.jar"/>
<classpathentry kind="lib" path="lib/log4j-api-2.8.2.jar"/>
<classpathentry kind="lib" path="lib/log4j-core-2.8.2.jar"/>
<classpathentry kind="lib" path="lib/ojdbc6-11.1.0.6.0.jar"/>
<classpathentry kind="lib" path="lib/okhttp-2.5.0.jar"/>
<classpathentry kind="lib" path="lib/okio-1.6.0.jar"/>
<classpathentry kind="lib" path="lib/sqljdbc4-4.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
*.DS_Store
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/javadatasync.iml" filepath="$PROJECT_DIR$/javadatasync.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?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>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="73135178-3185-441b-abb9-835a8f20ef72" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/bin/" />
<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="FUSProjectUsageTrigger">
<session id="-1053414874">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.0" value="1" />
<entry key="project.open.time.1" value="1" />
<entry key="project.open.time.11" value="1" />
<entry key="project.open.time.13" value="1" />
<entry key="project.opened" value="4" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="Eclipse" value="2" />
<entry key="JAVA" value="147" />
<entry key="Properties" value="1" />
<entry key="XML" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="1839" />
<entry key="PLAIN_TEXT" value="8" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="JavaDemoTest.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="625">
<caret line="33" lean-forward="true" selection-start-line="33" selection-end-line="33" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SyncPositionJavaService.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncPositionJavaService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="24" column="28" selection-start-line="24" selection-start-column="28" selection-end-line="24" selection-end-column="28" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="GradeJavaModel.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="JavaConfig.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="50">
<caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="UserInfoJavaModel.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1800">
<caret line="72" column="28" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
</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>status</find>
<find>GenericDao</find>
<find>HttpClientUtil4Sync</find>
<find>HttpRequestUtil</find>
<find>HttpResultUtil</find>
<find>String result =</find>
<find>OKHttpUtils</find>
<find>ResultMsgEntity</find>
<find>SHA256Util</find>
<find>userService.userSync</find>
<find>.getID</find>
</findStrings>
<replaceStrings>
<replace>SyncDataJavaUtil</replace>
<replace>return</replace>
<replace>userService.users</replace>
<replace>.getId</replace>
</replaceStrings>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/datasync/model/UserInfoModel.java" />
<option value="$PROJECT_DIR$/src/datasync/model/OuInfoModel.java" />
<option value="$PROJECT_DIR$/src/datasync/model/PositionModel.java" />
<option value="$PROJECT_DIR$/src/datasync/model/GradeModel.java" />
<option value="$PROJECT_DIR$/src/datasync/common/SyncDataUtil.java" />
<option value="$PROJECT_DIR$/src/datasync/client/SutpcSyncService.java" />
<option value="$PROJECT_DIR$/src/datasync/model/OuInfoJavaModel.java" />
<option value="$PROJECT_DIR$/src/datasync/model/PositionJavaModel.java" />
<option value="$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java" />
<option value="$PROJECT_DIR$/src/datasync/common/HttpResultUtil.java" />
<option value="$PROJECT_DIR$/src/datasync/common/ResultMsgEntity.java" />
<option value="$PROJECT_DIR$/src/datasync/common/SyncDataJavaUtil.java" />
<option value="$PROJECT_DIR$/src/datasync/common/ResultEntity.java" />
<option value="$PROJECT_DIR$/src/datasync/common/SHA256Util.java" />
<option value="$PROJECT_DIR$/src/datasync/common/QidaSHA256.java" />
<option value="$PROJECT_DIR$/src/datasync/common/OKHttpUtils.java" />
<option value="$PROJECT_DIR$/src/datasync/common/OKHttp2Utils.java" />
<option value="$PROJECT_DIR$/src/datasync/service/AbstractSyncService.java" />
<option value="$PROJECT_DIR$/src/datasync/service/AbstractJavaSyncService.java" />
<option value="$PROJECT_DIR$/src/datasync/client/JavaSyncService.java" />
<option value="$PROJECT_DIR$/src/datasync/service/SyncOrgJavaService.java" />
<option value="$PROJECT_DIR$/src/datasync/model/GroupMapJavaModel.java" />
<option value="$PROJECT_DIR$/src/datasync/service/SyncUserJavaService.java" />
<option value="$PROJECT_DIR$/src/datasync/service/SyncPositionJavaService.java" />
<option value="$PROJECT_DIR$/src/datasync/common/ResultJavaEntity.java" />
<option value="$PROJECT_DIR$/src/datasync/service/AbstractSyncJavaService.java" />
<option value="$PROJECT_DIR$/src/datasync/client/JavaConfig.java" />
<option value="$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java" />
<option value="$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java" />
</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="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="503" />
<option name="y" value="21" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectId" id="1YYdFAVCFCXedZaaq3YBmihwVLN" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="AndroidView" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="datasync" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="datasync" type="462c0819:PsiDirectoryNode" />
<item name="client" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="datasync" type="462c0819:PsiDirectoryNode" />
<item name="common" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="datasync" type="462c0819:PsiDirectoryNode" />
<item name="model" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="javadatasync" type="b2602c69:ProjectViewProjectNode" />
<item name="javadatasync" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="datasync" type="462c0819:PsiDirectoryNode" />
<item name="service" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1583730917748" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="editor.preferences.tabs" />
</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">
<configuration name="JavaDemoTest" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="datasync.client.JavaDemoTest" />
<module name="javadatasync" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="datasync.client.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.JavaDemoTest" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="73135178-3185-441b-abb9-835a8f20ef72" name="Default Changelist" comment="" />
<created>1583123355339</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1583123355339</updated>
<workItem from="1583123362696" duration="8897000" />
<workItem from="1583197917093" duration="21872000" />
<workItem from="1583284938410" duration="29363000" />
<workItem from="1583457803278" duration="794000" />
<workItem from="1583727903804" duration="1399000" />
<workItem from="1583743098884" duration="2693000" />
<workItem from="1585906616526" duration="34000" />
<workItem from="1585907482007" duration="599000" />
<workItem from="1586345646082" duration="73000" />
<workItem from="1595293861777" duration="1120000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="57947000" />
</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="0" />
<window_info anchor="bottom" id="TODO" order="10" />
<window_info anchor="right" id="Palette&#9;" order="3" />
<window_info id="Image Layers" order="0" />
<window_info anchor="right" id="Capture Analysis" order="2" />
<window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
<window_info anchor="right" id="Maven Projects" order="5" />
<window_info anchor="bottom" id="Database Changes" order="6" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="0" show_stripe_button="false" />
<window_info anchor="bottom" id="Run" order="5" weight="0.19934994" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info id="Capture Tool" order="3" />
<window_info id="Designer" order="1" />
<window_info active="true" content_ui="combo" id="Project" order="5" visible="true" weight="0.1684435" />
<window_info anchor="right" id="Database" order="4" />
<window_info anchor="right" id="Structure" order="9" side_tool="true" visible="true" weight="0.23933902" />
<window_info anchor="right" id="Ant Build" order="7" weight="0.25" />
<window_info id="UI Designer" order="2" />
<window_info anchor="right" id="Theme Preview" order="1" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.30010834" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="Messages" order="11" weight="0.32936078" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="6" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Message" order="3" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Find" order="4" weight="0.32936078" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="WindowStateProjectService">
<state x="520" y="113" key="#com.intellij.ide.util.MemberChooser" timestamp="1583139959788">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="520" y="113" key="#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824" timestamp="1583139959788" />
<state x="242" y="109" key="SettingsEditor" timestamp="1583140422228">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="242" y="109" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1583140422228" />
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1583143318344">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1583143318344" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1800">
<caret line="72" column="28" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="50">
<caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="275">
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1800">
<caret line="72" column="28" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="275">
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1800">
<caret line="72" column="28" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" lean-forward="true" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="275">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="6" column="60" selection-start-line="6" selection-start-column="60" selection-end-line="6" selection-end-column="60" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncOrgService.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncUserService.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncPositionService.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserGradeModel.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/client/Config.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/GenericDao.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/HttpClientUtil4Sync.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/HttpRequestUtil.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/HttpResultUtil.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/JdbcUtil.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/JsonUtil.java" />
<entry file="file://$PROJECT_DIR$/src/datasync/common/ResultMsgEntity.java" />
<entry file="file://$PROJECT_DIR$/src/jdbc.properties" />
<entry file="file://$PROJECT_DIR$/.project" />
<entry file="file://$PROJECT_DIR$/.classpath" />
<entry file="file://$PROJECT_DIR$/src/datasync/model/GroupMapJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="723">
<caret line="43" lean-forward="true" selection-start-line="2" selection-start-column="32" selection-end-line="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/OuInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="723">
<caret line="176" lean-forward="true" selection-start-line="5" selection-start-column="30" selection-end-line="176" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/PositionJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="723">
<caret line="108" lean-forward="true" selection-start-line="2" selection-start-column="32" selection-end-line="108" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="4" column="13" selection-start-line="4" selection-start-column="13" selection-end-line="4" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaSyncService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="25" column="20" lean-forward="true" selection-start-line="25" selection-start-column="20" selection-end-line="25" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/common/ResultJavaEntity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="700">
<caret line="36" column="5" selection-start-line="36" selection-start-column="5" selection-end-line="36" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/common/SyncDataJavaUtil.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448">
<caret line="49" column="5" selection-start-line="49" selection-start-column="5" selection-end-line="49" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/common/QidaSHA256.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="5" column="25" selection-start-line="5" selection-start-column="25" selection-end-line="5" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/common/OKHttp2Utils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncUserJavaService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="798">
<caret line="66" column="35" selection-start-line="66" selection-start-column="35" selection-end-line="66" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncOrgJavaService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="11" column="33" selection-start-line="11" selection-start-column="33" selection-end-line="11" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/service/AbstractSyncJavaService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="175">
<caret line="28" column="47" selection-start-line="28" selection-start-column="47" selection-end-line="28" selection-end-column="47" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/GradeJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="550">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/model/UserInfoJavaModel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1800">
<caret line="72" column="28" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="50">
<caret line="2" column="17" selection-start-line="2" selection-start-column="17" selection-end-line="2" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/service/SyncPositionJavaService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="400">
<caret line="24" column="28" selection-start-line="24" selection-start-column="28" selection-end-line="24" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/datasync/client/JavaDemoTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="625">
<caret line="33" lean-forward="true" selection-start-line="33" selection-end-line="33" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>javadatasync</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>javadatasync</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">
<Properties>
<!-- 配置日志文件输出目录 -->
<Property name="LOG_HOME">D:/YunXueTang/log</Property>
<property name="FILE_NAME">synclog</property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %logger{36} - %m%n" />
</Console>
<RollingFile name="RollingFileLog" fileName="${LOG_HOME}/${FILE_NAME}.log"
filePattern="${LOG_HOME}/$${date:yyyy}/${FILE_NAME}-%d{yyyy-MM}-%i.log">
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %logger{36} - %m%n" />
<!-- 配置日志文件按月保存 结合filePattern属性值进行时间间隔控制 -->
<TimeBasedTriggeringPolicy interval="1" />
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<!-- <AppenderRef ref="Console" /> -->
<AppenderRef ref="RollingFileLog" />
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/lib/httpclient-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpcore-4.4.4.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-annotations-2.8.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-core-2.8.7.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-databind-2.8.7.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/json-lib-2.4-jdk15.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/log4j-api-2.8.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/log4j-core-2.8.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-codec-1.9.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-beanutils-1.9.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-lang-2.5.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-logging-1.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/ezmorph-1.0.6.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-collections-3.2.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-dbcp2-2.1.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-dbutils-1.6.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-pool2-2.4.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/sqljdbc4-4.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/ojdbc6-11.1.0.6.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/okhttp-2.5.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/okio-1.6.0.jar!/" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
<src_folder value="file://$MODULE_DIR$/lib" expected_position="1" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
<orderEntry type="module-library">
<library name="httpclient-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpclient-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpcore-4.4.4.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpcore-4.4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-annotations-2.8.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-annotations-2.8.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-core-2.8.7.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-core-2.8.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-databind-2.8.7.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-databind-2.8.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="json-lib-2.4-jdk15.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/json-lib-2.4-jdk15.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="log4j-api-2.8.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/log4j-api-2.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="log4j-core-2.8.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/log4j-core-2.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-codec-1.9.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-codec-1.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-beanutils-1.9.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-beanutils-1.9.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-lang-2.5.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-lang-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-logging-1.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-logging-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="ezmorph-1.0.6.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/ezmorph-1.0.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-collections-3.2.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-collections-3.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-dbcp2-2.1.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-dbcp2-2.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-dbutils-1.6.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-dbutils-1.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-pool2-2.4.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-pool2-2.4.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="sqljdbc4-4.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/sqljdbc4-4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="ojdbc6-11.1.0.6.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/ojdbc6-11.1.0.6.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="okhttp-2.5.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/okhttp-2.5.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="okio-1.6.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/okio-1.6.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
package datasync.client;
public interface JavaConfig {
}
package datasync.client;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import datasync.common.ResultJavaEntity;
import datasync.model.GradeJavaModel;
import datasync.model.GroupMapJavaModel;
import datasync.model.OuInfoJavaModel;
import datasync.model.PositionJavaModel;
import datasync.model.UserInfoJavaModel;
import datasync.service.SyncOrgJavaService;
import datasync.service.SyncPositionJavaService;
import datasync.service.SyncUserJavaService;
public class JavaDemoTest implements JavaConfig {
static String connectionUrl = "jdbc:sqlserver://120.79.0.56:6004;database=ZTHR;user=sa;password=Essen999;";
/**
* Development
*/
static String apikey = "b596e7ed-7f23-4387-8d00-18a16f05ed56";
static String secretkey = "a9433f89-37ff-43c8-84c2-fd855dc0106e";
static String baseUrl = "http://api-udp-adel.yunxuetang.com.cn/v1/";
public static void main(String[] args) throws IOException {
if (args.length > 0) {
System.out.println(args.length);
connectionUrl = args[0];
if (args.length > 2 && "official".equals(args[1])) {
/**
* Official
*/
apikey = "bf3552c7-a0af-497d-8c11-6005dfb299ee";
secretkey = "2db4a86a-0a5e-44e4-8402-978e16274356";
baseUrl = "https://api-qidac1.yunxuetang.cn/v1/";
}
}
System.out.println("----- Environment -----");
System.out.println("connectionUrl :: " + connectionUrl);
System.out.println("baseUrl :: " + baseUrl);
System.out.println("apikey :: " + apikey);
System.out.println("secretkey :: " + secretkey);
new JavaDemoTest();
}
public JavaDemoTest() throws IOException {
ResultSet resultSet = null;
try (Connection connection = DriverManager.getConnection(connectionUrl);
Statement statement = connection.createStatement();) {
System.out.println("----- Sync Orgs -----");
List<OuInfoJavaModel> orgs = new ArrayList<OuInfoJavaModel>();
OuInfoJavaModel org = new OuInfoJavaModel();
String selectSql = "select Depcode,Title,'0' as AdminCode\r\n" + "from oDepartment\r\n"
+ "where AdminId is null and isDisabled is null\r\n" + "UNION\r\n"
+ "select a.Depcode,a.Title,b.depcode as AdminCode\r\n" + "from \r\n"
+ "(select DepCode,Title,AdminID\r\n" + "from oDepartment\r\n"
+ "where AdminId is not null and isDisabled is null) a \r\n"
+ "left join oDepartment b on a.adminid=b.depId";
// System.out.println("selectSql : "+selectSql);
resultSet = statement.executeQuery(selectSql);
// Print results from select statement
while (resultSet.next()) {
// System.out.println(resultSet.getString(1)+" , "+resultSet.getString(2)+" , "+resultSet.getString(3));
org = new OuInfoJavaModel();
org.setId(resultSet.getString(1));
org.setOuName(resultSet.getString(2));
if ("0".equals(resultSet.getString(3)) || null == resultSet.getString(3))
org.setParentId("");
else
org.setParentId(resultSet.getString(3));
orgs.add(org);
}
syncOUs(orgs);
System.out.println("----- Sync User -----");
// Create and execute a SELECT SQL statement.
selectSql = "select c.badge,SUBSTRING(email,1, CHARINDEX('@', email) - 1) username,c.name,c.Depcode\r\n"
+ "from\r\n" + "(select a.*,b.DepAbbr,b.Depcode\r\n" + "from eemployee a , oDepartment b\r\n"
+ "where \r\n" + "a.depid = b.depid and a.empstatus=1 and a.email is not null) c ";
resultSet = statement.executeQuery(selectSql);
List<UserInfoJavaModel> users = new ArrayList<UserInfoJavaModel>();
List<String> usernames = new ArrayList<String>();
UserInfoJavaModel user = new UserInfoJavaModel();
// Print results from select statement
while (resultSet.next()) {
// System.out.println(resultSet.getString(1)+" , "+resultSet.getString(2)+" , "+resultSet.getString(3)+" , "+resultSet.getString(4));
// 根据id改username可以,根据username改id不可以(id为空时可以)
user = new UserInfoJavaModel();
user.setId(resultSet.getString(1));
user.setUserName(resultSet.getString(2));
user.setCnName(resultSet.getString(3));
user.setOrgOuCode(resultSet.getString(4));
users.add(user);
usernames.add(resultSet.getString(2));
}
int size = users.size();
System.out.println("Size: " + size);
for (int i = 0; i < size / 100 + 1; i++) {
int from = i * 100, to = (i + 1) * 100;
if (i == size / 100)
to = size;
List<UserInfoJavaModel> partUsers = users.subList(from, to);
List<String> partUN = usernames.subList(from, to);
System.out.println("Synced from " + from + " to " + to);
syncUsers(partUsers);
syncEnableUsers(partUN);
System.out.println("================");
}
System.out.println("----- Sync Deleted User -----");
// Create and execute a SELECT SQL statement.
selectSql = "select c.badge,SUBSTRING(email,1, CHARINDEX('@', email) - 1) username,c.name,c.Depcode\r\n"
+ "from\r\n" + "(select a.*,b.DepAbbr,b.Depcode\r\n" + "from eemployee a , oDepartment b\r\n"
+ "where \r\n" + "a.depid = b.depid and a.empstatus=2 and a.email is not null) c ";
resultSet = statement.executeQuery(selectSql);
usernames = new ArrayList<String>();
// Print results from select statement
while (resultSet.next()) {
// System.out.println(resultSet.getString(2) + " , " + resultSet.getString(3));
usernames.add(resultSet.getString(2));
}
syncDeletedUsers(usernames);
System.out.println("----- Sync Deleted Orgs -----");
List<String> ouCodes = new ArrayList<String>();
selectSql = "select Depcode,Title,'0' as AdminCode\r\n" + "from oDepartment\r\n"
+ "where AdminId is null and isDisabled is not null\r\n" + "UNION\r\n"
+ "select a.Depcode,a.Title,b.depcode as AdminCode\r\n" + "from \r\n"
+ "(select DepCode,Title,AdminID\r\n" + "from oDepartment\r\n"
+ "where AdminId is null and isDisabled is not null) a \r\n"
+ "left join oDepartment b on a.adminid=b.depId";
resultSet = statement.executeQuery(selectSql);
// Print results from select statement
while (resultSet.next()) {
ouCodes.add(resultSet.getString(1));
}
for (String model : ouCodes) {
System.out.println(model);
}
syncDeletedOUs(ouCodes);
} catch (SQLException e) {
e.printStackTrace();
}
// 同步组织单位:
// ousTest();
// 同步删除组织单位:
// deleteousTest();
// 将用户从组织单位中移除
// removeusersfromouTest();
// 将一批用户移动至新部门
// batchchangeorgouTest();
// 同步设置部门主管
// setmanagerTest();
// 同步用户
// usersTest();
// 同步禁用用户
// disabledusersTest();
// 同步启用用户
// enabledusersTest();
// 同步校验用户是否存在
// checkusersTest();
// 同步角色删除人员
// roledeleteuserTest();
// 同步角色增加人员
// roleadduserTest();
// 自动建用户组
// groupaddTest();
// 用户组添加人员
// groupMapAddTest();
// 用户组删除人员
// groupMapDelTest();
// 同步增加直属经理
// addmgrTest();
// 同步更新直属经理
// updmgrTest();
// 同步删除直属经理
// delmgrTest();
// 同步岗位
// positionTest();
// 同步职级
// updategradeTest();
// 同步更改岗位名称
// updatePositionInfoTest();
// 更新用户Job名称
// updateUserJobTest();
// 查询岗位编号
// getPnoByPnameTest();
}
private void syncEnableUsers(List<String> usernames) throws IOException {
usernames.remove(null);
SyncUserJavaService service = new SyncUserJavaService();
ResultJavaEntity result = service.enabledusers(usernames, apikey, secretkey, baseUrl);
System.out.println(result);
}
private void syncDeletedUsers(List<String> usernames) throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
ResultJavaEntity result = service.disabledusers(usernames, apikey, secretkey, baseUrl);
System.out.println(result);
}
private void syncDeletedOUs(List<String> ouCodes) throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
ResultJavaEntity result = service.deleteous(ouCodes, apikey, secretkey, baseUrl);
System.out.println(result);
}
/**
* 組織同步
*
* @param orgs
* @throws IOException
*/
void syncOUs(List<OuInfoJavaModel> orgs) throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
ResultJavaEntity result = service.ous(1, orgs, apikey, secretkey, baseUrl);
System.out.println(result);
}
void ousTest() throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
List<OuInfoJavaModel> orgs = new ArrayList<OuInfoJavaModel>();
OuInfoJavaModel org = new OuInfoJavaModel();
org = new OuInfoJavaModel();
org.setId("000001");
org.setOuName("公司领导");
org.setParentId("");
orgs.add(org);
ResultJavaEntity result = service.ous(1, orgs, apikey, secretkey, baseUrl);
System.out.println(result);
}
void deleteousTest() throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
List<String> ouCodes = new ArrayList<>();
ouCodes.add("");
ResultJavaEntity result = service.deleteous(ouCodes, apikey, secretkey, baseUrl);
System.out.println(result);
}
void removeusersfromouTest() throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
List<String> userNames = new ArrayList<String>();
userNames.add("");
ResultJavaEntity result = service.removeusersfromou(userNames, apikey, secretkey, baseUrl);
System.out.println(result);
}
void batchchangeorgouTest() throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
List<String> userNames = new ArrayList<String>();
userNames.add("user01");
String ouCode = "1111";
ResultJavaEntity result = service.batchchangeorgou(userNames, ouCode, apikey, secretkey, baseUrl);
System.out.println(result);
}
void setmanagerTest() throws IOException {
SyncOrgJavaService service = new SyncOrgJavaService();
// id或username都可以
String userName = "";
String ouCode = "";
int isCancelManager = 1;
ResultJavaEntity result = service.setmanager(userName, ouCode, isCancelManager, apikey, secretkey, baseUrl);
System.out.println(result);
}
void createusersTest() throws IOException {
// 只能新增不能更新
SyncUserJavaService service = new SyncUserJavaService();
List<UserInfoJavaModel> users = new ArrayList<UserInfoJavaModel>();
UserInfoJavaModel user = new UserInfoJavaModel();
user.setId("");
user.setUserName("");
user.setCnName("");
users.add(user);
ResultJavaEntity result = service.createusers(1, users, apikey, secretkey, baseUrl);
System.out.println(result);
}
/**
* 同步用戶
*
* @param users
* @throws IOException
*/
void syncUsers(List<UserInfoJavaModel> users) throws IOException {
// 能新增能更新
SyncUserJavaService service = new SyncUserJavaService();
ResultJavaEntity result = service.users(1, users, apikey, secretkey, baseUrl);
System.out.println(result);
}
// 根据id改username可以,根据username改id不可以(id为空时可以)
void usersTest() throws IOException {
// 能新增能更新
SyncUserJavaService service = new SyncUserJavaService();
List<UserInfoJavaModel> users = new ArrayList<UserInfoJavaModel>();
UserInfoJavaModel user = new UserInfoJavaModel();
// 根据id改username可以,根据username改id不可以(id为空时可以)
user = new UserInfoJavaModel();
user.setId("00321");
user.setUserName("jasonchen");
user.setCnName("陳俊宏");
user.setOrgOuCode("000048");
users.add(user);
ResultJavaEntity result = service.users(1, users, apikey, secretkey, baseUrl);
System.out.println(result);
}
void disabledusersTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> userNames = new ArrayList<String>();
// id或username都可以
userNames.add("");
ResultJavaEntity result = service.disabledusers(userNames, apikey, secretkey, baseUrl);
System.out.println(result);
}
void enabledusersTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> userNames = new ArrayList<String>();
// id或username都可以
userNames.add("shidong.fang");
ResultJavaEntity result = service.enabledusers(userNames, apikey, secretkey, baseUrl);
System.out.println(result);
}
void checkusersTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> userNames = new ArrayList<String>();
userNames.add("user01");
ResultJavaEntity result = service.checkusers(userNames, apikey, secretkey, baseUrl);
System.out.println(result);
}
void roledeleteuserTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> userNames = new ArrayList<String>();
// id或username都可以
userNames.add("");
String roleNo = "";
ResultJavaEntity result = service.roledeleteuser(userNames, roleNo, apikey, secretkey, baseUrl);
System.out.println(result);
}
void roleadduserTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> userNames = new ArrayList<String>();
// id或username都可以
userNames.add("");
String roleNo = "";
ResultJavaEntity result = service.roleadduser(userNames, roleNo, apikey, secretkey, baseUrl);
System.out.println(result);
}
void groupaddTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<GroupMapJavaModel> groupMaps = new ArrayList<GroupMapJavaModel>();
String groupName = "";
String remark = "";
GroupMapJavaModel groupMap = new GroupMapJavaModel();
groupMap.setMasterNo("");
groupMap.setMasterType("");
groupMaps.add(groupMap);
ResultJavaEntity result = service.groupadd(groupMaps, groupName, remark, apikey, secretkey, baseUrl);
System.out.println(result);
}
void groupMapAddTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> masterNos = new ArrayList<String>();
// 人员传id,用户组id是主键id
masterNos.add("");
String groupId = "";
String mapType = "";
ResultJavaEntity result = service.groupMapAdd(masterNos, groupId, mapType, apikey, secretkey, baseUrl);
System.out.println(result);
}
void groupMapDelTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> masterNos = new ArrayList<String>();
// 人员传id,用户组id是主键id
masterNos.add("");
String groupId = "";
String mapType = "";
ResultJavaEntity result = service.groupMapDel(masterNos, groupId, mapType, apikey, secretkey, baseUrl);
System.out.println(result);
}
void addmgrTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<UserInfoJavaModel> users = new ArrayList<UserInfoJavaModel>();
UserInfoJavaModel user = new UserInfoJavaModel();
// 员工和经理都传id
user.setId("");
user.setManagerNo("");
users.add(user);
ResultJavaEntity result = service.addmgr(users, apikey, secretkey, baseUrl);
System.out.println(result);
}
void updmgrTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<UserInfoJavaModel> users = new ArrayList<UserInfoJavaModel>();
UserInfoJavaModel user = new UserInfoJavaModel();
// 员工和经理都传id
user.setId("");
user.setManagerNo("");
users.add(user);
ResultJavaEntity result = service.updmgr(users, apikey, secretkey, baseUrl);
System.out.println(result);
}
void delmgrTest() throws IOException {
SyncUserJavaService service = new SyncUserJavaService();
List<String> users = new ArrayList<String>();
// 员工传id
users.add("");
ResultJavaEntity result = service.delmgr(users, apikey, secretkey, baseUrl);
System.out.println(result);
}
void positionTest() throws IOException {
SyncPositionJavaService service = new SyncPositionJavaService();
List<PositionJavaModel> positions = new ArrayList<PositionJavaModel>();
PositionJavaModel position = new PositionJavaModel();
position.setpNo("");
position.setpNames("");
positions.add(position);
ResultJavaEntity result = service.position(positions, apikey, secretkey, baseUrl);
System.out.println(result);
}
void updategradeTest() throws IOException {
SyncPositionJavaService service = new SyncPositionJavaService();
List<GradeJavaModel> grades = new ArrayList<GradeJavaModel>();
GradeJavaModel grade = new GradeJavaModel();
grade.setId("");
grade.setName("");
grades.add(grade);
ResultJavaEntity result = service.updategrade(grades, apikey, secretkey, baseUrl);
System.out.println(result);
}
void updatePositionInfoTest() throws IOException {
SyncPositionJavaService service = new SyncPositionJavaService();
String positionNo = "";
// 不带分类
String positionName = "";
ResultJavaEntity result = service.updatePositionInfo(positionNo, positionName, apikey, secretkey, baseUrl);
System.out.println(result);
}
void getPnoByPnameTest() throws IOException {
SyncPositionJavaService service = new SyncPositionJavaService();
// 需带分类
String positionName = "";
ResultJavaEntity result = service.getPnoByPname(positionName, apikey, secretkey, baseUrl);
System.out.println(result);
}
}
package datasync.client;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import datasync.model.OuInfoJavaModel;
import datasync.model.PositionJavaModel;
import datasync.model.UserInfoJavaModel;
import datasync.service.AbstractSyncJavaService;
import java.util.List;
public class JavaSyncService extends AbstractSyncJavaService implements JavaConfig {
// 全量增量区分
private static final String MODE_FULL = "1";
private static final String MODE_UPDATE = "2";
private String syncServiceName;
// json解析用
private ObjectMapper mapper;
public JavaSyncService() {
super.setApikey(JavaDemoTest.apikey);
super.setSecretkey(JavaDemoTest.secretkey);
super.setBaseUrl(JavaDemoTest.baseUrl);
super.setModeFull(MODE_FULL);
super.setModeUpdate(MODE_UPDATE);
super.setIsPosIdProvided(false);
syncServiceName = this.getClass().getSimpleName();
super.setSyncServiceName(syncServiceName);
// 创建用于json反序列化的对象
mapper = new ObjectMapper();
// 忽略json中多余的属性字段
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
}
@Override
protected List<PositionJavaModel> getPositionsFromDB() throws Exception {
return null;
}
@Override
protected List<OuInfoJavaModel> getOuInfoListFromDB() throws Exception {
return null;
}
@Override
protected List<UserInfoJavaModel> getUserInfoListFromDB() throws Exception {
return null;
}
@Override
protected boolean isOrgExpired(OuInfoJavaModel org) {
return false;
}
@Override
protected boolean isPosExpired(PositionJavaModel pos) {
return false;
}
@Override
protected boolean isUserExpired(UserInfoJavaModel user) {
return false;
}
@Override
protected void setRootOrgParentId(List<OuInfoJavaModel> newList) {
}
@Override
protected void changePropValues(List<UserInfoJavaModel> newList) {
}
@Override
protected List<OuInfoJavaModel> getOuInfoModelList(String mode) throws Exception {
return null;
}
@Override
protected List<PositionJavaModel> getPositionModelList(String mode) throws Exception {
return null;
}
@Override
protected List<UserInfoJavaModel> getUserInfoModelList(String mode) throws Exception {
return null;
}
}
package datasync.common;
import com.squareup.okhttp.*;
import java.io.IOException;
public class OKHttp2Utils {
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
public static final String HTTP_200_STATUS = "200";
public static String sendPost(String url, String param) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, param);
Request request = new Request.Builder().url(url).post(body).build();
Response response = client.newCall(request).execute();
// if (response.isSuccessful()) {
// String code = String.valueOf(response.code());
// return StringUtils.isEmpty(code) ? HTTP_200_STATUS : code;
// }
return response.body().string();
}
}
package datasync.common;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class QidaSHA256 {
public static final String ALGORITHM = "SHA-256";
public static String SHA256Encrypt(String orignal) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(ALGORITHM);
} catch (NoSuchAlgorithmException e) {
// TODO
e.printStackTrace();
}
if (null != md) {
byte[] origBytes = orignal.getBytes();
md.update(origBytes);
byte[] digestRes = md.digest();
String digestStr = getDigestStr(digestRes);
return digestStr;
}
return null;
}
private static String getDigestStr(byte[] origBytes) {
String tempStr = null;
StringBuilder stb = new StringBuilder();
for (int i = 0; i < origBytes.length; i++) {
// System.out.println("and by bit: " + (origBytes[i] & 0xff));
// System.out.println("no and: " + origBytes[i]);
// System.out.println("---------------------------------------------");
// 这里按位与是为了把字节转整时候取其正确的整数,java中一个int是4个字节
// 如果origBytes[i]最高位为1,则转为int时,int的前三个字节都被1填充了
tempStr = Integer.toHexString(origBytes[i] & 0xff);
if (tempStr.length() == 1) {
stb.append("0");
}
stb.append(tempStr);
}
return stb.toString();
}
}
\ No newline at end of file
package datasync.common;
/**
* 调用接口统一返回格式
*/
public class ResultJavaEntity {
/**
* 记录总条数
*/
private int result;
/**
* 返回提示
*/
private String msg;
/**
* 成功执行后返回的数据(Json格式字符串)
*/
private String data;
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public String toString() {
return "ResultJavaEntity [result=" + result + ", msg=" + msg + ", data=" + data + "]";
}
}
package datasync.common;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.util.List;
import java.util.Random;
public class SyncDataJavaUtil {
/**
* 获取企业大学接口数据
*
* @param url
* @param params
* @return
* @throws IOException
*/
public static ResultJavaEntity getResult(String url, String params) throws IOException {
String result = null;
try {
result = OKHttp2Utils.sendPost(url, params);
} catch (IOException e) {
try {
// 发生异常重新请求一次
result = OKHttp2Utils.sendPost(url, params);
} catch (IOException e1) {
throw new IOException("获取企业大学接口数据失败!", e1);
}
}
// 统一将返回值封装为实体
JSONObject jsonObject = JSONObject.fromObject(result);
System.out.println(result);
return (ResultJavaEntity) JSONObject.toBean(jsonObject, ResultJavaEntity.class);
}
/**
* 初始化公共参数
*
* @param apikey
* @param secretkey
* @return
*/
public static JSONObject getPublicParam(String apikey, String secretkey) {
JSONObject params = new JSONObject();
params.put("apikey", apikey);
params.put("salt", new Random().nextInt(10000));
params.put("signature", QidaSHA256.SHA256Encrypt(secretkey + params.get("salt")));
return params;
}
public static ResultJavaEntity arrayOp(List<String> strings, String url, String apikey, String secretkey)
throws IOException {
JSONObject params = getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(strings);
params.put("datas", array.toString());
return SyncDataJavaUtil.getResult(url, params.toString());
}
}
package datasync.main;
import datasync.client.JavaSyncService;
public class Main {
public static void main(String[] args) {
// 同步基础数据
new JavaSyncService().execute();
}
}
package datasync.model;
public class GradeJavaModel {
/**
* 职级编号
*/
private String id;
/**
* 职级名称
*/
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GradeJavaModel that = (GradeJavaModel) o;
return name.equals(that.name);
}
@Override
public int hashCode() {
return name.hashCode();
}
}
package datasync.model;
public class GroupMapJavaModel {
/**
* 关系数据信息(人员账号或部门编号或岗位编号)格式如:["cuim@yunxuetang.cn","user001","user002"]
*/
private String masterNo;
/**
* 关系类型(固定值 部门:Department,岗位:Position,用户:User)
*/
private String masterType;
/**
* 是否包含子部门(仅限部门类型)
*/
private int isContainSub = 0;
public String getMasterNo() {
return masterNo;
}
public void setMasterNo(String masterNo) {
this.masterNo = masterNo;
}
public String getMasterType() {
return masterType;
}
public void setMasterType(String masterType) {
this.masterType = masterType;
}
public int getIsContainSub() {
return isContainSub;
}
public void setIsContainSub(int isContainSub) {
this.isContainSub = isContainSub;
}
}
package datasync.model;
import java.util.Date;
import java.util.List;
public class OuInfoJavaModel {
/**
* 组织单位ID
*/
private String id;
/**
* 组织单位名称
*/
private String ouName;
/**
* 父节点ID
*/
private String parentId;
/**
* 描述
*/
private String description;
/**
* 组织单位下的用户名集合
*/
private List<String> users;
/**
* 是否分支机构
*/
private boolean isSub;
/**
* 排序索引
*/
private int orderIndex;
/**
* 过期日期
*/
private Date endDate;
/**
* 组织状态
*/
private String status;
/**
* 组织删除状态
*/
private String deleteStatus;
/**
* 部门主管
*/
private String managerNo;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOuName() {
return ouName;
}
public void setOuName(String ouName) {
this.ouName = ouName;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<String> getUsers() {
return users;
}
public void setUsers(List<String> users) {
this.users = users;
}
public boolean isSub() {
return isSub;
}
public void setSub(boolean sub) {
isSub = sub;
}
public int getOrderIndex() {
return orderIndex;
}
public void setOrderIndex(int orderIndex) {
this.orderIndex = orderIndex;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(String deleteStatus) {
this.deleteStatus = deleteStatus;
}
public String getManagerNo() {
return managerNo;
}
public void setManagerNo(String managerNo) {
this.managerNo = managerNo;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.toLowerCase().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OuInfoJavaModel other = (OuInfoJavaModel) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equalsIgnoreCase(other.id))
return false;
return true;
}
}
package datasync.model;
public class PositionJavaModel {
/**
* 岗位编号
*/
private String pNo;
/**
* 一级类别;二级类别;岗位 (最后是岗位)
*/
private String pNames;
/**
* 岗位类别
*/
private String pNameClass;
/**
* 岗位状态
*/
private String status;
/**
* 岗位删除状态
*/
private String deleteStatus;
/**
* 岗位职级名称
*/
private String positionGradeName;
public String getpNo() {
return pNo;
}
public void setpNo(String pNo) {
this.pNo = pNo;
}
public String getpNames() {
return pNames;
}
public void setpNames(String pNames) {
this.pNames = pNames;
}
public String getpNameClass() {
return pNameClass;
}
public void setpNameClass(String pNameClass) {
this.pNameClass = pNameClass;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(String deleteStatus) {
this.deleteStatus = deleteStatus;
}
public String getPositionGradeName() {
return positionGradeName;
}
public void setPositionGradeName(String positionGradeName) {
this.positionGradeName = positionGradeName;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((pNo == null) ? 0 : pNo.toLowerCase().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PositionJavaModel other = (PositionJavaModel) obj;
if (pNo == null) {
if (other.pNo != null)
return false;
} else if (!pNo.equalsIgnoreCase(other.pNo))
return false;
return true;
}
}
package datasync.model;
public class UserInfoJavaModel {
/**
* 用户ID(同步必传)
*/
private String id;
/**
* 用户名(同步必传)
*/
private String userName;
/**
* 中文姓名(同步必传)
*/
private String cnName;
/**
* 工号
*/
private String userNo;
/**
* 密码备注:如果用MD5或者CMD5加密则必须使用标准MD5 32位小写加密的字符串(如果不传使用平台配置的默认密码)
*/
private String password;
/**
* 密码加密方式: YXT(云学堂加密默认)、MD5 (密码MD5加密)、CMD5(用户名+密码MD5加密)
*/
private String encryptionType;
/**
* 性别
*/
private String sex;
/**
* 移动电话
*/
private String mobile;
/**
* 电子邮件
*/
private String mail;
/**
* 部门编号
*/
private String orgOuCode;
/**
* 部门名称
*/
private String orgOuName;
/**
* 岗位编号
*/
private String postionNo;
/**
* 岗位名
*/
private String postionName;
/**
* 入职日期
*/
private String entrytime;
/**
* 出生日期
*/
private String birthday;
/**
* 过期日期
*/
private String expiredDate;
/**
* 用户状态
*/
private String status;
/**
* 用户删除状态
*/
private String deleteStatus;
/**
* 是否是部门主管
*/
private int isManager = 0;
/**
* 直属经理
*/
private String managerNo;
/**
* 职级
*/
private String gradeName;
/**
* 是否置空邮箱、手机号
*/
private int isUpdateNull = 0;
/**
* 是否需要绑定手机(0:不需要,1:需要) 默认设置为自动绑定手机号 如果不需要绑定可单独将该字段设置为0
*/
private int isMobileValidated = 1;
/**
* 是否需要绑定邮箱(0:不需要,1:需要) 默认设置为自动绑定邮箱 如果不需要绑定可单独将该字段设置为0
*/
private int isEmailValidated = 1;
/**
* 扩展字段 1~10
*/
private String spare1;
private String spare2;
private String spare3;
private String spare4;
private String spare5;
private String spare6;
private String spare7;
private String spare8;
private String spare9;
private String spare10;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getUserNo() {
return userNo;
}
public void setUserNo(String userNo) {
this.userNo = userNo;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEncryptionType() {
return encryptionType;
}
public void setEncryptionType(String encryptionType) {
this.encryptionType = encryptionType;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getOrgOuCode() {
return orgOuCode;
}
public void setOrgOuCode(String orgOuCode) {
this.orgOuCode = orgOuCode;
}
public String getOrgOuName() {
return orgOuName;
}
public void setOrgOuName(String orgOuName) {
this.orgOuName = orgOuName;
}
public String getPostionNo() {
return postionNo;
}
public void setPostionNo(String postionNo) {
this.postionNo = postionNo;
}
public String getPostionName() {
return postionName;
}
public void setPostionName(String postionName) {
this.postionName = postionName;
}
public String getEntrytime() {
return entrytime;
}
public void setEntrytime(String entrytime) {
this.entrytime = entrytime;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getExpiredDate() {
return expiredDate;
}
public void setExpiredDate(String expiredDate) {
this.expiredDate = expiredDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(String deleteStatus) {
this.deleteStatus = deleteStatus;
}
public int getIsManager() {
return isManager;
}
public void setIsManager(int isManager) {
this.isManager = isManager;
}
public String getManagerNo() {
return managerNo;
}
public void setManagerNo(String managerNo) {
this.managerNo = managerNo;
}
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public int getIsUpdateNull() {
return isUpdateNull;
}
public void setIsUpdateNull(int isUpdateNull) {
this.isUpdateNull = isUpdateNull;
}
public int getIsMobileValidated() {
return isMobileValidated;
}
public void setIsMobileValidated(int isMobileValidated) {
this.isMobileValidated = isMobileValidated;
}
public int getIsEmailValidated() {
return isEmailValidated;
}
public void setIsEmailValidated(int isEmailValidated) {
this.isEmailValidated = isEmailValidated;
}
public String getSpare1() {
return spare1;
}
public void setSpare1(String spare1) {
this.spare1 = spare1;
}
public String getSpare2() {
return spare2;
}
public void setSpare2(String spare2) {
this.spare2 = spare2;
}
public String getSpare3() {
return spare3;
}
public void setSpare3(String spare3) {
this.spare3 = spare3;
}
public String getSpare4() {
return spare4;
}
public void setSpare4(String spare4) {
this.spare4 = spare4;
}
public String getSpare5() {
return spare5;
}
public void setSpare5(String spare5) {
this.spare5 = spare5;
}
public String getSpare6() {
return spare6;
}
public void setSpare6(String spare6) {
this.spare6 = spare6;
}
public String getSpare7() {
return spare7;
}
public void setSpare7(String spare7) {
this.spare7 = spare7;
}
public String getSpare8() {
return spare8;
}
public void setSpare8(String spare8) {
this.spare8 = spare8;
}
public String getSpare9() {
return spare9;
}
public void setSpare9(String spare9) {
this.spare9 = spare9;
}
public String getSpare10() {
return spare10;
}
public void setSpare10(String spare10) {
this.spare10 = spare10;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UserInfoJavaModel other = (UserInfoJavaModel) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
package datasync.service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import datasync.common.ResultJavaEntity;
import datasync.model.OuInfoJavaModel;
import datasync.model.PositionJavaModel;
import datasync.model.UserInfoJavaModel;
/**
* 抽象同步Service类, 提供有一些共通的同步用方法。此类只作简单同步继承使用, 复杂逻辑同步可自行实现不需要继承该类
*/
public abstract class AbstractSyncJavaService {
// 自定义map的key
public static final String MAPKEY_USER_SYNC_ADD = "userSyncAdd";
public static final String MAPKEY_USER_SYNC_UPDATE = "userSyncUpdate";
public static final String MAPKEY_USER_SYNC_DISABLE = "userSyncDisable";
public static final String MAPKEY_ORG_SYNC_ADD = "orgSyncAdd";
public static final String MAPKEY_ORG_SYNC_UPDATE = "orgSyncUpdate";
public static final String MAPKEY_ORG_SYNC_DELETE = "orgSyncDelete";
public static final String MAPKEY_POS_SYNC_ADD = "posSyncAdd";
public static final String MAPKEY_POS_SYNC_UPDATE = "posSyncUpdate";
// 请求同步接口成功返回码
public static final String SYNC_CODE_SUCCESS = "0";
public static final int SYNC_RESULT_SUCCESS = 1;
public static final String SET_MANAGERNO_SUCCESS = "1";
// 岗位类别的默认值
public static final String POSITION_CLASS_DEFAULT = "未分类";
public static final String POSITION_CLASS_SEPARATOR = ";";
// 日期格式化用
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
public static final SimpleDateFormat YYMMDD_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
// 记录日志
public static Logger LOGGER = LogManager.getLogger(AbstractSyncJavaService.class);
// 请求同步接口的service
protected SyncPositionJavaService positionService = new SyncPositionJavaService();
protected SyncOrgJavaService orgService = new SyncOrgJavaService();
protected SyncUserJavaService userService = new SyncUserJavaService();
// 用于存放数据库查询到的数据的集合
private List<PositionJavaModel> positionListFromDB = new ArrayList<PositionJavaModel>(0);
private List<OuInfoJavaModel> ouInfoListFromDB = new ArrayList<OuInfoJavaModel>(0);
private List<UserInfoJavaModel> userInfoListFromDB = new ArrayList<UserInfoJavaModel>(0);
// 参数配置
private String apikey;
private String secretkey;
private String baseUrl;
// 全量增量区分
private String modeFull = "1";// 默认为1
private String modeUpdate = "2";// 默认为2
// 是否提供岗位id标志(客户提供的岗位数据中没有岗位id或者提供了包含岗位id的岗位数据但人员数据中关联的只有岗位名时需设置该值为false)
private boolean isPosIdProvided = true;// 默认为已提供
// 子类同步service的类名
private String syncServiceName;
public void setApikey(String apikey) {
this.apikey = apikey;
}
public void setSecretkey(String secretkey) {
this.secretkey = secretkey;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
/**
* 设置全量模式定义的值, 若未自定义无需设置。默认值为"1"
*
* @param modeFull
*/
public void setModeFull(String modeFull) {
this.modeFull = modeFull;
}
/**
* 设置增量模式定义的值, 若未自定义无需设置。默认值为"2"
*
* @param modeUpdate
*/
public void setModeUpdate(String modeUpdate) {
this.modeUpdate = modeUpdate;
}
/**
* 客户提供的岗位数据中没有岗位id或者提供了包含岗位id的岗位数据但人员数据中关联的只有岗位名时需设置该值为false。默认为已提供
*
* @param isPosIdProvided
*/
public void setIsPosIdProvided(boolean isPosIdProvided) {
this.isPosIdProvided = isPosIdProvided;
}
/**
* 设置子类同步service的类名,记录日志时用
*
* @param syncServiceName
*/
public void setSyncServiceName(String syncServiceName) {
this.syncServiceName = syncServiceName;
}
/**
* 对外提供的同步程序的启动方法
*/
public void execute() {
try {
sync();
} catch (Exception e) {
LOGGER.error("定时同步[" + syncServiceName + "]出现异常", e);
try {
Thread.sleep(10 * 1000);
sync();
} catch (Exception ex) {
LOGGER.error("定时同步[" + syncServiceName + "]出现异常", ex);
}
}
}
/**
* 同步主方法。注意同步顺序:部门>岗位>人员
*
* @throws Exception
*/
public void sync() throws Exception {
LOGGER.info("定时同步[" + syncServiceName + "]开始");
ouInfoListFromDB = getOuInfoListFromDB();
int orgCount = ouInfoListFromDB.size();
if (orgCount > 0) {
// 组织增量同步
opOrgSync(modeUpdate, 0);
} else {
// 组织全量同步
opOrgSync(modeFull, 0);
}
positionListFromDB = getPositionsFromDB();
int posCount = positionListFromDB.size();
if (posCount > 0) {
// 岗位增量同步
opPosSync(modeUpdate);
} else {
// 岗位全量同步
opPosSync(modeFull);
}
userInfoListFromDB = getUserInfoListFromDB();
int userCount = userInfoListFromDB.size();
// 用户表数据默认有3条员工数据
if (userCount > 3) {
// 用户增量同步
opUserSync(modeUpdate, 1);
} else {
// 用户全量同步
opUserSync(modeFull, 1);
}
LOGGER.info("定时同步[" + syncServiceName + "]结束");
// 释放内存
ouInfoListFromDB = null;
positionListFromDB = null;
userInfoListFromDB = null;
}
/**
* 岗位同步
*
* @param mode 全量增量区分
* @throws Exception
*/
public void opPosSync(String mode) throws Exception {
List<PositionJavaModel> newList = getPositionModelList(mode);
LOGGER.info("岗位同步[" + syncServiceName + "]Total Size: " + newList.size());
removeExpiredPos(newList);
// 全量模式
if (modeFull.equals(mode)) {
LOGGER.info("岗位同步[" + syncServiceName + "]新增Size: " + newList.size());
setFullPosNames(newList);
syncAddPosOneByOne(newList);
}
// 增量模式
else {
Map<String, List<PositionJavaModel>> map = null;
if (isPosIdProvided) {
map = comparePosList1(positionListFromDB, newList);
} else {
map = comparePosList2(positionListFromDB, newList);
}
List<PositionJavaModel> posToSyncAdd = map.get(MAPKEY_POS_SYNC_ADD);
if (posToSyncAdd != null && posToSyncAdd.size() > 0) {
setFullPosNames(posToSyncAdd);
syncAddPosOneByOne(posToSyncAdd);
}
List<PositionJavaModel> posToSyncUpdate = map.get(MAPKEY_POS_SYNC_UPDATE);
if (posToSyncUpdate != null && posToSyncUpdate.size() > 0) {
syncUpdatePosOneByOne(posToSyncUpdate);
}
}
}
/**
* 组织同步
*
* @param mode 全量增量区分
* @param isBaseInfo 同步接口需传字段
* @throws Exception
*/
public void opOrgSync(String mode, int isBaseInfo) throws Exception {
List<OuInfoJavaModel> newList = getOuInfoModelList(mode);
LOGGER.info("组织同步[" + syncServiceName + "]Total Size: " + newList.size());
// 此处将需要删除的组织从集合中去除 提升同步新增效率
List<OuInfoJavaModel> expiredOrgs = removeExpiredOrgs(newList, mode);
setRootOrgParentId(newList);
// 全量模式
if (modeFull.equals(mode)) {
// 此处再次同步删除过期组织
if (expiredOrgs.size() > 0) {
LOGGER.info("组织同步[" + syncServiceName + "]删除Size: " + expiredOrgs.size());
syncDeleteOrgOneByOne(expiredOrgs, false);
}
LOGGER.info("组织同步[" + syncServiceName + "]新增Size: " + newList.size());
// 进行多次同步
for (int i = 0; i < 3; i++) {
syncAddOrUpdateOrgOneByOne(newList, isBaseInfo);
}
}
// 增量模式
else {
Map<String, List<OuInfoJavaModel>> map = compareOrgList(ouInfoListFromDB, newList);
List<OuInfoJavaModel> orgsToSyncDelete = map.get(MAPKEY_ORG_SYNC_DELETE);
if (orgsToSyncDelete != null && orgsToSyncDelete.size() > 0) {
syncDeleteOrgOneByOne(orgsToSyncDelete, true);
}
List<OuInfoJavaModel> orgsToSyncAdd = map.get(MAPKEY_ORG_SYNC_ADD);
if (orgsToSyncAdd != null && orgsToSyncAdd.size() > 0) {
syncAddOrUpdateOrgOneByOne(orgsToSyncAdd, isBaseInfo);
}
List<OuInfoJavaModel> orgsToSyncUpdate = map.get(MAPKEY_ORG_SYNC_UPDATE);
if (orgsToSyncUpdate != null && orgsToSyncUpdate.size() > 0) {
syncAddOrUpdateOrgOneByOne(orgsToSyncUpdate, isBaseInfo);
}
}
}
/**
* 用户同步
*
* @param mode 全量增量区分
* @param islink 是否同步用户基本信息
* @throws Exception
*/
public void opUserSync(String mode, int islink) throws Exception {
List<UserInfoJavaModel> newList = getUserInfoModelList(mode);
LOGGER.info("用户同步[" + syncServiceName + "]Total Size: " + newList.size());
changePropValues(newList);
// 此处将需要删除的用户从集合中去除 提升同步新增效率
List<UserInfoJavaModel> expiredUsers = removeExpiredUsers(newList, mode);
if (!isPosIdProvided) {
setPositionNoToUser(newList);
}
// 全量模式
if (modeFull.equals(mode)) {
// 同步禁用过期用户
if (expiredUsers.size() > 0) {
LOGGER.info("用户同步[" + syncServiceName + "]禁用Size: " + expiredUsers.size());
syncDisableUserOneByOne(expiredUsers, false);
}
LOGGER.info("用户同步[" + syncServiceName + "]新增Size: " + newList.size());
syncAddUserOneByOne(newList, islink);
}
// 增量模式
else {
// 与增量list进行比较
Map<String, List<UserInfoJavaModel>> map = compareUserList(userInfoListFromDB, newList);
List<UserInfoJavaModel> usersToDisable = map.get(MAPKEY_USER_SYNC_DISABLE);
if (usersToDisable != null && usersToDisable.size() > 0) {
syncDisableUserOneByOne(usersToDisable, true);
}
List<UserInfoJavaModel> usersToSyncAdd = map.get(MAPKEY_USER_SYNC_ADD);
if (usersToSyncAdd != null && usersToSyncAdd.size() > 0) {
syncAddUserOneByOne(usersToSyncAdd, islink);
}
List<UserInfoJavaModel> usersToSyncUpdate = map.get(MAPKEY_USER_SYNC_UPDATE);
if (usersToSyncUpdate != null && usersToSyncUpdate.size() > 0) {
syncUpdateUserOneByOne(usersToSyncUpdate, islink);
}
}
}
/**
* 岗位全量数据集合与最新获取岗位数据集合进行比较(已提供岗位编号)
*
* @param fullList 全量岗位数据集合
* @param newList 最新获取岗位数据集合
* @return 包含 同步新增和更新的岗位集合的Map对象
*/
protected Map<String, List<PositionJavaModel>> comparePosList1(List<PositionJavaModel> fullList,
List<PositionJavaModel> newList) {
Map<String, List<PositionJavaModel>> map = new HashMap<String, List<PositionJavaModel>>();
List<PositionJavaModel> posToSyncAdd = new ArrayList<PositionJavaModel>();
List<PositionJavaModel> posToSyncUpdate = new ArrayList<PositionJavaModel>();
for (PositionJavaModel newPos : newList) {
// 岗位不存在新增
if (!fullList.contains(newPos)) {
posToSyncAdd.add(newPos);
} else {
String newPosNo = newPos.getpNo();
if (newPosNo != null) {
for (PositionJavaModel fullPos : fullList) {
// 根据岗位编号进行比较
if (newPosNo.equals(fullPos.getpNo())) {
String newPosName = newPos.getpNames();
// 岗位名发生更新
if (newPosName != null && !newPosName.equals(fullPos.getpNames())) {
posToSyncUpdate.add(newPos);
}
break;
}
}
}
}
}
map.put(MAPKEY_POS_SYNC_ADD, posToSyncAdd);
map.put(MAPKEY_POS_SYNC_UPDATE, posToSyncUpdate);
LOGGER.info("岗位同步[" + syncServiceName + "]新增Size: " + posToSyncAdd.size());
LOGGER.info("岗位同步[" + syncServiceName + "]更新Size: " + posToSyncUpdate.size());
return map;
}
/**
* 岗位全量数据集合与最新获取岗位数据集合进行比较(未提供岗位编号)
*
* @param fullList 全量岗位数据集合
* @param newList 最新获取岗位数据集合
* @return 包含 同步新增的岗位集合的Map对象
*/
protected Map<String, List<PositionJavaModel>> comparePosList2(List<PositionJavaModel> fullList,
List<PositionJavaModel> newList) {
Map<String, List<PositionJavaModel>> map = new HashMap<String, List<PositionJavaModel>>();
List<PositionJavaModel> posToSyncAdd = new ArrayList<PositionJavaModel>();
// 待新增岗位
for (PositionJavaModel newPos : newList) {
String newPosName = newPos.getpNames();
if (newPosName != null) {
boolean isPosNameExist = false;
for (PositionJavaModel fullPos : fullList) {
// 根据岗位名进行比较
if (newPosName.equals(fullPos.getpNames())) {
isPosNameExist = true;
break;
}
}
// 岗位名不存在
if (!isPosNameExist) {
posToSyncAdd.add(newPos);
}
}
}
map.put(MAPKEY_POS_SYNC_ADD, posToSyncAdd);
LOGGER.info("岗位同步[" + syncServiceName + "]新增Size: " + posToSyncAdd.size());
return map;
}
/**
* 组织全量数据集合与最新获取组织数据集合进行比较
*
* @param fullList 全量组织数据集合
* @param newList 最新获取组织数据集合
* @return 包含 同步新增、更新、 删除等组织集合的Map对象
*/
protected Map<String, List<OuInfoJavaModel>> compareOrgList(List<OuInfoJavaModel> fullList, List<OuInfoJavaModel> newList) {
Map<String, List<OuInfoJavaModel>> map = new HashMap<String, List<OuInfoJavaModel>>();
List<OuInfoJavaModel> orgsToSyncAdd = new ArrayList<OuInfoJavaModel>();
List<OuInfoJavaModel> orgsToSyncUpdate = new ArrayList<OuInfoJavaModel>();
List<OuInfoJavaModel> orgsToSyncDelete = new ArrayList<OuInfoJavaModel>();
for (OuInfoJavaModel newOrg : newList) {
// 待新增组织
if (!fullList.contains(newOrg)) {
// 非过期组织
if (!isOrgExpired(newOrg)) {
orgsToSyncAdd.add(newOrg);
} else {
// logger.info("包含过期组织:" + newOrg.getOuName());
}
}
// 已经存在的组织比较
else {
// 组织过期待删除
if (isOrgExpired(newOrg)) {
orgsToSyncDelete.add(newOrg);
} else {
// 组织更新
orgsToSyncUpdate.add(newOrg);
}
}
}
map.put(MAPKEY_ORG_SYNC_ADD, orgsToSyncAdd);
map.put(MAPKEY_ORG_SYNC_UPDATE, orgsToSyncUpdate);
map.put(MAPKEY_ORG_SYNC_DELETE, orgsToSyncDelete);
LOGGER.info("组织同步[" + syncServiceName + "]新增Size: " + orgsToSyncAdd.size());
LOGGER.info("组织同步[" + syncServiceName + "]更新Size: " + orgsToSyncUpdate.size());
LOGGER.info("组织同步[" + syncServiceName + "]删除Size: " + orgsToSyncDelete.size());
return map;
}
/**
* 用户全量数据集合与最新获取用户数据集合进行比较
*
* @param fullList 全量用户数据集合
* @param newList 最新获取用户数据集合
* @return 包含 同步新增、更新、禁用等用户集合的Map对象
*/
protected Map<String, List<UserInfoJavaModel>> compareUserList(List<UserInfoJavaModel> fullList,
List<UserInfoJavaModel> newList) {
Map<String, List<UserInfoJavaModel>> map = new HashMap<String, List<UserInfoJavaModel>>();
List<UserInfoJavaModel> usersToSyncAdd = new ArrayList<UserInfoJavaModel>();
List<UserInfoJavaModel> usersToSyncUpdate = new ArrayList<UserInfoJavaModel>();
List<UserInfoJavaModel> usersToSyncDisable = new ArrayList<UserInfoJavaModel>();
for (UserInfoJavaModel newUser : newList) {
// 待新增用户
if (!fullList.contains(newUser)) {
if (!isUserExpired(newUser)) {
usersToSyncAdd.add(newUser);
} else {
// logger.info("包含过期员工:" + newUser.getId());
}
}
// 已经存在的用户比较
else {
if (isUserExpired(newUser)) {
// 用户过期禁用
usersToSyncDisable.add(newUser);
} else {
// 存在用户更新
usersToSyncUpdate.add(newUser);
}
}
}
map.put(MAPKEY_USER_SYNC_ADD, usersToSyncAdd);
map.put(MAPKEY_USER_SYNC_UPDATE, usersToSyncUpdate);
map.put(MAPKEY_USER_SYNC_DISABLE, usersToSyncDisable);
LOGGER.info("用户同步[" + syncServiceName + "]新增Size: " + usersToSyncAdd.size());
LOGGER.info("用户同步[" + syncServiceName + "]更新Size: " + usersToSyncUpdate.size());
LOGGER.info("用户同步[" + syncServiceName + "]禁用Size: " + usersToSyncDisable.size());
return map;
}
/**
* 根据用户数据集合生成岗位对象集合(客户未提供岗位数据仅提供包含了岗位名的人员数据时调用该方法)
*
* @param userModelList
* @return 岗位对象集合
*/
protected List<PositionJavaModel> getPosListFromUsers(List<UserInfoJavaModel> userModelList) {
// 使用Set保证无重复
Set<String> posNames = new HashSet<String>();
for (UserInfoJavaModel modle : userModelList) {
// 只取非过期账号的岗位
if (!isUserExpired(modle)) {
posNames.add(modle.getPostionName());
}
}
List<PositionJavaModel> list = new ArrayList<PositionJavaModel>(posNames.size());
PositionJavaModel temp = null;
for (String posName : posNames) {
temp = new PositionJavaModel();
// 随机生成岗位编号
temp.setpNo(UUID.randomUUID().toString());
temp.setpNames(posName);
list.add(temp);
}
return list;
}
/**
* 关联岗位编号到用户(人员数据中只有岗位名没有岗位id数据)
*
* @param newList
* @throws Exception
*/
protected void setPositionNoToUser(List<UserInfoJavaModel> newList) throws Exception {
// 首次同步positionListFromDB为空的情况
if (positionListFromDB.size() == 0) {
// 重新从数据库获取岗位数据
positionListFromDB = getPositionsFromDB();
}
for (UserInfoJavaModel user : newList) {
String pNameInUser = user.getPostionName();
if (pNameInUser != null) {
for (PositionJavaModel pos : positionListFromDB) {
// 根据岗位名(不带岗位类别)进行查找
if (pNameInUser.equals(pos.getpNames())) {
user.setPostionNo(pos.getpNo());
break;
}
}
}
}
}
/**
* 关联数据库岗位编号到用户(人员数据中只有岗位名没有岗位id数据),供自行实现同步时调用
*
* @param newList
* @throws Exception
*/
protected void setDBPositionNoToUser(List<UserInfoJavaModel> newList) throws Exception {
// 获取数据库岗位数据
List<PositionJavaModel> positionListDB = getPositionsFromDB();
for (UserInfoJavaModel user : newList) {
String pNameInUser = user.getPostionName();
if (pNameInUser != null) {
for (PositionJavaModel pos : positionListDB) {
// 根据岗位名(不带岗位类别)进行查找
if (pNameInUser.equals(pos.getpNames())) {
user.setPostionNo(pos.getpNo());
break;
}
}
}
}
positionListDB = null;
}
/**
* 设置岗位名为带类别岗位名(同步新增岗位之前设置)
*
* @param newList
*/
protected void setFullPosNames(List<PositionJavaModel> newList) {
String prefix = POSITION_CLASS_DEFAULT + POSITION_CLASS_SEPARATOR;
for (PositionJavaModel pos : newList) {
// 岗位类别名
String pNameClass = pos.getpNameClass();
if (StringUtils.isBlank(pNameClass)) {
pos.setpNames(prefix + pos.getpNames());
} else {
pos.setpNames(pNameClass + POSITION_CLASS_SEPARATOR + pos.getpNames());
}
}
}
/**
* 从pNames中得到岗位名(pNames格式: 一级类别;二级类别;岗位名)
*
* @param pNames
* @return 不带类别的岗位名
*/
protected String getPositionName(String pNames) {
if (pNames == null) {
return null;
}
String[] arr = pNames.split(POSITION_CLASS_SEPARATOR);
int len = arr.length;
if (len == 0) {
return null;
}
// 最后是岗位名
return arr[len - 1];
}
/**
* 不同组织存在同岗位名时调用该方法获取组织名作为岗位类别名(前提:1人员中关联的是岗位id,2同岗位名对应多个岗位id,3岗位数据中有所属组织id)
*
* @param orgId
* @return 作为岗位类别的组织名
* @throws Exception
*/
protected String getPositionNameClassFromOrgs(String orgId) throws Exception {
// 首次同步ouInfoListFromDB为空的情况
if (ouInfoListFromDB.size() == 0) {
// 重新从数据库获取部门数据
ouInfoListFromDB = getOuInfoListFromDB();
}
String pNameClass = null;
if (orgId != null) {
for (OuInfoJavaModel org : ouInfoListFromDB) {
if (orgId.equals(org.getId())) {
pNameClass = org.getOuName();
break;
}
}
}
return pNameClass;
}
/**
* 去除过期岗位
*
* @param list
*/
protected void removeExpiredPos(List<PositionJavaModel> list) {
for (Iterator<PositionJavaModel> iterator = list.iterator(); iterator.hasNext(); ) {
PositionJavaModel pos = iterator.next();
if (isPosExpired(pos)) {
iterator.remove();
// logger.info("删除了过期岗位:" + pos.getpNames());
}
}
}
/**
* 去除过期组织
*
* @param list
* @param mode
* @return 过期组织集合
*/
protected List<OuInfoJavaModel> removeExpiredOrgs(List<OuInfoJavaModel> list, String mode) {
List<OuInfoJavaModel> expiredOrgs = new ArrayList<OuInfoJavaModel>();
// 仅全量模式下执行
if (modeFull.equals(mode)) {
for (Iterator<OuInfoJavaModel> iterator = list.iterator(); iterator.hasNext(); ) {
OuInfoJavaModel org = iterator.next();
if (isOrgExpired(org)) {
expiredOrgs.add(org);
iterator.remove();
// logger.info("删除了过期组织:" + org.getOuName());
}
}
}
return expiredOrgs;
}
/**
* 删除过期员工
*
* @param list
* @param mode
* @return 过期员工集合
*/
protected List<UserInfoJavaModel> removeExpiredUsers(List<UserInfoJavaModel> list, String mode) {
List<UserInfoJavaModel> expiredUsers = new ArrayList<UserInfoJavaModel>();
// 仅全量模式下执行
if (modeFull.equals(mode)) {
for (Iterator<UserInfoJavaModel> iterator = list.iterator(); iterator.hasNext(); ) {
UserInfoJavaModel user = iterator.next();
if (isUserExpired(user)) {
expiredUsers.add(user);
iterator.remove();
}
}
}
return expiredUsers;
}
/**
* 逐个岗位同步新增
*
* @param posToSync
*/
protected void syncAddPosOneByOne(List<PositionJavaModel> posToSync) {
List<PositionJavaModel> tempList = new ArrayList<PositionJavaModel>();
ResultJavaEntity resultJavaEntity = null;
for (PositionJavaModel pos : posToSync) {
tempList.add(pos);
try {
resultJavaEntity = positionService.position(tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
printLog("岗位同步[" + syncServiceName + "]新增失败 ", pos.getpNames(), resultJavaEntity);
}
} catch (IOException e) {
LOGGER.error("岗位同步[" + syncServiceName + "]新增失败 " + pos.getpNames(), e);
}
tempList.clear();
}
}
/**
* 逐个岗位同步更新
*
* @param posToSync
*/
protected void syncUpdatePosOneByOne(List<PositionJavaModel> posToSync) {
ResultJavaEntity resultJavaEntity = null;
for (PositionJavaModel pos : posToSync) {
try {
// 更新岗位名不带分级类别
resultJavaEntity = positionService.updatePositionInfo(pos.getpNo(), getPositionName(pos.getpNames()), apikey,
secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
printLog("岗位同步[" + syncServiceName + "]更新失败 ", pos.getpNo(), resultJavaEntity);
}
} catch (IOException e) {
LOGGER.error("岗位同步[" + syncServiceName + "]更新失败 " + pos.getpNames(), e);
}
}
}
/**
* 逐个组织同步新增或更新
*
* @param orgsToSyncAddOrUpdate
* @param isBaseInfo
*/
protected void syncAddOrUpdateOrgOneByOne(List<OuInfoJavaModel> orgsToSyncAddOrUpdate, int isBaseInfo) {
List<OuInfoJavaModel> tempList = new ArrayList<OuInfoJavaModel>();
ResultJavaEntity resultJavaEntity = null;
for (OuInfoJavaModel org : orgsToSyncAddOrUpdate) {
tempList.add(org);
try {
resultJavaEntity = orgService.ous(isBaseInfo, tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
// 设置部门主管
String managerId = org.getManagerNo();
if (StringUtils.isNotBlank(managerId)) {
resultJavaEntity = orgService.setmanager(managerId, org.getId(), 0, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
printLog("设置部门主管[" + syncServiceName + "]失败 ", org.getOuName() + managerId, resultJavaEntity);
}
}
} else {
printLog("组织同步[" + syncServiceName + "]失败 ", org.getOuName(), resultJavaEntity);
}
} catch (IOException e) {
LOGGER.error("组织同步[" + syncServiceName + "]失败 " + org.getOuName(), e);
}
tempList.clear();
}
}
/**
* 逐个组织同步删除
*
* @param orgsToSyncDelete
* @param ifPringLog
*/
protected void syncDeleteOrgOneByOne(List<OuInfoJavaModel> orgsToSyncDelete, boolean ifPringLog) {
List<String> tempList = new ArrayList<String>();
ResultJavaEntity resultJavaEntity = null;
for (OuInfoJavaModel org : orgsToSyncDelete) {
tempList.add(org.getId());
try {
resultJavaEntity = orgService.deleteous(tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
if (ifPringLog) {
printLog("组织同步[" + syncServiceName + "]删除失败 ", org.getOuName(), resultJavaEntity);
}
}
} catch (IOException e) {
LOGGER.error("组织同步[" + syncServiceName + "]删除失败 " + org.getOuName(), e);
}
tempList.clear();
}
}
/**
* 逐个用户同步新增
*
* @param usersToSyncAdd
* @param islink
*/
protected void syncAddUserOneByOne(List<UserInfoJavaModel> usersToSyncAdd, int islink) {
syncUpdateUserOneByOne(usersToSyncAdd, islink);
}
/**
* 逐个用户同步更新
*
* @param usersToSyncUpdate
* @param islink
*/
protected void syncUpdateUserOneByOne(List<UserInfoJavaModel> usersToSyncUpdate, int islink) {
List<UserInfoJavaModel> tempList = new ArrayList<UserInfoJavaModel>();
ResultJavaEntity resultJavaEntity = null;
for (UserInfoJavaModel user : usersToSyncUpdate) {
tempList.add(user);
try {
resultJavaEntity = userService.users(islink, tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
// 忽略邮箱再同步一次
user.setMail(null);
tempList.set(0, user);
resultJavaEntity = userService.users(islink, tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
printLog("用户同步[" + syncServiceName + "]失败 ", user.getId(), resultJavaEntity);
}
}
} catch (IOException e) {
LOGGER.error("用户同步[" + syncServiceName + "]失败 " + user.getId(), e);
}
tempList.clear();
}
// 增加设置直属经理
syncSetUserManagerNoOneByOne(usersToSyncUpdate);
}
/**
* 逐个用户设置直属经理
*
* @param usersToSyncUpdate
*/
protected void syncSetUserManagerNoOneByOne(List<UserInfoJavaModel> usersToSyncUpdate) {
List<UserInfoJavaModel> tempList = new ArrayList<UserInfoJavaModel>();
ResultJavaEntity resultJavaEntity = null;
for (UserInfoJavaModel user : usersToSyncUpdate) {
try {
// 设置直属经理
String managerNo = user.getManagerNo();
if (StringUtils.isNotBlank(managerNo)) {
tempList.set(0, user);
resultJavaEntity = userService.addmgr(tempList, apikey, secretkey,baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
LOGGER.error("设置直属经理失败:" + resultJavaEntity.getMsg());
}
tempList.clear();
}
} catch (IOException e) {
LOGGER.error("设置直属经理[" + syncServiceName + "]失败 " + user.getId(), e);
}
}
}
/**
* 逐个用户同步禁用
*
* @param usersToDisable
* @param ifPringLog
*/
protected void syncDisableUserOneByOne(List<UserInfoJavaModel> usersToDisable, boolean ifPringLog) {
List<String> tempList = new ArrayList<String>();
ResultJavaEntity resultJavaEntity = null;
for (UserInfoJavaModel user : usersToDisable) {
// 用户名是admin时忽略
String userName = user.getUserName();
if ("admin".equals(userName)) {
continue;
}
tempList.add(userName);
try {
resultJavaEntity = userService.disabledusers(tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
if (ifPringLog) {
printLog("用户同步[" + syncServiceName + "]禁用失败 ", user.getId(), resultJavaEntity);
}
}
} catch (IOException e) {
LOGGER.error("用户同步[" + syncServiceName + "]禁用失败 " + user.getId(), e);
}
tempList.clear();
}
}
/**
* 逐个用户同步删除(用户被删除后学习记录等数据会被清空且不可恢复,已改为禁用)
*
* @param usersToDelete
* @param ifPringLog
*/
protected void syncDeleteUserOneByOne(List<UserInfoJavaModel> usersToDelete, boolean ifPringLog) {
List<String> tempList = new ArrayList<String>();
ResultJavaEntity resultJavaEntity = null;
for (UserInfoJavaModel user : usersToDelete) {
// 用户名是admin时忽略不删除
String userName = user.getUserName();
if ("admin".equals(userName)) {
continue;
}
tempList.add(userName);
try {
resultJavaEntity = userService.deletedusers(tempList, apikey, secretkey, baseUrl);
if (SYNC_RESULT_SUCCESS != resultJavaEntity.getResult()) {
if (ifPringLog) {
printLog("用户同步[" + syncServiceName + "]删除失败 ", user.getId(), resultJavaEntity);
}
}
} catch (IOException e) {
LOGGER.error("用户同步[" + syncServiceName + "]删除失败 " + user.getId(), e);
}
tempList.clear();
}
}
/**
* 通过复制属性值的方法将数据模型集合转换为同步用的对象集合
*
* @param fromList 数据模型集合
* @param toListClassType 复制目标对象的类型
* @return 复制后的对象集合
* @throws ReflectiveOperationException
*/
protected <E, T> List<T> copyCreateEntityList(List<E> fromList, Class<T> toListClassType)
throws ReflectiveOperationException {
List<T> entityList = null;
if (fromList != null) {
int listSize = fromList.size();
entityList = new ArrayList<T>(listSize);
for (int i = 0; i < listSize; i++) {
T instance = toListClassType.newInstance();
BeanUtils.copyProperties(instance, fromList.get(i));
entityList.add(instance);
}
}
return entityList;
}
/**
* 计算得到昨天的日期
*
* @param date
* @return
*/
protected Date getYesterdayDate(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
// 修改为返回三天前的日期,防止出现异常造成单日数据漏同步
c.add(Calendar.DAY_OF_MONTH, -3);
return c.getTime();
}
/**
* 同步返回错误信息日志记录
*
* @param type
* @param errKey
* @param resultJavaEntity
*/
protected void printLog(String type, String errKey, ResultJavaEntity resultJavaEntity) {
LOGGER.error(type + "ID:" + errKey + " 错误信息:" + resultJavaEntity.getResult() + "-" + resultJavaEntity.getMsg());
}
/**
* 从数据库获取岗位数据
*
* @return
* @throws Exception
*/
protected abstract List<PositionJavaModel> getPositionsFromDB() throws Exception;
/**
* 从数据库获取组织数据
*
* @return
* @throws Exception
*/
protected abstract List<OuInfoJavaModel> getOuInfoListFromDB() throws Exception;
/**
* 从数据库获取人员数据
*
* @return
* @throws Exception
*/
protected abstract List<UserInfoJavaModel> getUserInfoListFromDB() throws Exception;
/**
* 判断组织是否过期.同步删除组织时用
*
* @param org
* @return
*/
protected abstract boolean isOrgExpired(OuInfoJavaModel org);
/**
* 判断岗位是否过期.同步删除岗位时用
*
* @param pos
* @return
*/
protected abstract boolean isPosExpired(PositionJavaModel pos);
/**
* 判断用户是否过期.同步禁用或删除人员时用
*
* @param user
* @return
*/
protected abstract boolean isUserExpired(UserInfoJavaModel user);
/**
* 设置根组织的父节点id为null
*
* @param newList
*/
protected abstract void setRootOrgParentId(List<OuInfoJavaModel> newList);
/**
* 根据实际情况更改属性值
*
* @param newList
*/
protected abstract void changePropValues(List<UserInfoJavaModel> newList);
/**
* 调用客户接口获取组织对象集合,注意全量增量区分。组织不同步返回new ArrayList<>(0);
*
* @param mode 全量增量区分
* @return 全量或者增量组织对象集合
*/
protected abstract List<OuInfoJavaModel> getOuInfoModelList(String mode) throws Exception;
/**
* 调用客户接口获取岗位对象集合,注意全量增量区分。岗位不同步返回new ArrayList<>(0);
*
* @param mode 全量增量区分
* @return 全量或者增量岗位对象集合
*/
protected abstract List<PositionJavaModel> getPositionModelList(String mode) throws Exception;
/**
* 调用客户接口获取用户对象集合,注意全量增量区分。用户不同步返回new ArrayList<>(0);
*
* @param mode 全量增量区分
* @return 全量或者增量用户对象集合
*/
protected abstract List<UserInfoJavaModel> getUserInfoModelList(String mode) throws Exception;
}
package datasync.service;
import datasync.common.ResultJavaEntity;
import datasync.common.SyncDataJavaUtil;
import datasync.model.OuInfoJavaModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.util.List;
public class SyncOrgJavaService {
/**
* 同步组织单位
*
* @param isBaseInfo
* @param ouInfos
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity ous(int isBaseInfo, List<OuInfoJavaModel> ouInfos, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(ouInfos);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("isbaseinfo", isBaseInfo);
params.put("datas", array);
String url = baseUrl + "udp/sy/ous";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步删除组织单位
*
* @param ouCodes 部门编号列表 JSON格式例如 ["java01", "java02"]
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity deleteous(List<String> ouCodes, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/deleteous";
return SyncDataJavaUtil.arrayOp(ouCodes, url, apikey, secretkey);
}
/**
* 将用户从组织单位中移除
*
* @param userNames 用户名列表JSON格式例如:[“sum11”, “sum10”];
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity removeusersfromou(List<String> userNames, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/removeusersfromou";
return SyncDataJavaUtil.arrayOp(userNames, url, apikey, secretkey);
}
/**
* 将一批用户移动至新部门
*
* @param userNames 用户名列表JSON格式例如:[“sum11”, “sum10”]
* @param newOuID 部门编号
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity batchchangeorgou(List<String> userNames, String newOuID, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(userNames);
params.put("datas", array.toString());
params.put("extendKey", newOuID);
String url = baseUrl + "udp/sy/batchchangeorgou";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步设置部门主管
*
* @param userName
* @param ouCode
* @param isCancelManager 是否取消部门主管
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity setmanager(String userName, String ouCode, int isCancelManager, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("extendKey", userName);
params.put("masterKey", ouCode);
params.put("isCancelManager", isCancelManager);
String url = baseUrl + "udp/sy/setmanager";
return SyncDataJavaUtil.getResult(url, params.toString());
}
}
package datasync.service;
import datasync.common.ResultJavaEntity;
import datasync.common.SyncDataJavaUtil;
import datasync.model.GradeJavaModel;
import datasync.model.PositionJavaModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.util.List;
public class SyncPositionJavaService {
/**
* 同步岗位
*
* @param positions
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity position(List<PositionJavaModel> positions, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(positions);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("datas", array);
String url = baseUrl + "udp/sy/position";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步职级
*
* @param grades
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity updategrade(List<GradeJavaModel> grades, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(grades);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("datas", array);
String url = baseUrl + "udp/sy/updgrade";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步更改岗位名称
*
* @param positionNo 岗位编号
* @param positionName 岗位名称(修改后)
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity updatePositionInfo(String positionNo, String positionName, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("positionNo", positionNo);
params.put("positionName", positionName);
String url = baseUrl + "udp/sy/updatepositioninfo";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 查询岗位编号
*
* @param positionName 2级岗位类别;岗位名称1
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity getPnoByPname(String positionName, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("extendKey", positionName);
String url = baseUrl + "udp/sy/getpnobypname";
return SyncDataJavaUtil.getResult(url, params.toString());
}
}
package datasync.service;
import datasync.common.ResultJavaEntity;
import datasync.common.SyncDataJavaUtil;
import datasync.model.GroupMapJavaModel;
import datasync.model.UserInfoJavaModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.io.IOException;
import java.util.List;
public class SyncUserJavaService {
/**
* 创建用户
*
* @param islink 是否同步用户基本信息
* @param users
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity createusers(int islink, List<UserInfoJavaModel> users, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(users);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("islink", islink);
params.put("datas", array);
String url = baseUrl + "udp/sy/sv/use";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步用户
*
* @param islink 是否同步用户基本信息
* @param users
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity users(int islink, List<UserInfoJavaModel> users, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(users);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("islink", islink);
params.put("datas", array);
String url = baseUrl + "udp/sy/users";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步禁用用户
*
* @param userNames
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity disabledusers(List<String> userNames, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/disabledusers";
return SyncDataJavaUtil.arrayOp(userNames, url, apikey, secretkey);
}
/**
* 同步删除用户
*
* @param userNames
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity deletedusers(List<String> userNames, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/deletedusers";
return SyncDataJavaUtil.arrayOp(userNames, url, apikey, secretkey);
}
/**
* 同步启用用户
*
* @param userNames
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity enabledusers(List<String> userNames, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/enabledusers";
return SyncDataJavaUtil.arrayOp(userNames, url, apikey, secretkey);
}
/**
* 同步校验用户是否存在
*
* @param userNames
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity checkusers(List<String> userNames, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/sv/cku";
return SyncDataJavaUtil.arrayOp(userNames, url, apikey, secretkey);
}
/**
* 自动建用户组
*
* @param groupMaps 关系数据信息
* @param groupName 业务组名称
* @param remark 用户组简介
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity groupadd(List<GroupMapJavaModel> groupMaps, String groupName, String remark, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = JSONArray.fromObject(groupMaps);
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("groupName", groupName);
params.put("remark", remark);
params.put("userGroupMaps", array);
String url = baseUrl + "udp/sy/groupadd";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步角色删除人员
*
* @param userNames
* @param roleNo 角色编号
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity roledeleteuser(List<String> userNames, String roleNo, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(userNames);
params.put("extendKey", roleNo);
params.put("datas", array.toString());
String url = baseUrl + "udp/sy/rldeu";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步角色增加人员
*
* @param userNames
* @param roleNo 角色编号
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity roleadduser(List<String> userNames, String roleNo, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(userNames);
params.put("extendKey", roleNo);
params.put("datas", array.toString());
String url = baseUrl + "udp/sy/rladu";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 用户组添加人员
*
* @param masterNos 关系数据信息(人员账号或部门编号或岗位编号)格式如:["cuim@yunxuetang.cn","user001","user002"]
* @param groupId 业务组ID
* @param mapType 关系类型(固定值 部门:Department,岗位:Position,用户:User)
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity groupMapAdd(List<String> masterNos, String groupId, String mapType, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(masterNos);
params.put("groupId", groupId);
params.put("masterNo", array.toString());
params.put("mapType", mapType);
String url = baseUrl + "udp/sy/gmadd";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 用户组删除人员
*
* @param masterNos 关系数据信息(人员账号或部门编号或岗位编号)格式如:["cuim@yunxuetang.cn","user001","user002"]
* @param groupId 业务组ID
* @param mapType 关系类型(固定值 部门:Department,岗位:Position,用户:User)
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity groupMapDel(List<String> masterNos, String groupId, String mapType, String apikey, String secretkey, String baseUrl) throws IOException {
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
JSONArray array = JSONArray.fromObject(masterNos);
params.put("groupId", groupId);
params.put("masterNo", array.toString());
params.put("mapType", mapType);
String url = baseUrl + "udp/sy/gmdel";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步增加直属经理
*
* @param datas
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity addmgr(List<UserInfoJavaModel> datas, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = new JSONArray();
for (UserInfoJavaModel data : datas) {
JSONObject param = new JSONObject();
param.put("userId", data.getId());
param.put("managerNo", data.getManagerNo());
array.add(param);
}
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("datas", array);
String url = baseUrl + "udp/sy/addmgr";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步更新直属经理
*
* @param datas
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity updmgr(List<UserInfoJavaModel> datas, String apikey, String secretkey, String baseUrl) throws IOException {
JSONArray array = new JSONArray();
for (UserInfoJavaModel data : datas) {
JSONObject param = new JSONObject();
param.put("userId", data.getId());
param.put("managerNo", data.getManagerNo());
array.add(param);
}
JSONObject params = SyncDataJavaUtil.getPublicParam(apikey, secretkey);
params.put("datas", array);
String url = baseUrl + "udp/sy/updmgr";
return SyncDataJavaUtil.getResult(url, params.toString());
}
/**
* 同步删除直属经理
*
* @param userIds
* @param apikey
* @param secretkey
* @param baseUrl
* @return
* @throws IOException
*/
public ResultJavaEntity delmgr(List<String> userIds, String apikey, String secretkey, String baseUrl) throws IOException {
String url = baseUrl + "udp/sy/delmgr";
return SyncDataJavaUtil.arrayOp(userIds, url, apikey, secretkey);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">
<Properties>
<!-- 配置日志文件输出目录 -->
<Property name="LOG_HOME">D:/YunXueTang/log</Property>
<property name="FILE_NAME">synclog</property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %logger{36} - %m%n" />
</Console>
<RollingFile name="RollingFileLog" fileName="${LOG_HOME}/${FILE_NAME}.log"
filePattern="${LOG_HOME}/$${date:yyyy}/${FILE_NAME}-%d{yyyy-MM}-%i.log">
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %logger{36} - %m%n" />
<!-- 配置日志文件按月保存 结合filePattern属性值进行时间间隔控制 -->
<TimeBasedTriggeringPolicy interval="1" />
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<!-- <AppenderRef ref="Console" /> -->
<AppenderRef ref="RollingFileLog" />
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment