首次上传
This commit is contained in:
commit
6fd72e9181
30
.classpath
Normal file
30
.classpath
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/netty-all-4.0.25.Final.jar"/>
|
||||
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/servlet-api.jar"/>
|
||||
<classpathentry kind="lib" path="src/main/webapp/WEB-INF/lib/jave-1.0.2.jar" sourcepath="src/main/webapp/WEB-INF/lib/jave-1.0.2-src"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
13
.idea/compiler.xml
generated
Normal file
13
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="we3e" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/encodings.xml
generated
Normal file
9
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
55
.idea/jarRepositories.xml
generated
Normal file
55
.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="alibaba-opensource" />
|
||||
<option name="name" value="alibaba-opensource" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="alibaba-opensource-snapshot" />
|
||||
<option name="name" value="alibaba-opensource-snapshot" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="Maven Repository Switchboard" />
|
||||
<option name="url" value="http://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="alibaba-opensource-snapshot" />
|
||||
<option name="name" value="alibaba-opensource-snapshot" />
|
||||
<option name="url" value="http://code.alibabatech.com/mvn/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="Maven Repository Switchboard" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="alibaba-opensource" />
|
||||
<option name="name" value="alibaba-opensource" />
|
||||
<option name="url" value="http://code.alibabatech.com/mvn/releases/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
30
.idea/misc.xml
generated
Normal file
30
.idea/misc.xml
generated
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="myConfigurationMap">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$">
|
||||
<value>
|
||||
<SvnBranchConfiguration>
|
||||
<option name="trunkUrl" value="svn://123.57.248.179/3espoken/weixin/we3e" />
|
||||
</SvnBranchConfiguration>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/we3e.iml" filepath="$PROJECT_DIR$/we3e.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/webContexts.xml
generated
Normal file
10
.idea/webContexts.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WebContextManager">
|
||||
<option name="state">
|
||||
<map>
|
||||
<entry key="file://$PROJECT_DIR$/src/main/webapp/app/checkReadPlanShare.jsp" value="file://$PROJECT_DIR$/src/main/webapp/app" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
1493
.idea/workspace.xml
generated
Normal file
1493
.idea/workspace.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
48
.project
Normal file
48
.project
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>we3e</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
13
.settings/.jsdtscope
Normal file
13
.settings/.jsdtscope
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
|
||||
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
||||
7
.settings/org.eclipse.core.resources.prefs
Normal file
7
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/main/resources/common_wechat.properties=UTF-8
|
||||
encoding//src/main/resources/next_wechat.properties=UTF-8
|
||||
encoding//src/main/webapp/app/shareDub.jsp=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
13
.settings/org.eclipse.jdt.core.prefs
Normal file
13
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,13 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
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.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
10
.settings/org.eclipse.wst.common.component
Normal file
10
.settings/org.eclipse.wst.common.component
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="we3e">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="context-root" value="we3e"/>
|
||||
<property name="java-output-path" value="/we3e/target/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
7
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
7
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="java" version="1.5"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
</faceted-project>
|
||||
1
.settings/org.eclipse.wst.jsdt.ui.superType.container
Normal file
1
.settings/org.eclipse.wst.jsdt.ui.superType.container
Normal file
@ -0,0 +1 @@
|
||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
||||
1
.settings/org.eclipse.wst.jsdt.ui.superType.name
Normal file
1
.settings/org.eclipse.wst.jsdt.ui.superType.name
Normal file
@ -0,0 +1 @@
|
||||
Window
|
||||
2
.settings/org.eclipse.wst.validation.prefs
Normal file
2
.settings/org.eclipse.wst.validation.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
disabled=06target
|
||||
eclipse.preferences.version=1
|
||||
3
build.number
Normal file
3
build.number
Normal file
@ -0,0 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Wed Nov 05 11:17:33 CST 2014
|
||||
build.number=2
|
||||
BIN
javassist-3.15.0-GA.jar
Normal file
BIN
javassist-3.15.0-GA.jar
Normal file
Binary file not shown.
401
pom.xml
Normal file
401
pom.xml
Normal file
@ -0,0 +1,401 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.cdrcb</groupId>
|
||||
<artifactId>we3e</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>alipay Maven Webapp</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<repositories>
|
||||
<!-- 官方maven仓库 -->
|
||||
<repository>
|
||||
<id>maven</id>
|
||||
<name>Maven Repository Switchboard</name>
|
||||
<layout>default</layout>
|
||||
<url>http://repo1.maven.org/maven2</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- alibaba maven仓库 -->
|
||||
<repository>
|
||||
<id>alibaba-opensource</id>
|
||||
<name>alibaba-opensource</name>
|
||||
<url>http://code.alibabatech.com/mvn/releases/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>alibaba-opensource-snapshot</id>
|
||||
<name>alibaba-opensource-snapshot</name>
|
||||
<url>http://code.alibabatech.com/mvn/snapshots/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<!-- 指定项目编码 -->
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- alipay -->
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 钉钉-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dingtalk.open</groupId>
|
||||
<artifactId>app-stream-client</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.thetransactioncompany</groupId>
|
||||
<artifactId>cors-filter</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-logging</groupId>-->
|
||||
<!-- <artifactId>commons-logging</artifactId>-->
|
||||
<!-- <version>1.1.3</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.servlet</groupId>-->
|
||||
<!-- <artifactId>servlet-api</artifactId>-->
|
||||
<!-- <version>1.0</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/servlet-api.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
||||
<version>8.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet.jsp</groupId>
|
||||
<artifactId>jakarta.servlet.jsp-api</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.0.25.Final</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/netty-all-4.0.25.Final.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- log4j-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.23.1</version> <!-- 替换为最新版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.23.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j2-impl</artifactId>
|
||||
<version>2.23.1</version>
|
||||
</dependency>
|
||||
<!-- slf4j -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.slf4j</groupId>-->
|
||||
<!-- <artifactId>slf4j-api</artifactId>-->
|
||||
<!-- <version>1.7.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.slf4j</groupId>-->
|
||||
<!-- <artifactId>slf4j-log4j12</artifactId>-->
|
||||
<!-- <version>1.7.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- junit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- log4j -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>log4j</groupId>-->
|
||||
<!-- <artifactId>log4j</artifactId>-->
|
||||
<!-- <version>1.2.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- aspectjweaver -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.26</version>
|
||||
</dependency>
|
||||
|
||||
<!-- druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- json -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.53</version>
|
||||
</dependency>
|
||||
|
||||
<!-- struts2 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>7.0.0</version>
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||
<!-- <artifactId>log4j-api</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>7.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-json-plugin</artifactId>
|
||||
<version>7.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
<version>7.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.opensymphony</groupId>-->
|
||||
<!-- <artifactId>xwork-core</artifactId>-->
|
||||
<!-- <version>2.1.6</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- Spring 3 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Java转xml工具 -->
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.17</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.12.1.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>sdk</artifactId>
|
||||
<version>6.1.7</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.17.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>4.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- no more than 2.3.3-->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<!--JAXB API-->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.4.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>we3e</finalName>
|
||||
<plugins>
|
||||
<!--<plugin>
|
||||
<groupId>org.apache.maven.plugin</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<compilerVersion>17</compilerVersion>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
59
src/main/java/com/qq/weixin/mp/aes/AesException.java
Normal file
59
src/main/java/com/qq/weixin/mp/aes/AesException.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class AesException extends Exception {
|
||||
|
||||
public final static int OK = 0;
|
||||
public final static int ValidateSignatureError = -40001;
|
||||
public final static int ParseXmlError = -40002;
|
||||
public final static int ComputeSignatureError = -40003;
|
||||
public final static int IllegalAesKey = -40004;
|
||||
public final static int ValidateCorpidError = -40005;
|
||||
public final static int EncryptAESError = -40006;
|
||||
public final static int DecryptAESError = -40007;
|
||||
public final static int IllegalBuffer = -40008;
|
||||
//public final static int EncodeBase64Error = -40009;
|
||||
//public final static int DecodeBase64Error = -40010;
|
||||
//public final static int GenReturnXmlError = -40011;
|
||||
|
||||
private int code;
|
||||
|
||||
private static String getMessage(int code) {
|
||||
switch (code) {
|
||||
case ValidateSignatureError:
|
||||
return "签名验证错误";
|
||||
case ParseXmlError:
|
||||
return "xml解析失败";
|
||||
case ComputeSignatureError:
|
||||
return "sha加密生成签名失败";
|
||||
case IllegalAesKey:
|
||||
return "SymmetricKey非法";
|
||||
case ValidateCorpidError:
|
||||
return "corpid校验失败";
|
||||
case EncryptAESError:
|
||||
return "aes加密失败";
|
||||
case DecryptAESError:
|
||||
return "aes解密失败";
|
||||
case IllegalBuffer:
|
||||
return "解密后得到的buffer非法";
|
||||
// case EncodeBase64Error:
|
||||
// return "base64加密错误";
|
||||
// case DecodeBase64Error:
|
||||
// return "base64解密错误";
|
||||
// case GenReturnXmlError:
|
||||
// return "xml生成失败";
|
||||
default:
|
||||
return null; // cannot be
|
||||
}
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
AesException(int code) {
|
||||
super(getMessage(code));
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
||||
26
src/main/java/com/qq/weixin/mp/aes/ByteGroup.java
Normal file
26
src/main/java/com/qq/weixin/mp/aes/ByteGroup.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ByteGroup {
|
||||
ArrayList<Byte> byteContainer = new ArrayList<Byte>();
|
||||
|
||||
public byte[] toBytes() {
|
||||
byte[] bytes = new byte[byteContainer.size()];
|
||||
for (int i = 0; i < byteContainer.size(); i++) {
|
||||
bytes[i] = byteContainer.get(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public ByteGroup addBytes(byte[] bytes) {
|
||||
for (byte b : bytes) {
|
||||
byteContainer.add(b);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return byteContainer.size();
|
||||
}
|
||||
}
|
||||
67
src/main/java/com/qq/weixin/mp/aes/PKCS7Encoder.java
Normal file
67
src/main/java/com/qq/weixin/mp/aes/PKCS7Encoder.java
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 对公众平台发送给公众账号的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 提供基于PKCS7算法的加解密接口.
|
||||
*/
|
||||
class PKCS7Encoder {
|
||||
static Charset CHARSET = Charset.forName("utf-8");
|
||||
static int BLOCK_SIZE = 32;
|
||||
|
||||
/**
|
||||
* 获得对明文进行补位填充的字节.
|
||||
*
|
||||
* @param count 需要进行填充补位操作的明文字节个数
|
||||
* @return 补齐用的字节数组
|
||||
*/
|
||||
static byte[] encode(int count) {
|
||||
// 计算需要填充的位数
|
||||
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
|
||||
if (amountToPad == 0) {
|
||||
amountToPad = BLOCK_SIZE;
|
||||
}
|
||||
// 获得补位所用的字符
|
||||
char padChr = chr(amountToPad);
|
||||
String tmp = new String();
|
||||
for (int index = 0; index < amountToPad; index++) {
|
||||
tmp += padChr;
|
||||
}
|
||||
return tmp.getBytes(CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除解密后明文的补位字符
|
||||
*
|
||||
* @param decrypted 解密后的明文
|
||||
* @return 删除补位字符后的明文
|
||||
*/
|
||||
static byte[] decode(byte[] decrypted) {
|
||||
int pad = (int) decrypted[decrypted.length - 1];
|
||||
if (pad < 1 || pad > 32) {
|
||||
pad = 0;
|
||||
}
|
||||
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字转化成ASCII码对应的字符,用于对明文进行补码
|
||||
*
|
||||
* @param a 需要转化的数字
|
||||
* @return 转化得到的字符
|
||||
*/
|
||||
static char chr(int a) {
|
||||
byte target = (byte) (a & 0xFF);
|
||||
return (char) target;
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/com/qq/weixin/mp/aes/SHA1.java
Normal file
61
src/main/java/com/qq/weixin/mp/aes/SHA1.java
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 对公众平台发送给公众账号的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* SHA1 class
|
||||
*
|
||||
* 计算公众平台的消息签名接口.
|
||||
*/
|
||||
class SHA1 {
|
||||
|
||||
/**
|
||||
* 用SHA1算法生成安全签名
|
||||
* @param token 票据
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机字符串
|
||||
* @param encrypt 密文
|
||||
* @return 安全签名
|
||||
* @throws AesException
|
||||
*/
|
||||
public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException
|
||||
{
|
||||
try {
|
||||
String[] array = new String[] { token, timestamp, nonce, encrypt };
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// 字符串排序
|
||||
Arrays.sort(array);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sb.append(array[i]);
|
||||
}
|
||||
String str = sb.toString();
|
||||
// SHA1签名生成
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||
md.update(str.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
|
||||
StringBuffer hexstr = new StringBuffer();
|
||||
String shaHex = "";
|
||||
for (int i = 0; i < digest.length; i++) {
|
||||
shaHex = Integer.toHexString(digest[i] & 0xFF);
|
||||
if (shaHex.length() < 2) {
|
||||
hexstr.append(0);
|
||||
}
|
||||
hexstr.append(shaHex);
|
||||
}
|
||||
return hexstr.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.ComputeSignatureError);
|
||||
}
|
||||
}
|
||||
}
|
||||
135
src/main/java/com/qq/weixin/mp/aes/Sample.java
Normal file
135
src/main/java/com/qq/weixin/mp/aes/Sample.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import com.qq.weixin.mp.aes.WXBizMsgCrypt;
|
||||
|
||||
public class Sample {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
/*
|
||||
------------使用示例一:验证回调URL---------------
|
||||
*企业开启回调模式时,企业号会向验证url发送一个get请求
|
||||
假设点击验证时,企业收到类似请求:
|
||||
* GET /cgi-bin/wxpush?msg_signature=5c45ff5e21c57e6ad56bac8758b79b1d9ac89fd3×tamp=1409659589&nonce=263014780&echostr=P9nAzCzyDtyTWESHep1vC5X9xho%2FqYX3Zpb4yKa9SKld1DsH3Iyt3tP3zNdtp%2B4RPcs8TgAE7OaBO%2BFZXvnaqQ%3D%3D
|
||||
* HTTP/1.1 Host: qy.weixin.qq.com
|
||||
|
||||
接收到该请求时,企业应 1.解析出Get请求的参数,包括消息体签名(msg_signature),时间戳(timestamp),随机数字串(nonce)以及公众平台推送过来的随机加密字符串(echostr),
|
||||
这一步注意作URL解码。
|
||||
2.验证消息体签名的正确性
|
||||
3. 解密出echostr原文,将原文当作Get请求的response,返回给公众平台
|
||||
第2,3步可以用公众平台提供的库函数VerifyURL来实现。
|
||||
|
||||
*/
|
||||
// 解析出url上的参数值如下:
|
||||
// String sVerifyMsgSig = HttpUtils.ParseUrl("msg_signature");
|
||||
String sVerifyMsgSig = "97dff8a494d9da7e5dd7a4c6df14a38b843aa22c";
|
||||
// String sVerifyTimeStamp = HttpUtils.ParseUrl("timestamp");
|
||||
String sVerifyTimeStamp = "1421854220";
|
||||
// String sVerifyNonce = HttpUtils.ParseUrl("nonce");
|
||||
String sVerifyNonce = "1585428936";
|
||||
// String sVerifyEchoStr = HttpUtils.ParseUrl("echostr");
|
||||
String sVerifyEchoStr = "U6SpuYDqCQp8atyZidMqCyUNZQ0NB2Q4HfpC0dwVWCDaylBIMzImCwlE03PWk/qTBqufpgt7ULBvLkayCBGJKw==";
|
||||
String sEchoStr; //需要返回的明文
|
||||
try {
|
||||
sEchoStr = WXBizMsgCrypt.VerifyURL(sVerifyMsgSig, sVerifyTimeStamp,
|
||||
sVerifyNonce, sVerifyEchoStr);
|
||||
System.out.println("verifyurl echostr: " + sEchoStr);
|
||||
// 验证URL成功,将sEchoStr返回
|
||||
// HttpUtils.SetResponse(sEchoStr);
|
||||
} catch (Exception e) {
|
||||
//验证URL失败,错误原因请查看异常
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
------------使用示例二:对用户回复的消息解密---------------
|
||||
用户回复消息或者点击事件响应时,企业会收到回调消息,此消息是经过公众平台加密之后的密文以post形式发送给企业,密文格式请参考官方文档
|
||||
假设企业收到公众平台的回调消息如下:
|
||||
POST /cgi-bin/wxpush? msg_signature=477715d11cdb4164915debcba66cb864d751f3e6×tamp=1409659813&nonce=1372623149 HTTP/1.1
|
||||
Host: qy.weixin.qq.com
|
||||
Content-Length: 613
|
||||
<xml> <ToUserName><![CDATA[wx5823bf96d3bd56c7]]></ToUserName><Encrypt><![CDATA[RypEvHKD8QQKFhvQ6QleEB4J58tiPdvo+rtK1I9qca6aM/wvqnLSV5zEPeusUiX5L5X/0lWfrf0QADHHhGd3QczcdCUpj911L3vg3W/sYYvuJTs3TUUkSUXxaccAS0qhxchrRYt66wiSpGLYL42aM6A8dTT+6k4aSknmPj48kzJs8qLjvd4Xgpue06DOdnLxAUHzM6+kDZ+HMZfJYuR+LtwGc2hgf5gsijff0ekUNXZiqATP7PF5mZxZ3Izoun1s4zG4LUMnvw2r+KqCKIw+3IQH03v+BCA9nMELNqbSf6tiWSrXJB3LAVGUcallcrw8V2t9EL4EhzJWrQUax5wLVMNS0+rUPA3k22Ncx4XXZS9o0MBH27Bo6BpNelZpS+/uh9KsNlY6bHCmJU9p8g7m3fVKn28H3KDYA5Pl/T8Z1ptDAVe0lXdQ2YoyyH2uyPIGHBZZIs2pDBS8R07+qN+E7Q==]]></Encrypt>
|
||||
<AgentID><![CDATA[218]]></AgentID>
|
||||
</xml>
|
||||
|
||||
企业收到post请求之后应该 1.解析出url上的参数,包括消息体签名(msg_signature),时间戳(timestamp)以及随机数字串(nonce)
|
||||
2.验证消息体签名的正确性。
|
||||
3.将post请求的数据进行xml解析,并将<Encrypt>标签的内容进行解密,解密出来的明文即是用户回复消息的明文,明文格式请参考官方文档
|
||||
第2,3步可以用公众平台提供的库函数DecryptMsg来实现。
|
||||
*/
|
||||
// String sReqMsgSig = HttpUtils.ParseUrl("msg_signature");
|
||||
String sReqMsgSig = "477715d11cdb4164915debcba66cb864d751f3e6";
|
||||
// String sReqTimeStamp = HttpUtils.ParseUrl("timestamp");
|
||||
String sReqTimeStamp = "1409659813";
|
||||
// String sReqNonce = HttpUtils.ParseUrl("nonce");
|
||||
String sReqNonce = "1372623149";
|
||||
// post请求的密文数据
|
||||
// sReqData = HttpUtils.PostData();
|
||||
String sReqData = "<xml><ToUserName><![CDATA[wx5823bf96d3bd56c7]]></ToUserName><Encrypt><![CDATA[RypEvHKD8QQKFhvQ6QleEB4J58tiPdvo+rtK1I9qca6aM/wvqnLSV5zEPeusUiX5L5X/0lWfrf0QADHHhGd3QczcdCUpj911L3vg3W/sYYvuJTs3TUUkSUXxaccAS0qhxchrRYt66wiSpGLYL42aM6A8dTT+6k4aSknmPj48kzJs8qLjvd4Xgpue06DOdnLxAUHzM6+kDZ+HMZfJYuR+LtwGc2hgf5gsijff0ekUNXZiqATP7PF5mZxZ3Izoun1s4zG4LUMnvw2r+KqCKIw+3IQH03v+BCA9nMELNqbSf6tiWSrXJB3LAVGUcallcrw8V2t9EL4EhzJWrQUax5wLVMNS0+rUPA3k22Ncx4XXZS9o0MBH27Bo6BpNelZpS+/uh9KsNlY6bHCmJU9p8g7m3fVKn28H3KDYA5Pl/T8Z1ptDAVe0lXdQ2YoyyH2uyPIGHBZZIs2pDBS8R07+qN+E7Q==]]></Encrypt><AgentID><![CDATA[218]]></AgentID></xml>";
|
||||
|
||||
try {
|
||||
String sMsg = WXBizMsgCrypt.DecryptMsg(sReqMsgSig, sReqTimeStamp, sReqNonce, sReqData);
|
||||
System.out.println("after decrypt msg: " + sMsg);
|
||||
// TODO: 解析出明文xml标签的内容进行处理
|
||||
// For example:
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
StringReader sr = new StringReader(sMsg);
|
||||
InputSource is = new InputSource(sr);
|
||||
Document document = db.parse(is);
|
||||
|
||||
Element root = document.getDocumentElement();
|
||||
NodeList nodelist1 = root.getElementsByTagName("Content");
|
||||
String Content = nodelist1.item(0).getTextContent();
|
||||
System.out.println("Content:" + Content);
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO
|
||||
// 解密失败,失败原因请查看异常
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
------------使用示例三:企业回复用户消息的加密---------------
|
||||
企业被动回复用户的消息也需要进行加密,并且拼接成密文格式的xml串。
|
||||
假设企业需要回复用户的明文如下:
|
||||
<xml>
|
||||
<ToUserName><![CDATA[mycreate]]></ToUserName>
|
||||
<FromUserName><![CDATA[wx5823bf96d3bd56c7]]></FromUserName>
|
||||
<CreateTime>1348831860</CreateTime>
|
||||
<MsgType><![CDATA[text]]></MsgType>
|
||||
<Content><![CDATA[this is a test]]></Content>
|
||||
<MsgId>1234567890123456</MsgId>
|
||||
<AgentID>128</AgentID>
|
||||
</xml>
|
||||
|
||||
为了将此段明文回复给用户,企业应: 1.自己生成时间时间戳(timestamp),随机数字串(nonce)以便生成消息体签名,也可以直接用从公众平台的post url上解析出的对应值。
|
||||
2.将明文加密得到密文。 3.用密文,步骤1生成的timestamp,nonce和企业在公众平台设定的token生成消息体签名。 4.将密文,消息体签名,时间戳,随机数字串拼接成xml格式的字符串,发送给企业。
|
||||
以上2,3,4步可以用公众平台提供的库函数EncryptMsg来实现。
|
||||
*/
|
||||
String sRespData = "<xml><ToUserName><![CDATA[mycreate]]></ToUserName><FromUserName><![CDATA[wx5823bf96d3bd56c7]]></FromUserName><CreateTime>1348831860</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[this is a test]]></Content><MsgId>1234567890123456</MsgId><AgentID>128</AgentID></xml>";
|
||||
try{
|
||||
String sEncryptMsg = WXBizMsgCrypt.EncryptMsg(sRespData, sReqTimeStamp, sReqNonce);
|
||||
System.out.println("after encrypt sEncrytMsg: " + sEncryptMsg);
|
||||
// 加密成功
|
||||
// TODO:
|
||||
// HttpUtils.SetResponse(sEncryptMsg);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
// 加密失败
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
284
src/main/java/com/qq/weixin/mp/aes/WXBizMsgCrypt.java
Normal file
284
src/main/java/com/qq/weixin/mp/aes/WXBizMsgCrypt.java
Normal file
@ -0,0 +1,284 @@
|
||||
/**
|
||||
* 对公众平台发送给公众账号的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 针对org.apache.commons.codec.binary.Base64,
|
||||
* 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本)
|
||||
* 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi
|
||||
*/
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import com.we3e.util.OprerationProperties;
|
||||
|
||||
/**
|
||||
* 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
|
||||
* <ol>
|
||||
* <li>第三方回复加密消息给公众平台</li>
|
||||
* <li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li>
|
||||
* </ol>
|
||||
* 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案
|
||||
* <ol>
|
||||
* <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址:
|
||||
* http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li>
|
||||
* <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li>
|
||||
* <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li>
|
||||
* <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li>
|
||||
* </ol>
|
||||
*/
|
||||
public class WXBizMsgCrypt {
|
||||
static Charset CHARSET = Charset.forName("utf-8");
|
||||
static Base64 base64 = new Base64();
|
||||
static byte[] aesKey = Base64.decodeBase64(OprerationProperties.getInstancei().getPropList().get("privatekey_wechat")+"=");
|
||||
static String token = OprerationProperties.getInstancei().getPropList().get("token");
|
||||
static String corpId = OprerationProperties.getInstancei().getPropList().get("appId_wechat");
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param token 公众平台上,开发者设置的token
|
||||
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
|
||||
* @param corpId 企业的corpid
|
||||
*
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public WXBizMsgCrypt() {
|
||||
}
|
||||
|
||||
// 生成4个字节的网络字节序
|
||||
static byte[] getNetworkBytesOrder(int sourceNumber) {
|
||||
byte[] orderBytes = new byte[4];
|
||||
orderBytes[3] = (byte) (sourceNumber & 0xFF);
|
||||
orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
|
||||
orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
|
||||
orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
|
||||
return orderBytes;
|
||||
}
|
||||
|
||||
// 还原4个字节的网络字节序
|
||||
static int recoverNetworkBytesOrder(byte[] orderBytes) {
|
||||
int sourceNumber = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sourceNumber <<= 8;
|
||||
sourceNumber |= orderBytes[i] & 0xff;
|
||||
}
|
||||
return sourceNumber;
|
||||
}
|
||||
|
||||
// 随机生成16位字符串
|
||||
static String getRandomStr() {
|
||||
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
Random random = new Random();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int number = random.nextInt(base.length());
|
||||
sb.append(base.charAt(number));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 对明文进行加密.
|
||||
*
|
||||
* @param text 需要加密的明文
|
||||
* @return 加密后base64编码的字符串
|
||||
* @throws AesException aes加密失败
|
||||
*/
|
||||
static String encrypt(String randomStr, String text) throws AesException {
|
||||
ByteGroup byteCollector = new ByteGroup();
|
||||
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
|
||||
byte[] textBytes = text.getBytes(CHARSET);
|
||||
byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
|
||||
byte[] corpidBytes = corpId.getBytes(CHARSET);
|
||||
|
||||
// randomStr + networkBytesOrder + text + corpid
|
||||
byteCollector.addBytes(randomStrBytes);
|
||||
byteCollector.addBytes(networkBytesOrder);
|
||||
byteCollector.addBytes(textBytes);
|
||||
byteCollector.addBytes(corpidBytes);
|
||||
|
||||
// ... + pad: 使用自定义的填充方式对明文进行补位填充
|
||||
byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
|
||||
byteCollector.addBytes(padBytes);
|
||||
|
||||
// 获得最终的字节流, 未加密
|
||||
byte[] unencrypted = byteCollector.toBytes();
|
||||
|
||||
try {
|
||||
// 设置加密模式为AES的CBC模式
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
|
||||
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
|
||||
|
||||
// 加密
|
||||
byte[] encrypted = cipher.doFinal(unencrypted);
|
||||
|
||||
// 使用BASE64对加密后的字符串进行编码
|
||||
String base64Encrypted = base64.encodeToString(encrypted);
|
||||
|
||||
return base64Encrypted;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.EncryptAESError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密文进行解密.
|
||||
*
|
||||
* @param text 需要解密的密文
|
||||
* @return 解密得到的明文
|
||||
* @throws AesException aes解密失败
|
||||
*/
|
||||
static String decrypt(String text) throws AesException {
|
||||
byte[] original;
|
||||
try {
|
||||
// 设置解密模式为AES的CBC模式
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES");
|
||||
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
|
||||
cipher.init(Cipher.DECRYPT_MODE, key_spec, iv);
|
||||
|
||||
// 使用BASE64对密文进行解码
|
||||
byte[] encrypted = Base64.decodeBase64(text);
|
||||
|
||||
// 解密
|
||||
original = cipher.doFinal(encrypted);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.DecryptAESError);
|
||||
}
|
||||
|
||||
String xmlContent, from_corpid;
|
||||
try {
|
||||
// 去除补位字符
|
||||
byte[] bytes = PKCS7Encoder.decode(original);
|
||||
|
||||
// 分离16位随机字符串,网络字节序和corpId
|
||||
byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
|
||||
|
||||
int xmlLength = recoverNetworkBytesOrder(networkOrder);
|
||||
|
||||
xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
|
||||
from_corpid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
|
||||
CHARSET);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.IllegalBuffer);
|
||||
}
|
||||
|
||||
// corpid不相同的情况
|
||||
if (!from_corpid.equals(corpId)) {
|
||||
throw new AesException(AesException.ValidateCorpidError);
|
||||
}
|
||||
return xmlContent;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将公众平台回复用户的消息加密打包.
|
||||
* <ol>
|
||||
* <li>对要发送的消息进行AES-CBC加密</li>
|
||||
* <li>生成安全签名</li>
|
||||
* <li>将消息密文和安全签名打包成xml格式</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param replyMsg 公众平台待回复用户的消息,xml格式的字符串
|
||||
* @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp
|
||||
* @param nonce 随机串,可以自己生成,也可以用URL参数的nonce
|
||||
*
|
||||
* @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public static String EncryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
|
||||
// 加密
|
||||
String encrypt = encrypt(getRandomStr(), replyMsg);
|
||||
|
||||
// 生成安全签名
|
||||
if (timeStamp == "") {
|
||||
timeStamp = Long.toString(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt);
|
||||
|
||||
// System.out.println("发送给平台的签名是: " + signature[1].toString());
|
||||
// 生成发送的xml
|
||||
String result = XMLParse.generate(encrypt, signature, timeStamp, nonce);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验消息的真实性,并且获取解密后的明文.
|
||||
* <ol>
|
||||
* <li>利用收到的密文生成安全签名,进行签名验证</li>
|
||||
* <li>若验证通过,则提取xml中的加密消息</li>
|
||||
* <li>对消息进行解密</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||
* @param nonce 随机串,对应URL参数的nonce
|
||||
* @param postData 密文,对应POST请求的数据
|
||||
*
|
||||
* @return 解密后的原文
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public static String DecryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
|
||||
throws AesException {
|
||||
|
||||
// 密钥,公众账号的app secret
|
||||
// 提取密文
|
||||
Object[] encrypt = XMLParse.extract(postData);
|
||||
|
||||
// 验证安全签名
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString());
|
||||
|
||||
// 和URL中的签名比较是否相等
|
||||
// System.out.println("第三方收到URL中的签名:" + msg_sign);
|
||||
// System.out.println("第三方校验签名:" + signature);
|
||||
if (!signature.equals(msgSignature)) {
|
||||
throw new AesException(AesException.ValidateSignatureError);
|
||||
}
|
||||
|
||||
// 解密
|
||||
String result = decrypt(encrypt[1].toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证URL
|
||||
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||
* @param nonce 随机串,对应URL参数的nonce
|
||||
* @param echoStr 随机串,对应URL参数的echostr
|
||||
*
|
||||
* @return 解密之后的echostr
|
||||
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||
*/
|
||||
public static String VerifyURL(String msgSignature, String timeStamp, String nonce, String echoStr)
|
||||
throws AesException {
|
||||
String signature = SHA1.getSHA1(token, timeStamp, nonce, echoStr);
|
||||
|
||||
if (!signature.equals(msgSignature)) {
|
||||
throw new AesException(AesException.ValidateSignatureError);
|
||||
}
|
||||
|
||||
String result = decrypt(echoStr);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
72
src/main/java/com/qq/weixin/mp/aes/XMLParse.java
Normal file
72
src/main/java/com/qq/weixin/mp/aes/XMLParse.java
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* 对公众平台发送给公众账号的消息加解密示例代码.
|
||||
*
|
||||
* @copyright Copyright (c) 1998-2014 Tencent Inc.
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
package com.qq.weixin.mp.aes;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* XMLParse class
|
||||
*
|
||||
* 提供提取消息格式中的密文及生成回复消息格式的接口.
|
||||
*/
|
||||
class XMLParse {
|
||||
|
||||
/**
|
||||
* 提取出xml数据包中的加密消息
|
||||
* @param xmltext 待提取的xml字符串
|
||||
* @return 提取出的加密消息字符串
|
||||
* @throws AesException
|
||||
*/
|
||||
public static Object[] extract(String xmltext) throws AesException {
|
||||
Object[] result = new Object[3];
|
||||
try {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
StringReader sr = new StringReader(xmltext);
|
||||
InputSource is = new InputSource(sr);
|
||||
Document document = db.parse(is);
|
||||
|
||||
Element root = document.getDocumentElement();
|
||||
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
|
||||
NodeList nodelist2 = root.getElementsByTagName("ToUserName");
|
||||
result[0] = 0;
|
||||
result[1] = nodelist1.item(0).getTextContent();
|
||||
result[2] = nodelist2.item(0).getTextContent();
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new AesException(AesException.ParseXmlError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成xml消息
|
||||
* @param encrypt 加密后的消息密文
|
||||
* @param signature 安全签名
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机字符串
|
||||
* @return 生成的xml字符串
|
||||
*/
|
||||
public static String generate(String encrypt, String signature, String timestamp, String nonce) {
|
||||
|
||||
String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
|
||||
+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
|
||||
+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
|
||||
return String.format(format, encrypt, signature, timestamp, nonce);
|
||||
|
||||
}
|
||||
}
|
||||
88
src/main/java/com/we3e/action/BaseAction.java
Normal file
88
src/main/java/com/we3e/action/BaseAction.java
Normal file
@ -0,0 +1,88 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.util.JSONTransValueToString;
|
||||
import org.apache.struts2.ActionSupport;
|
||||
import org.apache.struts2.Preparable;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
|
||||
import org.apache.struts2.action.SessionAware;
|
||||
import org.apache.struts2.convention.annotation.Namespace;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@ParentPackage("default")
|
||||
@Namespace("/")
|
||||
public class BaseAction extends ActionSupport implements SessionAware, Preparable {
|
||||
|
||||
protected Map<String, Object> session;
|
||||
private String nextAction;
|
||||
private String errorMessage;
|
||||
public void writeJson(Object object){
|
||||
JSONObject jobj = new JSONObject();
|
||||
try{
|
||||
String json = JSON.toJSONStringWithDateFormat(object,"yyyy-MM-dd HH:mm:ss");
|
||||
JSONTransValueToString.parseJsonString(json,jobj);
|
||||
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
|
||||
// ServletActionContext.getResponse().getWriter().write(json);
|
||||
ServletActionContext.getResponse().getWriter().write(jobj.toJSONString());
|
||||
ServletActionContext.getResponse().getWriter().flush();
|
||||
ServletActionContext.getResponse().getWriter().close();
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void writeJsonNew(Object object){
|
||||
// JSONObject jobj = new JSONObject();
|
||||
try{
|
||||
String json = JSON.toJSONStringWithDateFormat(object,"yyyy-MM-dd HH:mm:ss");
|
||||
// JSONTransValueToString.parseJsonString(json,jobj);
|
||||
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
|
||||
// ServletActionContext.getResponse().getWriter().write(json);
|
||||
ServletActionContext.getResponse().getWriter().write(json);
|
||||
ServletActionContext.getResponse().getWriter().flush();
|
||||
ServletActionContext.getResponse().getWriter().close();
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void prepare() throws Exception {
|
||||
clearErrorsAndMessages();
|
||||
}
|
||||
|
||||
public Map<String, Object> getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void setSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public String getNextAction() {
|
||||
return nextAction;
|
||||
}
|
||||
|
||||
public void setNextAction(String nextAction) {
|
||||
this.nextAction = nextAction;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withSession(Map<String, Object> session) {
|
||||
this.session = session;
|
||||
}
|
||||
}
|
||||
48
src/main/java/com/we3e/action/CreateMenuAction.java
Normal file
48
src/main/java/com/we3e/action/CreateMenuAction.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.service.WeChatSendMessageService;
|
||||
import com.we3e.util.CommonInfo;
|
||||
|
||||
@Controller("createMenuAction")
|
||||
@Scope("prototype")
|
||||
public class CreateMenuAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(CreateMenuAction.class);
|
||||
@Autowired
|
||||
private WeChatSendMessageService weChatSendMessageService;
|
||||
private String menu;
|
||||
private String userid;
|
||||
private String pass;
|
||||
|
||||
public void setMenu(String menu) {
|
||||
this.menu = menu;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public void setPass(String pass) {
|
||||
this.pass = pass;
|
||||
}
|
||||
|
||||
public void createMenu(){
|
||||
if(userid.equals("goodwe3e")&&pass.equals("E10ADC3949BA59ABBE56E057F20F883E"))
|
||||
weChatSendMessageService.sendMessageByTokenUrl(CommonInfo.createMenuUrl(),"POST",menu);
|
||||
Json j = new Json();
|
||||
j.setSuccess(true);
|
||||
j.setMsg("OK");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
300
src/main/java/com/we3e/action/DingNextStepAction.java
Normal file
300
src/main/java/com/we3e/action/DingNextStepAction.java
Normal file
@ -0,0 +1,300 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.taobao.api.ApiException;
|
||||
import com.we3e.model.page.JsSignUtil;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.teacher.BindAcc;
|
||||
import com.we3e.model.teacher.QueryBind;
|
||||
import com.we3e.service.UserInfoService;
|
||||
import com.we3e.service.WeChatSendMessageService;
|
||||
import com.we3e.util.*;
|
||||
import com.we3e.util.wechat.JsSign;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
@Controller("dingNextStepAction")
|
||||
@Scope("prototype")
|
||||
public class DingNextStepAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(DingNextStepAction.class);
|
||||
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
private WeChatSendMessageService weChatSendMessageService;
|
||||
private JsSignUtil jsSign;
|
||||
private BindAcc bacc;
|
||||
private String state;
|
||||
|
||||
private String code;
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public BindAcc getBacc() {
|
||||
return bacc;
|
||||
}
|
||||
|
||||
public void setBacc(BindAcc bacc) {
|
||||
this.bacc = bacc;
|
||||
}
|
||||
|
||||
|
||||
public JsSignUtil getJsSign() {
|
||||
return jsSign;
|
||||
}
|
||||
|
||||
public String execute() throws ApiException {
|
||||
//通过code获取当前用户id并设置session
|
||||
logger.info("获取信息:"+state+" "+code);
|
||||
String codebak = code;
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid!=null&&!state.equals("bindAcc")){
|
||||
code=uid.toString();
|
||||
}else if(code!=null)
|
||||
{
|
||||
//测试的时候注释//
|
||||
code = userInfoService.getUseridFromDing(code);
|
||||
//===============//
|
||||
if(code==null){
|
||||
// setErrorMessage("获取微信数据失败,请稍后重试。");
|
||||
setNextAction("/app/wechatlogin.jsp");
|
||||
return SUCCESS;
|
||||
}
|
||||
getSession().put("openid", code);
|
||||
logger.info("微信获取的用户编号:"+code);
|
||||
// 测试
|
||||
// JSONObject acc = JSON.parseObject("{\"apiCode\":2104,\"items\":[{\"uid\":1101080200000001,\"status\":1,\"created\":\"2015-01-30 10:27:51\",\"userType\":2,\"openId\":\"马汉\"}],\"errorCode\":0}");//
|
||||
//正式
|
||||
QueryBind qb = new QueryBind(0,code,2,"single");
|
||||
JSONObject acc =userInfoService.queryAcc(qb);
|
||||
//================//
|
||||
if(acc!=null&&acc.getJSONArray("items").size()>0)
|
||||
{
|
||||
JSONObject myBindInfo = acc.getJSONArray("items").getJSONObject(0);
|
||||
getSession().put("uid", myBindInfo.getString("uid"));
|
||||
logger.info("查询到绑定信息code:"+myBindInfo.getString("uid"));
|
||||
JSONObject myinfo = userInfoService.queryUserInfo(myBindInfo.getLong("uid"));
|
||||
if(myinfo!=null&&!myinfo.isEmpty()){
|
||||
getSession().put("userName",myinfo.get("truename"));
|
||||
getSession().put("myPic", myinfo.get("avatar"));
|
||||
int sec = (Integer)myinfo.get("studyDuration");
|
||||
int min = (sec%3600)/60;
|
||||
int hour = sec/3600;
|
||||
getSession().put("studyDuration", hour+"h "+min+"m");
|
||||
// 调用单词登录获取token,没有token 调用单词的接口不行
|
||||
String token = vocabularyLogin(myBindInfo.getLongValue("uid"));
|
||||
getSession().put("vocabularyToken", token);
|
||||
}else{
|
||||
getSession().clear();
|
||||
logger.info("2015调用失败");
|
||||
setErrorMessage("教师信息获取失败,请稍后重试。");
|
||||
return ERROR;
|
||||
}
|
||||
}else{
|
||||
//未绑定 进入绑定
|
||||
if(getSession().get("token")==null){
|
||||
String rannum = EncDecUtil.getRandomStr(6);
|
||||
getSession().put("rannum",rannum);
|
||||
String token = EncDecUtil.getXXTEAEncring(code, rannum);
|
||||
getSession().put("token",token);
|
||||
}
|
||||
setNextAction(OprerationProperties.getInstancei().getNextList().get("bindAccDing"));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
else code = "";
|
||||
if(code==null||code.equals("")||state==null){
|
||||
setNextAction(OprerationProperties.getInstancei().getNextList().get("errorPath"));
|
||||
}else if(state!=null&&!state.equals("")){
|
||||
if(state.equals("bindAcc")){
|
||||
setErrorMessage("您已绑定账号。");
|
||||
return "bindingDing";
|
||||
}
|
||||
if(state.equals("chwork")||state.equals("goodvoice")||state.equals("chexam")||state.equals("xueba")||state.equals("sctotal")||state.equals("chwordwork")||state.equals("qinxue")||state.equals("sctotal1")||state.equals("tcreport"))
|
||||
{
|
||||
// jsSign = JsSign.sign(weChatSendMessageService.getJsToken().getTicket(), CommonInfo.getMyDNS() +"nextStepAction.action?code="+codebak+"&state="+state);
|
||||
// jsSign.setJsapi_ticket(System.currentTimeMillis()+""+new Random().nextInt(3));
|
||||
}
|
||||
String nextJsp=OprerationProperties.getInstancei().getNextList().get(state);
|
||||
if(nextJsp!=null)
|
||||
setNextAction(nextJsp);
|
||||
else return "error404";
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public String vocabularyLogin(Long userId) {
|
||||
|
||||
HttpClient httpclient = HttpClientBuilder.create().build();
|
||||
String value = ServerConfig.getValue("3E_WORD_DNS");
|
||||
|
||||
HttpPost http = new HttpPost(value+"/user/app/login" + "?" + "studentId=" + userId);
|
||||
String json = null;
|
||||
try {
|
||||
HttpResponse response = httpclient.execute(http);
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
json = EntityUtils.toString(entity, "UTF-8").trim();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
json = jsonObject.getString("data");
|
||||
}
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
http.abort();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public void bindAcc(){
|
||||
Json j = new Json();
|
||||
Object openid = getSession().get("openid");
|
||||
if(openid==null||bacc.getLoginNo()==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户Openid");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String checkMcode = getSession().get("checkMcode")+"";
|
||||
if(!checkMcode.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的验证码错误,请重新输入");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
bacc.setCellphone(getSession().get("bindMobileNo")+"");
|
||||
bacc.setLoginNo(bacc.getLoginNo().trim());
|
||||
bacc.setOpenId(openid.toString());
|
||||
bacc.setUserType(2); //教师
|
||||
bacc.setPassword(getmima(bacc.getPassword()));
|
||||
String res=userInfoService.bindAcc(bacc);
|
||||
if(res.equals("0")){
|
||||
getSession().clear();
|
||||
j.setSuccess(true);
|
||||
j.setMsg("绑定成功");
|
||||
getSession().remove("checkMcode");
|
||||
getSession().remove("bindMobileNo");
|
||||
}else if(res.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("绑定失败,请重试");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(res);
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void deleteSession(){
|
||||
if(getSession() != null){
|
||||
getSession().clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void bindAccDing(){
|
||||
Json j = new Json();
|
||||
Object openid = getSession().get("openid");
|
||||
if(openid==null||bacc.getLoginNo()==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户Openid");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String checkMcode = getSession().get("checkMcode")+"";
|
||||
if(!checkMcode.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的验证码错误,请重新输入");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
bacc.setCellphone(getSession().get("bindMobileNo")+"");
|
||||
bacc.setLoginNo(bacc.getLoginNo().trim());
|
||||
bacc.setOpenId(openid.toString());
|
||||
bacc.setUserType(2); //教师
|
||||
bacc.setPassword(getmima(bacc.getPassword()));
|
||||
bacc.setType(2);
|
||||
String res=userInfoService.bindAcc(bacc);
|
||||
if(res.equals("0")){
|
||||
getSession().clear();
|
||||
j.setSuccess(true);
|
||||
j.setMsg("绑定成功");
|
||||
getSession().remove("checkMcode");
|
||||
getSession().remove("bindMobileNo");
|
||||
}else if(res.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("绑定失败,请重试");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(res);
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void getRandomStr() {
|
||||
char michar[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
|
||||
Random ran = new Random();
|
||||
String ranStr="";
|
||||
for(int i=0;i<=2;i++){
|
||||
int num = ran.nextInt(7);
|
||||
for(int j=0;j<=num;j++){
|
||||
ranStr += michar[ran.nextInt(36)];
|
||||
}
|
||||
if(i<2)
|
||||
ranStr+=',';
|
||||
}
|
||||
getSession().put("mimamiyao",ranStr);
|
||||
Json j = new Json();
|
||||
j.setSuccess(true);
|
||||
j.setObj(ranStr);
|
||||
super.writeJson(j);
|
||||
}
|
||||
private String getmima(String ymi){
|
||||
Des desObj = new Des();
|
||||
String ranmi = getSession().get("mimamiyao")+"";
|
||||
String mi = null;
|
||||
if(!ranmi.equals("null"))
|
||||
{
|
||||
String[] mis = ranmi.split(",");
|
||||
mi=desObj.strDec(ymi, mis[0], mis[1], mis[2]);
|
||||
//logger.info("getPass:"+mi);
|
||||
getSession().remove("mimamiyao");
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
}
|
||||
330
src/main/java/com/we3e/action/MobileCodeAction.java
Normal file
330
src/main/java/com/we3e/action/MobileCodeAction.java
Normal file
@ -0,0 +1,330 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.msg.AppConfig;
|
||||
import com.we3e.model.msg.ConfigLoader;
|
||||
import com.we3e.model.msg.MESSAGEXsend;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.util.EncDecUtil;
|
||||
import com.we3e.util.ServerConfig;
|
||||
|
||||
@Controller("mobileCode")
|
||||
@Scope("prototype")
|
||||
public class MobileCodeAction extends BaseAction {
|
||||
private static final long serialVersionUID = 48218773554898256L;
|
||||
private static final Logger logger = LogManager.getLogger(MobileCodeAction.class);
|
||||
|
||||
private String mno;
|
||||
private String mcode;
|
||||
|
||||
public String getMno() {
|
||||
return mno;
|
||||
}
|
||||
|
||||
public void setMno(String mno) {
|
||||
this.mno = mno;
|
||||
}
|
||||
|
||||
public String getMcode() {
|
||||
return mcode;
|
||||
}
|
||||
|
||||
public void setMcode(String mcode) {
|
||||
this.mcode = mcode;
|
||||
}
|
||||
|
||||
public void get(){
|
||||
Json j = new Json();
|
||||
|
||||
boolean flag = true;
|
||||
String openid = (String) getSession().get("openid");
|
||||
if(openid==null||openid.equals("")) flag = false;
|
||||
String rannum = (String) getSession().get("rannum");
|
||||
if(rannum==null||rannum.equals("")) flag = false;
|
||||
String token = (String) getSession().get("token");
|
||||
if(token==null||token.equals("")) flag = false;
|
||||
if(!flag){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("验证码通道已关闭");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
token = token+12;
|
||||
JSONObject json = EncDecUtil.XXTEADecrypt(token);
|
||||
if(json==null){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String openId = json.getString("openid");
|
||||
String ranNum = json.getString("rannum");
|
||||
String key = json.getString("secret");
|
||||
if(openId==null||openId.equals("")) flag = false;
|
||||
if(ranNum==null||ranNum.equals("")) flag = false;
|
||||
if(key==null||key.equals("")) flag = false;
|
||||
if(!flag){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long timeStamp = json.getLongValue("timeStamp");
|
||||
if(timeStamp<=0){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long now = Calendar.getInstance().getTimeInMillis();
|
||||
if(now>=timeStamp&&(now-timeStamp)>180000){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
getSession().remove("rannum");
|
||||
getSession().remove("token");
|
||||
j.setSuccess(false);
|
||||
j.setMsg("页面已过期,请重新打开页面");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
if(!openid.equals(openId)||!rannum.equals(ranNum)||!key.equals(ServerConfig.getValue("3E_SECRET"))){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
//不让频繁点击
|
||||
Object clickTime = getSession().get("clickTime");
|
||||
String oldsTime = "";
|
||||
if(clickTime==null){
|
||||
oldsTime = now+"";
|
||||
}else{
|
||||
oldsTime = getSession().get("clickTime")+"";
|
||||
if(System.currentTimeMillis() - Long.parseLong(oldsTime)<30000){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的发送频率过高,请稍后再试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(clickTime!=null) getSession().remove("clickTime");
|
||||
getSession().put("clickTime",now+"");
|
||||
|
||||
oldsTime = getSession().get("bindMsgTime")+"";
|
||||
if(!oldsTime.equals("null")&&System.currentTimeMillis() - Long.parseLong(oldsTime)<30000){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的发送频率过高,请稍后再试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String ranStr = getRandomStr(4);
|
||||
logger.info("输入手机号:"+mno+" 短信验证码:"+ranStr);
|
||||
AppConfig config = ConfigLoader.load(ConfigLoader.ConfigType.Message);
|
||||
MESSAGEXsend submail = new MESSAGEXsend(config);
|
||||
submail.addTo(mno);
|
||||
submail.setProject(config.getMessMUban());
|
||||
submail.addVar("mcode", ranStr);
|
||||
String remsg = submail.xsend();
|
||||
if(remsg==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("系统异常,请稍后重试");
|
||||
}else{
|
||||
logger.info("短信返回报文:"+remsg);
|
||||
JSONObject rejo = JSON.parseObject(remsg);
|
||||
if(rejo.getString("status").equals("success")){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("您的短信验证码已发送,请注意查收");
|
||||
getSession().put("bindMsgCode", ranStr);
|
||||
getSession().put("bindMobileNo", mno);
|
||||
getSession().put("bindMsgTime", System.currentTimeMillis());
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(rejo.getString("msg"));
|
||||
}
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getDing(){
|
||||
Json j = new Json();
|
||||
|
||||
boolean flag = true;
|
||||
String openid = (String) getSession().get("openid");
|
||||
if(openid==null||openid.equals("")) flag = false;
|
||||
String rannum = (String) getSession().get("rannum");
|
||||
if(rannum==null||rannum.equals("")) flag = false;
|
||||
String token = (String) getSession().get("token");
|
||||
if(token==null||token.equals("")) flag = false;
|
||||
if(!flag){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("验证码通道已关闭");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
token = token+12;
|
||||
JSONObject json = EncDecUtil.XXTEADecrypt(token);
|
||||
if(json==null){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String openId = json.getString("openid");
|
||||
String ranNum = json.getString("rannum");
|
||||
String key = json.getString("secret");
|
||||
if(openId==null||openId.equals("")) flag = false;
|
||||
if(ranNum==null||ranNum.equals("")) flag = false;
|
||||
if(key==null||key.equals("")) flag = false;
|
||||
if(!flag){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long timeStamp = json.getLongValue("timeStamp");
|
||||
if(timeStamp<=0){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long now = Calendar.getInstance().getTimeInMillis();
|
||||
if(now>=timeStamp&&(now-timeStamp)>180000){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
getSession().remove("rannum");
|
||||
getSession().remove("token");
|
||||
j.setSuccess(false);
|
||||
j.setMsg("页面已过期,请重新打开页面");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
if(!openid.equals(openId)||!rannum.equals(ranNum)||!key.equals(ServerConfig.getValue("3E_SECRET"))){
|
||||
logger.info("获取手机验证码的openid:"+openid);
|
||||
logger.info("token:"+token);
|
||||
j.setSuccess(false);
|
||||
j.setMsg("token错误");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
//不让频繁点击
|
||||
Object clickTime = getSession().get("clickTime");
|
||||
String oldsTime = "";
|
||||
if(clickTime==null){
|
||||
oldsTime = now+"";
|
||||
}else{
|
||||
oldsTime = getSession().get("clickTime")+"";
|
||||
if(System.currentTimeMillis() - Long.parseLong(oldsTime)<30000){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的发送频率过高,请稍后再试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(clickTime!=null) getSession().remove("clickTime");
|
||||
getSession().put("clickTime",now+"");
|
||||
|
||||
oldsTime = getSession().get("bindMsgTime")+"";
|
||||
if(!oldsTime.equals("null")&&System.currentTimeMillis() - Long.parseLong(oldsTime)<30000){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的发送频率过高,请稍后再试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String ranStr = getRandomStr(4);
|
||||
logger.info("输入手机号:"+mno+" 短信验证码:"+ranStr);
|
||||
AppConfig config = ConfigLoader.load(ConfigLoader.ConfigType.MessageDing);
|
||||
MESSAGEXsend submail = new MESSAGEXsend(config);
|
||||
submail.addTo(mno);
|
||||
submail.setProject(config.getMessMUban());
|
||||
submail.addVar("mcode", ranStr);
|
||||
String remsg = submail.xsend();
|
||||
if(remsg==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("系统异常,请稍后重试");
|
||||
}else{
|
||||
logger.info("短信返回报文:"+remsg);
|
||||
JSONObject rejo = JSON.parseObject(remsg);
|
||||
if(rejo.getString("status").equals("success")){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("您的短信验证码已发送,请注意查收");
|
||||
getSession().put("bindMsgCode", ranStr);
|
||||
getSession().put("bindMobileNo", mno);
|
||||
getSession().put("bindMsgTime", System.currentTimeMillis());
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(rejo.getString("msg"));
|
||||
}
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void check(){
|
||||
Json j = new Json();
|
||||
String msendcode = getSession().get("bindMsgCode")+"";
|
||||
String oldsTime = getSession().get("bindMsgTime")+"";
|
||||
String checkMcode = getSession().get("checkMcode")+"";
|
||||
if(checkMcode.equals("1"))
|
||||
j.setSuccess(true);
|
||||
else if(msendcode.equals("null")||oldsTime.equals("null")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您还未获取短信验证码");
|
||||
}else if(System.currentTimeMillis() - Long.parseLong(oldsTime)>600000){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的验证码已过期,请重新获取");
|
||||
}else{
|
||||
if(msendcode.equals(mcode)){
|
||||
j.setSuccess(true);
|
||||
getSession().put("checkMcode", "1");
|
||||
getSession().remove("bindMsgTime");
|
||||
getSession().remove("bindMsgCode");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您输入的验证码错误,请重新输入");
|
||||
}
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
private String getRandomStr(int num){
|
||||
String str="";
|
||||
for(int i=0;i<num;i++){
|
||||
str+=new Random().nextInt(10);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
283
src/main/java/com/we3e/action/NextStepAction.java
Normal file
283
src/main/java/com/we3e/action/NextStepAction.java
Normal file
@ -0,0 +1,283 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import com.we3e.util.*;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.page.JsSignUtil;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.teacher.BindAcc;
|
||||
import com.we3e.model.teacher.QueryBind;
|
||||
import com.we3e.service.UserInfoService;
|
||||
import com.we3e.service.WeChatSendMessageService;
|
||||
import com.we3e.util.wechat.JsSign;
|
||||
|
||||
@Controller("nextStepAction")
|
||||
//@Action("nextStepAction")
|
||||
@Scope("prototype")
|
||||
public class NextStepAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(NextStepAction.class);
|
||||
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
private WeChatSendMessageService weChatSendMessageService;
|
||||
private JsSignUtil jsSign;
|
||||
private BindAcc bacc;
|
||||
private String state;
|
||||
|
||||
private String code;
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public BindAcc getBacc() {
|
||||
return bacc;
|
||||
}
|
||||
|
||||
public void setBacc(BindAcc bacc) {
|
||||
this.bacc = bacc;
|
||||
}
|
||||
|
||||
|
||||
public JsSignUtil getJsSign() {
|
||||
return jsSign;
|
||||
}
|
||||
|
||||
public String execute(){
|
||||
//通过code获取当前用户id并设置session
|
||||
logger.info("获取信息:"+state+" "+code);
|
||||
String codebak = code;
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid!=null&&!state.equals("bindAcc")){
|
||||
code=uid.toString();
|
||||
}else if(code!=null)
|
||||
{
|
||||
//测试的时候注释//
|
||||
code = userInfoService.getUseridFromWechat(code);
|
||||
//===============//
|
||||
if(code==null){
|
||||
// setErrorMessage("获取微信数据失败,请稍后重试。");
|
||||
setNextAction("/app/wechatlogin.jsp");
|
||||
return SUCCESS;
|
||||
}
|
||||
getSession().put("openid", code);
|
||||
logger.info("微信获取的用户编号:"+code);
|
||||
// 测试
|
||||
// JSONObject acc = JSON.parseObject("{\"apiCode\":2104,\"items\":[{\"uid\":9999010200000867,\"status\":1,\"created\":\"2015-01-30 10:27:51\",\"userType\":2,\"openId\":\"马汉\"}],\"errorCode\":0}");//
|
||||
//正式
|
||||
QueryBind qb = new QueryBind(0,code,2,"single");
|
||||
JSONObject acc =userInfoService.queryAcc(qb);
|
||||
//================//
|
||||
if(acc!=null&&acc.getJSONArray("items").size()>0)
|
||||
{
|
||||
JSONObject myBindInfo = acc.getJSONArray("items").getJSONObject(0);
|
||||
getSession().put("uid", myBindInfo.getString("uid"));
|
||||
logger.info("查询到绑定信息code:"+myBindInfo.getString("uid"));
|
||||
JSONObject myinfo = userInfoService.queryUserInfo(myBindInfo.getLong("uid"));
|
||||
if(myinfo!=null&&!myinfo.isEmpty()){
|
||||
getSession().put("userName",myinfo.get("truename"));
|
||||
getSession().put("myPic", myinfo.get("avatar"));
|
||||
int sec = (Integer)myinfo.get("studyDuration");
|
||||
int min = (sec%3600)/60;
|
||||
int hour = sec/3600;
|
||||
getSession().put("studyDuration", hour+"h "+min+"m");
|
||||
// 调用单词登录获取token,没有token 调用单词的接口不行
|
||||
String token = vocabularyLogin(myBindInfo.getLongValue("uid"));
|
||||
getSession().put("vocabularyToken", token);
|
||||
// 调用阅读计划登录获取token,没有token 调用阅读计划的接口不行
|
||||
// String readPlanToken = readPlanLogin(myBindInfo.getLongValue("uid"));
|
||||
// getSession().put("readPlanToken", readPlanToken);
|
||||
}else{
|
||||
getSession().clear();
|
||||
logger.info("2015调用失败");
|
||||
setErrorMessage("教师信息获取失败,请稍后重试。");
|
||||
return ERROR;
|
||||
}
|
||||
}else{
|
||||
//未绑定 进入绑定
|
||||
if(getSession().get("token")==null){
|
||||
String rannum = EncDecUtil.getRandomStr(6);
|
||||
getSession().put("rannum",rannum);
|
||||
String token = EncDecUtil.getXXTEAEncring(code, rannum);
|
||||
getSession().put("token",token);
|
||||
}
|
||||
setNextAction(OprerationProperties.getInstancei().getNextList().get("bindAcc"));
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
else code = "";
|
||||
if(code==null||code.equals("")||state==null){
|
||||
setNextAction(OprerationProperties.getInstancei().getNextList().get("errorPath"));
|
||||
}else if(state!=null&&!state.equals("")){
|
||||
if(state.equals("bindAcc")){
|
||||
setErrorMessage("您已绑定账号。");
|
||||
return "binding";
|
||||
}
|
||||
if(state.equals("chwork")||state.equals("goodvoice")||state.equals("chexam")||state.equals("xueba")||state.equals("sctotal")||state.equals("chwordwork")||state.equals("qinxue")||state.equals("sctotal1")||state.equals("tcreport"))
|
||||
{
|
||||
jsSign = JsSign.sign(weChatSendMessageService.getJsToken().getTicket(), CommonInfo.getMyDNS() +"nextStepAction.action?code="+codebak+"&state="+state);
|
||||
jsSign.setJsapi_ticket(System.currentTimeMillis()+""+new Random().nextInt(3));
|
||||
}
|
||||
String nextJsp=OprerationProperties.getInstancei().getNextList().get(state);
|
||||
if(nextJsp!=null)
|
||||
setNextAction(nextJsp);
|
||||
else return "error404";
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public String vocabularyLogin(Long userId) {
|
||||
|
||||
HttpClient httpclient = HttpClientBuilder.create().build();
|
||||
String value = ServerConfig.getValue("3E_WORD_DNS");
|
||||
|
||||
HttpPost http = new HttpPost(value+"/user/app/login" + "?" + "studentId=" + userId);
|
||||
String json = null;
|
||||
try {
|
||||
HttpResponse response = httpclient.execute(http);
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
json = EntityUtils.toString(entity, "UTF-8").trim();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
json = jsonObject.getString("data");
|
||||
}
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
http.abort();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public String readPlanLogin(Long userId) {
|
||||
|
||||
HttpClient httpclient = HttpClientBuilder.create().build();
|
||||
String value = ServerConfig.getValue("3E_COMPOSITION_DNS");//和作文地址一样
|
||||
|
||||
HttpPost http = new HttpPost(value+"readplan/user/kouyu/login" + "?" + "studentId=" + userId);
|
||||
String json = null;
|
||||
try {
|
||||
HttpResponse response = httpclient.execute(http);
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
json = EntityUtils.toString(entity, "UTF-8").trim();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
json = jsonObject.getString("data");
|
||||
}
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
http.abort();
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
public void bindAcc(){
|
||||
Json j = new Json();
|
||||
Object openid = getSession().get("openid");
|
||||
if(openid==null||bacc.getLoginNo()==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户Openid");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String checkMcode = getSession().get("checkMcode")+"";
|
||||
if(!checkMcode.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("您的验证码错误,请重新输入");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
bacc.setCellphone(getSession().get("bindMobileNo")+"");
|
||||
bacc.setLoginNo(bacc.getLoginNo().trim());
|
||||
bacc.setOpenId(openid.toString());
|
||||
bacc.setUserType(2); //教师
|
||||
bacc.setPassword(getmima(bacc.getPassword()));
|
||||
String res=userInfoService.bindAcc(bacc);
|
||||
if(res.equals("0")){
|
||||
getSession().clear();
|
||||
j.setSuccess(true);
|
||||
j.setMsg("绑定成功");
|
||||
getSession().remove("checkMcode");
|
||||
getSession().remove("bindMobileNo");
|
||||
}else if(res.equals("1")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("绑定失败,请重试");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(res);
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void getRandomStr() {
|
||||
char michar[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
|
||||
Random ran = new Random();
|
||||
String ranStr="";
|
||||
for(int i=0;i<=2;i++){
|
||||
int num = ran.nextInt(7);
|
||||
for(int j=0;j<=num;j++){
|
||||
ranStr += michar[ran.nextInt(36)];
|
||||
}
|
||||
if(i<2)
|
||||
ranStr+=',';
|
||||
}
|
||||
getSession().put("mimamiyao",ranStr);
|
||||
Json j = new Json();
|
||||
j.setSuccess(true);
|
||||
j.setObj(ranStr);
|
||||
super.writeJson(j);
|
||||
}
|
||||
private String getmima(String ymi){
|
||||
Des desObj = new Des();
|
||||
String ranmi = getSession().get("mimamiyao")+"";
|
||||
String mi = null;
|
||||
if(!ranmi.equals("null"))
|
||||
{
|
||||
String[] mis = ranmi.split(",");
|
||||
mi=desObj.strDec(ymi, mis[0], mis[1], mis[2]);
|
||||
//logger.info("getPass:"+mi);
|
||||
getSession().remove("mimamiyao");
|
||||
}
|
||||
return mi;
|
||||
}
|
||||
}
|
||||
43
src/main/java/com/we3e/action/OSSAction.java
Normal file
43
src/main/java/com/we3e/action/OSSAction.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.teacher.QueryUrl;
|
||||
import com.we3e.model.teacher.ScoreCheckTotal;
|
||||
import com.we3e.model.teacher.ScoreTotal;
|
||||
import com.we3e.model.teacher.XueBa;
|
||||
import com.we3e.service.ScoreTotalService;
|
||||
import com.we3e.util.PolicyUtil;
|
||||
|
||||
@Controller("OSSAction")
|
||||
@Scope("prototype")
|
||||
public class OSSAction extends BaseAction{
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID : TODO
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void getOSSPolicy(){
|
||||
Json j = new Json();
|
||||
String reMsg = PolicyUtil.getPostPolicy();
|
||||
JSONObject result = JSON.parseObject(reMsg);
|
||||
j.setSuccess(true);
|
||||
j.setObj(result);
|
||||
super.writeJson(j);
|
||||
}
|
||||
}
|
||||
318
src/main/java/com/we3e/action/ScoreDataAction.java
Normal file
318
src/main/java/com/we3e/action/ScoreDataAction.java
Normal file
@ -0,0 +1,318 @@
|
||||
package com.we3e.action;
|
||||
|
||||
|
||||
import com.we3e.model.teacher.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.service.ScoreTotalService;
|
||||
import com.we3e.socket.client.EchoClient;
|
||||
import com.we3e.util.DateManager;
|
||||
import com.we3e.util.MapiCode;
|
||||
|
||||
@Controller("scoreDataAction")
|
||||
@Scope("prototype")
|
||||
public class ScoreDataAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ScoreDataAction.class);
|
||||
private static String defaultStime = "2015-01-01 00:00:00";
|
||||
@Autowired
|
||||
private ScoreTotalService scoreTotalService;
|
||||
private ScoreTotal score;
|
||||
private ScoreCheckTotal scoreCheck;
|
||||
private XueBa xueba;
|
||||
private QueryUrl qurl;
|
||||
private String querykey;
|
||||
private QinXue qinxue;
|
||||
|
||||
public String getQuerykey() {
|
||||
return querykey;
|
||||
}
|
||||
public void setQuerykey(String querykey) {
|
||||
this.querykey = querykey;
|
||||
}
|
||||
public ScoreTotal getScore() {
|
||||
return score;
|
||||
}
|
||||
public void setScore(ScoreTotal score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public ScoreCheckTotal getScoreCheck() {
|
||||
return scoreCheck;
|
||||
}
|
||||
public void setScoreCheck(ScoreCheckTotal scoreCheck) {
|
||||
this.scoreCheck = scoreCheck;
|
||||
}
|
||||
|
||||
public XueBa getXueba() {
|
||||
return xueba;
|
||||
}
|
||||
public void setXueba(XueBa xueba) {
|
||||
this.xueba = xueba;
|
||||
}
|
||||
|
||||
public QinXue getQinxue() {
|
||||
return qinxue;
|
||||
}
|
||||
public void setQinxue(QinXue qinxue) {
|
||||
this.qinxue = qinxue;
|
||||
}
|
||||
public QueryUrl getQurl() {
|
||||
return qurl;
|
||||
}
|
||||
public void setQurl(QueryUrl qurl) {
|
||||
this.qurl = qurl;
|
||||
}
|
||||
|
||||
public void getScoreData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
score.setUid(Long.parseLong(uid.toString()));
|
||||
if(score.getEndTime()==null||score.getEndTime().equals("")){
|
||||
score.setEndTime(DateManager.getCurrentTime(19,0));
|
||||
}
|
||||
if(score.getStartTime()==null||score.getStartTime().equals("")){
|
||||
score.setStartTime(defaultStime);
|
||||
}
|
||||
JSONObject reMsg=scoreTotalService.getScoreData(score);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void getReportData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
score.setUid(Long.parseLong(uid.toString()));
|
||||
if(score.getEndTime()==null||score.getEndTime().equals("")){
|
||||
score.setEndTime(DateManager.getCurrentTime(19,0));
|
||||
}
|
||||
if(score.getStartTime()==null||score.getStartTime().equals("")){
|
||||
score.setStartTime(defaultStime);
|
||||
}
|
||||
JSONObject reMsg=scoreTotalService.getReportData(score);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getScoreCheckData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long stuid=Long.parseLong(uid.toString());
|
||||
scoreCheck.setUid(stuid);
|
||||
ClassNotices id = scoreCheck.getIds().get(0);
|
||||
String startTime = scoreCheck.getStartTime();
|
||||
String endTime = scoreCheck.getEndTime();
|
||||
getSession().put("assignmenId",id);
|
||||
getSession().put("startTime",endTime);
|
||||
JSONObject reMsg=scoreTotalService.getScoreCheckData(scoreCheck);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
JSONArray joa=reMsg.getJSONArray("items");
|
||||
for(int i=0;i<joa.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)joa.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
}
|
||||
//获取班级学生
|
||||
// Object mystus = getSession().get("classStus"+scoreCheck.getClassesId());
|
||||
Object mystus = null;
|
||||
if(mystus==null)
|
||||
{//session中不存在 重新取
|
||||
QueryNotice qnt = new QueryNotice();
|
||||
qnt.setClassesId(scoreCheck.getClassesId());
|
||||
qnt.setQueryType("single");
|
||||
qnt.setApiCode(MapiCode.Msg_ClassesQueryRequest);
|
||||
String rmsg = new EchoClient(JSON.toJSONString(qnt)).start();
|
||||
JSONObject rmg = JSON.parseObject(rmsg);
|
||||
JSONArray items = rmg.getJSONArray("items");
|
||||
JSONObject cl = items.getObject(0, JSONObject.class);
|
||||
int classType = cl.getIntValue("classType");
|
||||
|
||||
QueryCIncS qstu = new QueryCIncS();
|
||||
qstu.setUid(stuid);
|
||||
qstu.setTeacherId(stuid);
|
||||
qstu.setListName("CIncS");
|
||||
qstu.setClassesId(scoreCheck.getClassesId());
|
||||
JSONObject reStus=scoreTotalService.getMyClsStu(qstu);
|
||||
if(reStus!=null&&reStus.size()>0){
|
||||
JSONArray stuar=reStus.getJSONArray("items");
|
||||
for(int i=0;i<stuar.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)stuar.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
jdo.put("classType", classType);
|
||||
}
|
||||
reMsg.put("classStus", stuar);
|
||||
getSession().put("classStus"+scoreCheck.getClassesId(), reStus.getJSONArray("items"));
|
||||
}
|
||||
}else reMsg.put("classStus", mystus);
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getXueBaData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long stuid=Long.parseLong(uid.toString());
|
||||
xueba.setUid(stuid);
|
||||
xueba.setUserId(stuid);
|
||||
JSONObject reMsg=scoreTotalService.getXuebaData(xueba);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
JSONArray joa=reMsg.getJSONArray("items");
|
||||
for(int i=0;i<joa.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)joa.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
jdo.put("uid", jdo.get("uid")+"");
|
||||
}
|
||||
//获取班级学生
|
||||
Object mystus = getSession().get("classStus"+xueba.getClassesId());
|
||||
if(mystus==null)
|
||||
{//session中不存在 重新取
|
||||
QueryCIncS qstu = new QueryCIncS();
|
||||
qstu.setUid(stuid);
|
||||
qstu.setTeacherId(stuid);
|
||||
qstu.setListName("CIncS");
|
||||
qstu.setClassesId(xueba.getClassesId());
|
||||
JSONObject reStus=scoreTotalService.getMyClsStu(qstu);
|
||||
if(reStus!=null&&reStus.size()>0){
|
||||
JSONArray stuar=reStus.getJSONArray("items");
|
||||
for(int i=0;i<stuar.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)stuar.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
}
|
||||
reMsg.put("classStus", stuar);
|
||||
getSession().put("classStus"+xueba.getClassesId(), reStus.getJSONArray("items"));
|
||||
}
|
||||
}else reMsg.put("classStus", mystus);
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void getQinXueData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long stuid=Long.parseLong(uid.toString());
|
||||
qinxue.setUid(stuid);
|
||||
qinxue.setUserId(stuid);
|
||||
JSONObject reMsg=scoreTotalService.getQinXueData(qinxue);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
JSONArray joa=reMsg.getJSONArray("items");
|
||||
for(int i=0;i<joa.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)joa.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
jdo.put("uid", jdo.get("uid")+"");
|
||||
}
|
||||
//获取班级学生
|
||||
Object mystus = getSession().get("classStus"+qinxue.getClassesId());
|
||||
if(mystus==null)
|
||||
{//session中不存在 重新取
|
||||
QueryCIncS qstu = new QueryCIncS();
|
||||
qstu.setUid(stuid);
|
||||
qstu.setTeacherId(stuid);
|
||||
qstu.setListName("CIncS");
|
||||
qstu.setClassesId(qinxue.getClassesId());
|
||||
JSONObject reStus=scoreTotalService.getMyClsStu(qstu);
|
||||
if(reStus!=null&&reStus.size()>0){
|
||||
JSONArray stuar=reStus.getJSONArray("items");
|
||||
for(int i=0;i<stuar.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)stuar.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
}
|
||||
reMsg.put("classStus", stuar);
|
||||
getSession().put("classStus"+qinxue.getClassesId(), reStus.getJSONArray("items"));
|
||||
}
|
||||
}else reMsg.put("classStus", mystus);
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void getUrl(){
|
||||
Json j = new Json();
|
||||
if(qurl==null||qurl.getKey().equals("")){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
JSONObject reMsg=scoreTotalService.getUrl(qurl);
|
||||
if(reMsg.getIntValue("errorCode")==0){
|
||||
j.setObj(reMsg.get("url"));
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(reMsg.getString("errorText"));
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
}
|
||||
|
||||
87
src/main/java/com/we3e/action/SelectDataAction.java
Normal file
87
src/main/java/com/we3e/action/SelectDataAction.java
Normal file
@ -0,0 +1,87 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.teacher.QueryStudent;
|
||||
import com.we3e.model.teacher.SelectDataSend;
|
||||
import com.we3e.service.SelectDataService;
|
||||
import com.we3e.util.MapiCode;
|
||||
|
||||
@Controller("selectDataAction")
|
||||
@Scope("prototype")
|
||||
public class SelectDataAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(SelectDataAction.class);
|
||||
|
||||
@Autowired
|
||||
private SelectDataService selectDataService;
|
||||
private SelectDataSend reqdata;
|
||||
private QueryStudent qstudent;
|
||||
|
||||
|
||||
public QueryStudent getQstudent() {
|
||||
return qstudent;
|
||||
}
|
||||
|
||||
public void setQstudent(QueryStudent qstudent) {
|
||||
this.qstudent = qstudent;
|
||||
}
|
||||
|
||||
public SelectDataSend getReqdata() {
|
||||
return reqdata;
|
||||
}
|
||||
|
||||
public void setReqdata(SelectDataSend reqdata) {
|
||||
this.reqdata = reqdata;
|
||||
}
|
||||
|
||||
public void getSelectData(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
reqdata.setUid(Long.parseLong(uid.toString()));
|
||||
if(reqdata.getComboName().equals("ClassesByTeacher")||reqdata.getComboName().equals("userOwnLesson")
|
||||
||reqdata.getComboName().equals("userOwnWord")) //查询班级
|
||||
{
|
||||
reqdata.setParameter(Long.parseLong(uid.toString()));
|
||||
}
|
||||
String reMsg=selectDataService.getSelectData(reqdata);
|
||||
j.setObj(reMsg);//"[{\"label\":\"二一班\",\"value\":510104000001},{\"label\":\"二二班\",\"value\":510104000002},{\"label\":\"一三班\",\"value\":510104000006},{\"label\":\"我的小组\",\"value\":510104000007}]");
|
||||
j.setSuccess(true);
|
||||
|
||||
if(reqdata.getComboName().equals("ClassesByTeacher")) //查询班级
|
||||
getSession().put("myClasses",reMsg);
|
||||
|
||||
super.writeJson(j);
|
||||
|
||||
}
|
||||
|
||||
public void getUserInfo(){
|
||||
Object uid = getSession().get("uid");
|
||||
Json j = new Json();
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
String reMsg=selectDataService.getUserInfo(qstudent);
|
||||
j.setObj(reMsg);
|
||||
j.setSuccess(true);
|
||||
|
||||
super.writeJson(j);
|
||||
}
|
||||
}
|
||||
|
||||
1657
src/main/java/com/we3e/action/ShowShareAction.java
Normal file
1657
src/main/java/com/we3e/action/ShowShareAction.java
Normal file
File diff suppressed because it is too large
Load Diff
156
src/main/java/com/we3e/action/TeacherNoticeAction.java
Normal file
156
src/main/java/com/we3e/action/TeacherNoticeAction.java
Normal file
@ -0,0 +1,156 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.teacher.DeleNotice;
|
||||
import com.we3e.model.teacher.Notice;
|
||||
import com.we3e.model.teacher.QueryNotice;
|
||||
import com.we3e.service.TeacherNoticeService;
|
||||
import com.we3e.util.DateManager;
|
||||
|
||||
@Controller("teacherNoticeAction")
|
||||
@Scope("prototype")
|
||||
public class TeacherNoticeAction extends BaseAction {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TeacherNoticeAction.class);
|
||||
|
||||
@Autowired
|
||||
private TeacherNoticeService teacherNoticeService;
|
||||
private Notice notice;
|
||||
private QueryNotice qnotice;
|
||||
private DeleNotice dnotice;
|
||||
public Notice getNotice() {
|
||||
return notice;
|
||||
}
|
||||
public void setNotice(Notice notice) {
|
||||
this.notice = notice;
|
||||
}
|
||||
|
||||
public QueryNotice getQnotice() {
|
||||
return qnotice;
|
||||
}
|
||||
public void setQnotice(QueryNotice qnotice) {
|
||||
this.qnotice = qnotice;
|
||||
}
|
||||
public DeleNotice getDnotice() {
|
||||
return dnotice;
|
||||
}
|
||||
public void setDnotice(DeleNotice dnotice) {
|
||||
this.dnotice = dnotice;
|
||||
}
|
||||
|
||||
public void subData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
notice.setContent(notice.getContent().replace("\"", "“"));
|
||||
notice.setUid(Long.parseLong(uid.toString()));
|
||||
notice.setTeacherId(Long.parseLong(uid.toString()));
|
||||
notice.setStartTime(DateManager.getCurrentTime(19,0));
|
||||
notice.setEndTime(DateManager.getCurrentTime(19,15));
|
||||
if(teacherNoticeService.subNotice(notice)){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("发布成功");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg("发布失败,请重试");
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
|
||||
}
|
||||
public void getData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null||qnotice==null||qnotice.getClassesId()==0){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
qnotice.setUid(Long.parseLong(uid.toString()));
|
||||
//if(qNotice.getQueryType().equals("list"))
|
||||
JSONObject reJson = teacherNoticeService.getNotice(qnotice);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray items = reJson.getJSONArray("items");
|
||||
Object myNotices = getSession().get("myNotices");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qNotices = null;
|
||||
if(myNotices!=null){
|
||||
qNotices = (HashMap)myNotices;
|
||||
}else{
|
||||
qNotices = new HashMap<String,String>();
|
||||
}
|
||||
for(int i=0;i<items.size();i++){
|
||||
JSONObject en=items.getJSONObject(i);
|
||||
qNotices.put(en.getString("classMessageId"),"");
|
||||
}
|
||||
getSession().put("myNotices",qNotices);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取公告成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无公告");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void deleData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
Object myNotices = getSession().get("myNotices");
|
||||
boolean isSuccess = true;
|
||||
if(myNotices!=null){//检查该messageId是否是该老师发布的
|
||||
HashMap<String,String> qNotices = (HashMap)myNotices;
|
||||
if(qNotices.containsKey(dnotice.getClassMessages().get(0).getId()+""))
|
||||
{
|
||||
dnotice.setUid(Long.parseLong(uid.toString()));
|
||||
if(teacherNoticeService.deleNotice(dnotice)){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("删除成功");
|
||||
}else{
|
||||
isSuccess=false;
|
||||
}
|
||||
}else isSuccess=false;
|
||||
}else isSuccess=false;
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("删除失败,请重试");
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public boolean checkClass(long classId){
|
||||
Object myclass = getSession().get("myClasses");
|
||||
if(myclass!=null&&myclass.toString().indexOf(classId+"")>-1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
866
src/main/java/com/we3e/action/TeacherWorkAction.java
Normal file
866
src/main/java/com/we3e/action/TeacherWorkAction.java
Normal file
@ -0,0 +1,866 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.we3e.model.teacher.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.Contants;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.model.wechat.AccessToken;
|
||||
import com.we3e.service.ScoreTotalService;
|
||||
import com.we3e.service.TeacherWorkService;
|
||||
import com.we3e.service.WeChatSendMessageService;
|
||||
import com.we3e.util.CommonInfo;
|
||||
import com.we3e.util.DateManager;
|
||||
import com.we3e.util.FFmpegUtil;
|
||||
import com.we3e.util.FileUpAndDown;
|
||||
import com.we3e.util.MapiCode;
|
||||
import com.we3e.util.PolicyUtil;
|
||||
|
||||
@Controller("teacherWorkAction")
|
||||
@Scope("prototype")
|
||||
public class TeacherWorkAction extends BaseAction {
|
||||
|
||||
private static final long serialVersionUID = -9087336943639189882L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TeacherWorkAction.class);
|
||||
|
||||
@Autowired
|
||||
private TeacherWorkService teacherWorkService;
|
||||
@Autowired
|
||||
private WeChatSendMessageService WeChatSendMessageService;
|
||||
@Autowired
|
||||
private ScoreTotalService scoreTotalService;
|
||||
private SubWork work;
|
||||
private QueryWork qwork;
|
||||
private DeleExam dexam;
|
||||
private DeleWork dwork;
|
||||
private String fenlei;
|
||||
private SubExam subExam;
|
||||
private QueryExam qexam;
|
||||
private QueryAssignComm qcomm;
|
||||
private QueryAssign qassign;
|
||||
private String jsonData;
|
||||
|
||||
public void setQassign(QueryAssign qassign) {
|
||||
this.qassign = qassign;
|
||||
}
|
||||
public QueryAssign getQassign() {
|
||||
return qassign;
|
||||
}
|
||||
|
||||
public DeleExam getDexam() {
|
||||
return dexam;
|
||||
}
|
||||
public void setDexam(DeleExam dexam) {
|
||||
this.dexam = dexam;
|
||||
}
|
||||
public QueryAssignComm getQcomm() {
|
||||
return qcomm;
|
||||
}
|
||||
public void setQcomm(QueryAssignComm qcomm) {
|
||||
this.qcomm = qcomm;
|
||||
}
|
||||
public QueryExam getQexam() {
|
||||
return qexam;
|
||||
}
|
||||
public void setQexam(QueryExam qexam) {
|
||||
this.qexam = qexam;
|
||||
}
|
||||
public SubExam getSubExam() {
|
||||
return subExam;
|
||||
}
|
||||
public void setSubExam(SubExam subExam) {
|
||||
this.subExam = subExam;
|
||||
}
|
||||
public String getFenlei() {
|
||||
return fenlei;
|
||||
}
|
||||
public void setFenlei(String fenlei) {
|
||||
this.fenlei = fenlei;
|
||||
}
|
||||
public SubWork getWork() {
|
||||
return work;
|
||||
}
|
||||
public void setWork(SubWork work) {
|
||||
this.work = work;
|
||||
}
|
||||
public QueryWork getQwork() {
|
||||
return qwork;
|
||||
}
|
||||
public void setQwork(QueryWork qwork) {
|
||||
this.qwork = qwork;
|
||||
}
|
||||
public DeleWork getDwork() {
|
||||
return dwork;
|
||||
}
|
||||
public void setDwork(DeleWork dwork) {
|
||||
this.dwork = dwork;
|
||||
}
|
||||
public String getJsonData() {
|
||||
return jsonData;
|
||||
}
|
||||
public void setJsonData(String jsonData) {
|
||||
this.jsonData = jsonData;
|
||||
}
|
||||
public void subData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
work.setContent(work.getContent().replace("\"", "“"));
|
||||
work.setUid(Long.parseLong(uid.toString()));
|
||||
work.setTeacherId(Long.parseLong(uid.toString()));
|
||||
String startTime = work.getStartTime();
|
||||
if(DateManager.beforeNow19(startTime)){
|
||||
work.setStartTime(DateManager.getCurrentTime(19,0));
|
||||
}
|
||||
|
||||
if(work.getWachatUploadTypes() != null && work.getWachatUploadTypes().size() > 0){
|
||||
int[] ints = new int[work.getWachatUploadTypes().size()];
|
||||
for (int i = 0; i < work.getWachatUploadTypes().size(); i++) {
|
||||
ints[i] = work.getWachatUploadTypes().get(i).getWachatUploadType();
|
||||
}
|
||||
work.setPointcasetypes(ints);
|
||||
}
|
||||
|
||||
if(teacherWorkService.subWork(work)){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("发布成功");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg("发布失败,请重试");
|
||||
}
|
||||
|
||||
super.writeJson(j);
|
||||
|
||||
}
|
||||
public void getData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
qwork.setQueryType("list");
|
||||
qwork.setUid(Long.parseLong(uid.toString()));
|
||||
qwork.setTeacherId(Long.parseLong(uid.toString()));
|
||||
// 应该是2039接口
|
||||
JSONObject reJson = teacherWorkService.getWork(qwork);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray items = reJson.getJSONArray("items");
|
||||
Object myworks = getSession().get("myworks");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qworks = null;
|
||||
if(myworks!=null){
|
||||
qworks = (HashMap)myworks;
|
||||
}else{
|
||||
qworks = new HashMap<String,String>();
|
||||
}
|
||||
for(int i=0;i<items.size();i++){
|
||||
JSONObject en=items.getJSONObject(i);
|
||||
qworks.put(en.getString("assignmentId"),"");
|
||||
}
|
||||
getSession().put("myworks",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取训练成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无训练");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJsonNew(j);
|
||||
}
|
||||
|
||||
public void deleData(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
Object myworks = getSession().get("myworks");
|
||||
boolean isSuccess = true;
|
||||
if(myworks!=null){//检查该messageId是否是该老师发布的
|
||||
HashMap<String,String> qworks = (HashMap)myworks;
|
||||
if(qworks.containsKey(dwork.getAssignments().get(0).getId()+""))
|
||||
{
|
||||
dwork.setUid(Long.parseLong(uid.toString()));
|
||||
if(teacherWorkService.deleWork(dwork)){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("删除成功");
|
||||
}else{
|
||||
isSuccess=false;
|
||||
}
|
||||
}else isSuccess=false;
|
||||
}else isSuccess=false;
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("删除失败,请重试");
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void deleExam(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
Object myworks = getSession().get("myworks");
|
||||
boolean isSuccess = true;
|
||||
// if(myworks!=null){//检查该messageId是否是该老师发布的
|
||||
// HashMap<String,String> qworks = (HashMap)myworks;
|
||||
// if(qworks.containsKey(dwork.getAssignments().get(0).getId()+""))
|
||||
// {
|
||||
dexam.setUid(Long.parseLong(uid.toString()));
|
||||
dexam.setTeacherId(Long.parseLong(uid.toString()));
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm");
|
||||
Date date=null;
|
||||
try {
|
||||
date = dateFormat.parse(dexam.getEndTime());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(date.getTime()<new Date().getTime()){
|
||||
isSuccess=false;
|
||||
if(dexam.getType() ==2){
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("练习已过期");
|
||||
}
|
||||
}else {
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("考试已过期");
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
if(teacherWorkService.deleExam(dexam)){
|
||||
j.setSuccess(true);
|
||||
if(dexam.getType() == 2){
|
||||
j.setMsg("练习终止成功");
|
||||
}else {
|
||||
j.setMsg("考试终止成功");
|
||||
}
|
||||
|
||||
}else{
|
||||
isSuccess=false;
|
||||
}
|
||||
// }else isSuccess=false;
|
||||
// }else isSuccess=false;
|
||||
if(dexam.getType() == 2){
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("练习终止失败,请重试");
|
||||
}
|
||||
}else {
|
||||
if(!isSuccess){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("考试终止失败,请重试");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public boolean checkClass(long classId){
|
||||
Object myclass = getSession().get("myClasses");
|
||||
if(myclass!=null&&myclass.toString().indexOf(classId+"")>-1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void getAccessToken(){
|
||||
AccessToken acc = WeChatSendMessageService.getToken();
|
||||
String accessToken = acc.getToken();
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
j.setSuccess(true);
|
||||
j.setObj(accessToken);
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getExamPaper(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
qwork.setUid(Long.parseLong(uid.toString()));
|
||||
qwork.setStudentId(Long.parseLong(uid.toString()));
|
||||
qwork.setTeacherId(Long.parseLong(uid.toString()));
|
||||
qwork.setPageSize(10000000);
|
||||
|
||||
JSONObject reJson = teacherWorkService.getExamPaper(qwork);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray items = reJson.getJSONArray("items");
|
||||
Object myworks = getSession().get("examPapers");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qworks = null;
|
||||
if(myworks!=null){
|
||||
qworks = (HashMap)myworks;
|
||||
}else{
|
||||
qworks = new HashMap<String,String>();
|
||||
}
|
||||
for(int i=0;i<items.size();i++){
|
||||
JSONObject en=items.getJSONObject(i);
|
||||
qworks.put(en.getString("assignmentId"),"");
|
||||
JSONArray allClasses = en.getJSONArray("allClasses");
|
||||
for (int i1 = 0; i1 < allClasses.size(); i1++) {
|
||||
allClasses.getJSONObject(i1).put("classId",String.valueOf(allClasses.getJSONObject(i1).get("classId")));
|
||||
}
|
||||
}
|
||||
getSession().put("examPapers",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取试卷成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无试卷");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getThreeTag(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
qwork.setUid(Long.parseLong(uid.toString()));
|
||||
qwork.setTeacherId(Long.parseLong(uid.toString()));
|
||||
qwork.setPageSize(10000000);
|
||||
|
||||
JSONObject reJson = teacherWorkService.getThreeTag(qwork);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray areas = reJson.getJSONArray("areas");
|
||||
for (int i = 0; i < areas.size(); i++) {
|
||||
JSONObject pv = areas.getJSONObject(i);
|
||||
if("全国通用".equals(pv.getString("name"))){
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject area = new JSONObject();
|
||||
area.put("areaid",0);
|
||||
area.put("name","");
|
||||
array.add(area);
|
||||
pv.put("cityList",array);
|
||||
}
|
||||
}
|
||||
String areasStr = areas.toString();
|
||||
areasStr = areasStr.replaceAll("areaid","value");
|
||||
areasStr = areasStr.replaceAll("name","label");
|
||||
areasStr = areasStr.replaceAll("cityList","children");
|
||||
reJson.put("areas",areasStr);
|
||||
Object myTags = getSession().get("threeTags");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qworks = null;
|
||||
if(myTags!=null){
|
||||
qworks = (HashMap)myTags;
|
||||
}else{
|
||||
qworks = new HashMap<String,String>();
|
||||
// qworks.put("classLevels",reJson.getJSONObject("defaultTags").getJSONObject("classLevels").toString());
|
||||
// qworks.put("goods",reJson.getJSONObject("defaultTags").getJSONObject("goods").toString());
|
||||
// qworks.put("areas",reJson.getJSONObject("defaultTags").getJSONObject("areas").toString());
|
||||
}
|
||||
|
||||
getSession().put("threeTags",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取试卷成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无试卷");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public void subExam(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
subExam.setUid(Long.parseLong(uid.toString()));
|
||||
subExam.setTeacherId(Long.parseLong(uid.toString()));
|
||||
String now = DateManager.getCurrentTime(19, 0);
|
||||
|
||||
if(DateManager.compareTime19(subExam.getStartTime(), now)<=-60000){
|
||||
subExam.setStartTime(now);
|
||||
}
|
||||
|
||||
if(DateManager.compareTime19(subExam.getEndTime(), subExam.getStartTime())<=0){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("结束时间不能在开始时间之前");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
|
||||
//考试时间不能小于半小时
|
||||
if(subExam.getType() == 1 ){
|
||||
if(DateManager.compareTime19(subExam.getEndTime(), subExam.getStartTime())<(30*60*1000)){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("考试开始和结束时间间隔不能少于30分钟");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
if(DateManager.compareTime19(subExam.getEndTime(), subExam.getStartTime())<(30*60*1000)){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("训练开始和结束时间间隔不能少于30分钟");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(teacherWorkService.subExam(subExam)){
|
||||
j.setSuccess(true);
|
||||
j.setMsg("布置成功");
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg("布置失败,请重试");
|
||||
}
|
||||
super.writeJson(j);
|
||||
|
||||
}
|
||||
|
||||
public void getExam(){
|
||||
Json j = new Json();
|
||||
// Object uid = getSession().get("uid");
|
||||
// if(uid==null){
|
||||
// j.setSuccess(false);
|
||||
// j.setMsg("未获取用户信息");
|
||||
// super.writeJson(j);
|
||||
// return;
|
||||
// }
|
||||
qexam.setApiCode(MapiCode.Msg_NewExamQueryRequest);
|
||||
JSONObject reJson = teacherWorkService.getExam(qexam);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray items = reJson.getJSONArray("items");
|
||||
Object myworks = getSession().get("myworks");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qworks = null;
|
||||
if(myworks!=null){
|
||||
qworks = (HashMap)myworks;
|
||||
}else{
|
||||
qworks = new HashMap<String,String>();
|
||||
}
|
||||
for(int i=0;i<items.size();i++){
|
||||
JSONObject en=items.getJSONObject(i);
|
||||
qworks.put(en.getString("assignmentId"),"");
|
||||
}
|
||||
getSession().put("myworks",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取试卷成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无试卷");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getSouthExam(){
|
||||
Json j = new Json();
|
||||
// Object uid = getSession().get("uid");
|
||||
// if(uid==null){
|
||||
// j.setSuccess(false);
|
||||
// j.setMsg("未获取用户信息");
|
||||
// super.writeJson(j);
|
||||
// return;
|
||||
// }
|
||||
|
||||
qexam.setType(2);
|
||||
qexam.setApiCode(MapiCode.Msg_SouthExampaperCheckRequest);
|
||||
JSONObject reJson = teacherWorkService.getExam(qexam);
|
||||
if(reJson!=null)
|
||||
{
|
||||
// JSONArray items = reJson.getJSONArray("items");
|
||||
// Object myworks = getSession().get("myworks");
|
||||
// //将消息ID保存到session 删除时校验
|
||||
// HashMap<String,String> qworks = null;
|
||||
// if(myworks!=null){
|
||||
// qworks = (HashMap)myworks;
|
||||
// }else{
|
||||
// qworks = new HashMap<String,String>();
|
||||
// }
|
||||
// for(int i=0;i<items.size();i++){
|
||||
// JSONObject en=items.getJSONObject(i);
|
||||
// qworks.put(en.getString("assignmentId"),"");
|
||||
// }
|
||||
// getSession().put("myworks",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取试卷成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无试卷");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getHistoryExam(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
long userId = Long.parseLong((String)uid);
|
||||
qexam.setUid(userId);
|
||||
// qexam.setApiCode(MapiCode.Msg_PreviousExamsQueryRequest);
|
||||
qexam.setApiCode(MapiCode.Msg_NewPreviousExamsQueryRequest);
|
||||
JSONObject reJson = teacherWorkService.getExam(qexam);
|
||||
if(reJson!=null)
|
||||
{
|
||||
JSONArray items = reJson.getJSONArray("items");
|
||||
Object myHistoryExam = getSession().get("myHistoryExam");
|
||||
//将消息ID保存到session 删除时校验
|
||||
HashMap<String,String> qworks = null;
|
||||
if(myHistoryExam!=null){
|
||||
qworks = (HashMap)myHistoryExam;
|
||||
}else{
|
||||
qworks = new HashMap<String,String>();
|
||||
}
|
||||
for(int i=0;i<items.size();i++){
|
||||
JSONObject en=items.getJSONObject(i);
|
||||
qworks.put(en.getString("examId"),"");
|
||||
}
|
||||
getSession().put("myHistoryExam",qworks);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取试卷成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无试卷");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getExamAnswer(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
if(qexam.getIsOral()== -1){//老听力
|
||||
qexam.setApiCode(MapiCode.Msg_HearAnswerQueryRequest);
|
||||
}else{
|
||||
qexam.setApiCode(MapiCode.Msg_ExamAnswerQueryRequest);
|
||||
}
|
||||
|
||||
JSONObject reJson = teacherWorkService.getExam(qexam);
|
||||
if(reJson.getIntValue("errorCode")==0){
|
||||
//获取班级学生
|
||||
Object mystus = getSession().get("classStus"+qexam.getClassesId());
|
||||
if(mystus==null)
|
||||
{//session中不存在 重新取
|
||||
QueryCIncS qstu = new QueryCIncS();
|
||||
qstu.setUid(Long.parseLong((String)uid));
|
||||
qstu.setTeacherId(Long.parseLong((String)uid));
|
||||
qstu.setListName("CIncS");
|
||||
qstu.setClassesId(qexam.getClassesId());
|
||||
JSONObject reStus=scoreTotalService.getMyClsStu(qstu);
|
||||
if(reStus!=null&&reStus.size()>0){
|
||||
JSONArray stuar=reStus.getJSONArray("items");
|
||||
for(int i=0;i<stuar.size();i++)
|
||||
{
|
||||
JSONObject jdo=(JSONObject)stuar.get(i);
|
||||
jdo.put("studentId", jdo.get("studentId")+"");
|
||||
}
|
||||
reJson.put("classStus", stuar);
|
||||
getSession().put("classStus"+qexam.getClassesId(), reStus.getJSONArray("items"));
|
||||
}
|
||||
}else reJson.put("classStus", mystus);
|
||||
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取考试详情成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无人参与考试");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void subComm() throws IOException{
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* 此处做如下处理
|
||||
* 若getWeixinVoice=>true
|
||||
* 则是微信的声音,
|
||||
* 需去微信服务器下载;事务
|
||||
* 微信的格式是非MP3格式需转码;事务
|
||||
* 上传到OSS云端;事务
|
||||
* 把key值存储到数据库中;事务
|
||||
* 返回客户端是否成功。
|
||||
*/
|
||||
String oldFileName = "";
|
||||
try {
|
||||
if(qcomm.getVoice()!=null && !"".equals(qcomm.getVoice())){//微信的语音需下载
|
||||
AccessToken acc = WeChatSendMessageService.getToken();
|
||||
String accessToken = acc.getToken();
|
||||
FileUpAndDown fileter = new FileUpAndDown();
|
||||
String title = qcomm.getVoice();
|
||||
String path = CommonInfo.getDownloadUrl().replace("ACCESS_TOKEN", accessToken) + "=" + title;
|
||||
oldFileName = fileter.downloadNet(path,title);
|
||||
if("".equals(oldFileName)){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("微信保存语音失败,请重试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}else{//转码
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String newFileName = Contants.targetfolder+"/"+uuid.toString()+"_weixin.mp3";
|
||||
File mp3file = FFmpegUtil.amr2mp3(oldFileName, newFileName);
|
||||
if(mp3file==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("文件转码失败");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}else{
|
||||
}
|
||||
File oldFile = new File(oldFileName);
|
||||
oldFile.delete();
|
||||
//3、上传
|
||||
String key = "review/"+uid.toString()+"/"+mp3file.getName();
|
||||
String upUrl = PolicyUtil.getUploadUrl(key, 0);
|
||||
String message = PolicyUtil.put(upUrl, mp3file);
|
||||
if("".equals(message)){//上传成功删除原文件
|
||||
qcomm.setVoice(key);
|
||||
mp3file.delete();
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(message);
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
qcomm.setTeacherId(Long.parseLong(uid.toString()));
|
||||
JSONObject jsonObj = teacherWorkService.subComm(qcomm);
|
||||
if(jsonObj!=null&&jsonObj.getIntValue("errorCode")==0){
|
||||
j.setSuccess(true);
|
||||
j.setMsg(jsonObj.getString("assignCommId"));
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg("点评失败,请重试");
|
||||
}
|
||||
super.writeJson(j);
|
||||
}catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
j.setSuccess(false);
|
||||
j.setMsg("微信保存语音失败,请重试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setSuccess(false);
|
||||
j.setMsg(e.getMessage());
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void parseVoice(){
|
||||
String oldFileName = "";
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
String voice = ServletActionContext.getRequest().getParameter("qcomm.voice");
|
||||
logger.info("声音voice名"+voice);
|
||||
try {
|
||||
if(voice!=null && !"".equals(voice)){//微信的语音需下载
|
||||
AccessToken acc = WeChatSendMessageService.getToken();
|
||||
String accessToken = acc.getToken();
|
||||
FileUpAndDown fileter = new FileUpAndDown();
|
||||
String title = voice;
|
||||
String path = CommonInfo.getDownloadUrl().replace("ACCESS_TOKEN", accessToken) + "=" + title;
|
||||
logger.info("path"+path);
|
||||
oldFileName = fileter.downloadNet(path,title);
|
||||
if("".equals(oldFileName)){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("微信保存语音失败,请重试");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}else{//转码
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String newFileName = Contants.targetfolder+"/"+uuid.toString()+"_weixin.mp3";
|
||||
logger.info("newFileName"+newFileName);
|
||||
File mp3file = FFmpegUtil.amr2mp3(oldFileName, newFileName);
|
||||
if(mp3file==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("文件转码失败");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}else{
|
||||
}
|
||||
File oldFile = new File(oldFileName);
|
||||
logger.info("oldFile"+oldFile);
|
||||
oldFile.delete();
|
||||
//3、上传
|
||||
String key = "review/"+uid.toString()+"/"+mp3file.getName();
|
||||
logger.info("key"+key);
|
||||
String upUrl = PolicyUtil.getUploadUrl(key, 0);
|
||||
String message = PolicyUtil.put(upUrl, mp3file);
|
||||
if("".equals(message)){//上传成功删除原文件
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("voice",key);
|
||||
logger.info("jsonObject"+jsonObject);
|
||||
mp3file.delete();
|
||||
j.setObj(jsonObject);
|
||||
j.setSuccess(true);
|
||||
logger.info("j"+j);
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}else{
|
||||
j.setSuccess(false);
|
||||
j.setMsg(message);
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
public void getComm(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
JSONObject reJson = teacherWorkService.getComm(qcomm);
|
||||
if(reJson!=null)
|
||||
{
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取点评成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无点评");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
public String getNewComm(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
return ERROR;
|
||||
}
|
||||
JSONObject reJson = teacherWorkService.getComm(qcomm);
|
||||
if(reJson!=null)
|
||||
{
|
||||
j.setObj(reJson);
|
||||
j.setMsg("获取点评成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("无点评");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
jsonData = j.toString();
|
||||
setNextAction("/app/comment.jsp");
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public void getDelayWork() {
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
qassign.setUid(Long.parseLong(uid.toString()));
|
||||
String str = teacherWorkService.getDelayWork(qassign);
|
||||
if("延期成功".equals("str")) {
|
||||
j.setMsg("延期成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg(str);
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
|
||||
public void getDelayExam() {
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
qexam.setUid(Long.parseLong(uid.toString()));
|
||||
String str = teacherWorkService.getDelayExam(qexam);
|
||||
if("延期成功".equals("str")) {
|
||||
j.setMsg("延期成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg(str);
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
}
|
||||
106
src/main/java/com/we3e/action/Test.java
Normal file
106
src/main/java/com/we3e/action/Test.java
Normal file
@ -0,0 +1,106 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.message.wechat.req.NewsMsg;
|
||||
import com.we3e.model.teacher.PushMessageDetail;
|
||||
import com.we3e.model.teacher.PushQueryMessage;
|
||||
import com.we3e.service.PushService;
|
||||
import com.we3e.socket.client.EchoClient;
|
||||
import com.we3e.util.CommonInfo;
|
||||
import com.we3e.util.DateManager;
|
||||
|
||||
@Controller("test")
|
||||
@Scope("prototype")
|
||||
public class Test extends BaseAction{
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID : TODO
|
||||
*/
|
||||
private static final long serialVersionUID = -3617535721910152311L;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TeacherWorkAction.class);
|
||||
|
||||
@Autowired
|
||||
private PushService push;
|
||||
|
||||
public void test(){
|
||||
System.out.println("hello");
|
||||
String now = DateManager.getCurrentTime(19, 0);
|
||||
String nowhour = now.substring(11,13);
|
||||
if(nowhour.equals("13"))
|
||||
return ; //中午休息
|
||||
int dhour = -1;
|
||||
if(nowhour.equals("08")){
|
||||
dhour = -12;
|
||||
}else if(nowhour.equals("14")){
|
||||
dhour = -2;
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.HOUR_OF_DAY,dhour);
|
||||
String startTime = DateManager.dataFormat19.format(calendar.getTime());
|
||||
System.out.println(startTime);
|
||||
PushQueryMessage qm = new PushQueryMessage();
|
||||
qm.setStartTime(startTime);
|
||||
qm.setEndTime(now);
|
||||
qm.setApiCode(1091);
|
||||
pushNotice(qm);
|
||||
}
|
||||
|
||||
|
||||
private void pushNotice(PushQueryMessage qm){
|
||||
String pushType = "classmessage";
|
||||
qm.setPushType(pushType); //classmessage为班级公告
|
||||
String recMsg = //"{\"items\":[{\"classMessageId\":29,\"classesId\":510104000001,\"areaid\":510104},{\"classMessageId\":30,\"classesId\":510104000007,\"areaid\":510104}],\"errorCode\":0,\"apicode\":1092}";
|
||||
new EchoClient(JSON.toJSONString(qm)).start();
|
||||
if(recMsg!=null){
|
||||
JSONObject jo = JSON.parseObject(recMsg);
|
||||
if(jo.getIntValue("errorCode")==0)
|
||||
{
|
||||
JSONArray mes = jo.getJSONArray("items");
|
||||
for(int i=0;i<mes.size();i++){
|
||||
JSONObject me = mes.getJSONObject(i);
|
||||
long classesId =me.getLongValue("classesId");
|
||||
int classMessageId = me.getIntValue("classMessageId");
|
||||
PushMessageDetail pd =new PushMessageDetail();
|
||||
pd.setApiCode(1093);
|
||||
pd.setClassmessageid(classMessageId);
|
||||
pd.setClassesid(classesId);
|
||||
pd.setPushType(pushType);
|
||||
String ggMsg = //"{\"classmessage\":[{\"startTime\":\"2015-02-18 00:00:00\",\"content\":\"同学们,明天不上课。\",\"classMessageId\":30,\"status\":0,\"created\":\"2015-02-17 20:22:10\",\"areaid\":510104,\"endTime\":\"2015-02-28 00:00:00\",\"teacherId\":5101040200000005}],\"items\":[{\"trueName\":\"王东宁\",\"openId\":\"o0Wabs9GfMCj-jZRdT4rzaEFpKPw\"},{\"trueName\":\"王东宁\",\"openId\":\"o0Wabs9oMVmqxxDg-12f9Kz4TPyY\"}],\"errorCode\":0,\"className\":\"二一班\",\"apicode\":1094,\"teacherName\":\"张三\"}";
|
||||
new EchoClient(JSON.toJSONString(pd)).start();
|
||||
System.out.println("GGMSG=>"+ggMsg);
|
||||
if(ggMsg!=null){
|
||||
JSONObject ggo = JSON.parseObject(ggMsg);
|
||||
if(ggo.getIntValue("errorCode")==0)
|
||||
{
|
||||
//JSONArray stuinfos = ggo.getJSONArray("items");
|
||||
//String teacherName = ggo.getString("teacherName");
|
||||
JSONArray teacherOpenId = ggo.getJSONArray("selfOpenId");
|
||||
String className = ggo.getString("className");
|
||||
JSONObject assignment = ggo.getJSONArray("classmessage").getJSONObject(0);
|
||||
String ascontent= assignment.getString("content");
|
||||
for(int j=0;j<teacherOpenId.size();j++){
|
||||
String OpenId = teacherOpenId.getString(j);
|
||||
NewsMsg nm =new NewsMsg(OpenId,"我的新公告。","我向"+className+"发布的新公告:"+ascontent,CommonInfo.getpushGgUrl(),"");
|
||||
String sendm = JSON.toJSONString(nm);
|
||||
System.out.println(OpenId);
|
||||
logger.info(sendm);
|
||||
// weChatSendMessageService.sendMessageByTokenUrl(CommonInfo.send_message_url(),"POST",sendm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
133
src/main/java/com/we3e/action/WeChatAction.java
Normal file
133
src/main/java/com/we3e/action/WeChatAction.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.we3e.action;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.we3e.model.page.Json;
|
||||
import com.we3e.util.OprerationProperties;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ModelDriven;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.convention.annotation.Action;
|
||||
import org.apache.struts2.convention.annotation.Namespace;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.we3e.model.wechat.WeChat;
|
||||
import com.we3e.service.WeChatCoreService;
|
||||
import com.we3e.util.wechat.MessageUtil;
|
||||
import com.we3e.util.wechat.WeChatSignUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@ParentPackage("default")
|
||||
@Namespace("/")
|
||||
@Action(value = "weChatAction")
|
||||
public class WeChatAction extends BaseAction implements ModelDriven<WeChat> {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(WeChatAction.class);
|
||||
private WeChat weChat = new WeChat();
|
||||
private WeChatCoreService weChatCoreService;
|
||||
|
||||
public WeChatCoreService getWeChatCoreService() {
|
||||
return weChatCoreService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setWeChatCoreService(WeChatCoreService weChatCoreService) {
|
||||
this.weChatCoreService = weChatCoreService;
|
||||
}
|
||||
|
||||
public String execute() {
|
||||
|
||||
//logger.info("===============load WeChatAction================");
|
||||
String reMessage = "感谢您使用3e口语";
|
||||
//logger.info(weChat.toString());
|
||||
//验签
|
||||
try{
|
||||
if (WeChatSignUtil.checkSignature(weChat.getSignature(), weChat.getTimestamp(), weChat.getNonce())) {
|
||||
//判断是get还是post,如果是get,则判断接入,post,则为消息
|
||||
String getMethod = ServletActionContext.getRequest().getMethod();
|
||||
//get
|
||||
if(getMethod != null && getMethod.trim().equals("GET")){
|
||||
outMessage(weChat.getEchostr());
|
||||
}else{
|
||||
//post
|
||||
//logger.info("=======wechataction.post==============");
|
||||
String respMessage="";
|
||||
try {
|
||||
String ruStr = MessageUtil.getStreamString(ServletActionContext.getRequest().getInputStream());
|
||||
logger.info(ruStr);
|
||||
respMessage = weChatCoreService.processRequest(ruStr);
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("respMessage:" + respMessage);
|
||||
if(respMessage != null){
|
||||
outMessage(respMessage);
|
||||
} else {//取消关注
|
||||
getSession().clear();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//验签未通过
|
||||
outMessage(reMessage);
|
||||
}
|
||||
}catch(Exception e){
|
||||
try {
|
||||
logger.info(ServletActionContext.getRequest().getInputStream());
|
||||
} catch (IOException e1) {
|
||||
logger.error(e1.getMessage());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void outMessage(String biz_content) {
|
||||
PrintWriter writer = null;
|
||||
|
||||
try {
|
||||
ServletActionContext.getResponse().setCharacterEncoding("utf-8");
|
||||
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
|
||||
writer = ServletActionContext.getResponse().getWriter();
|
||||
writer.write(biz_content);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
public void getPropertis(){
|
||||
Json j = new Json();
|
||||
Object uid = getSession().get("uid");
|
||||
if(uid==null){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("未获取用户信息");
|
||||
super.writeJson(j);
|
||||
return;
|
||||
}
|
||||
Map<String, String> propList = OprerationProperties.getInstancei().getPropList();
|
||||
String appId_wechat = propList.get("appId_wechat");
|
||||
String weixin_DNS = propList.get("weixin_DNS");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appCode",appId_wechat);
|
||||
jsonObject.put("appDns",weixin_DNS);
|
||||
if(jsonObject!=null){
|
||||
j.setObj(jsonObject);
|
||||
j.setMsg("成功");
|
||||
j.setSuccess(true);
|
||||
}else{
|
||||
j.setMsg("失败");
|
||||
j.setSuccess(false);
|
||||
}
|
||||
super.writeJson(j);
|
||||
}
|
||||
@Override
|
||||
public WeChat getModel() {
|
||||
return weChat;
|
||||
}
|
||||
|
||||
}
|
||||
49
src/main/java/com/we3e/interceptor/EncodeFilter.java
Normal file
49
src/main/java/com/we3e/interceptor/EncodeFilter.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.we3e.interceptor;
|
||||
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import jakarta.servlet.Filter;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.FilterConfig;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
|
||||
import jakarta.servlet.annotation.WebFilter;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter;
|
||||
//import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;
|
||||
|
||||
//@WebFilter("/*.action")
|
||||
public class EncodeFilter extends StrutsPrepareAndExecuteFilter implements Filter {
|
||||
private FilterConfig config = null;
|
||||
private String encoding = null;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse httpResponse = (HttpServletResponse) response;
|
||||
if (encoding == null) {
|
||||
encoding = config.getInitParameter("encoding");
|
||||
}
|
||||
request.setCharacterEncoding(encoding);
|
||||
// 设置 CSP 策略
|
||||
// httpResponse.setHeader("Content-Security-Policy", "default-src'self'; script-src'self' https://trustedscripts.example.com; object-src 'none'; upgrade-insecure-requests");
|
||||
// httpResponse.setHeader("Content-Security-Policy-Report-Only", "object-src 'none'; script-src 'self' 'strict-dynamic' http: https:; base-uri 'none'");
|
||||
httpResponse.setCharacterEncoding(encoding);
|
||||
chain.doFilter(request, httpResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
config = null;
|
||||
encoding = null;
|
||||
}
|
||||
}
|
||||
25
src/main/java/com/we3e/interceptor/ServiceInterceptor.java
Normal file
25
src/main/java/com/we3e/interceptor/ServiceInterceptor.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.we3e.interceptor;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ActionInvocation;
|
||||
import org.apache.struts2.interceptor.AbstractInterceptor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class ServiceInterceptor extends AbstractInterceptor {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ServiceInterceptor.class);
|
||||
|
||||
@Override
|
||||
public String intercept(ActionInvocation actionInvocation) throws Exception {
|
||||
//logger.info("======进入业务拦截=======");
|
||||
ActionContext actionContext = actionInvocation.getInvocationContext();
|
||||
Map params = actionContext.getParameters();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/com/we3e/message/wechat/req/NewsMsg.java
Normal file
48
src/main/java/com/we3e/message/wechat/req/NewsMsg.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.we3e.message.wechat.req;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewsMsg {
|
||||
|
||||
private news news;
|
||||
|
||||
private String touser; //普通用户userid
|
||||
private String msgtype = "news"; //消息类型text,image,voice,video,music,news
|
||||
|
||||
public NewsMsg(){}
|
||||
|
||||
public NewsMsg(String touser,String title,String des,String url,String picUrl){
|
||||
this.touser = touser;
|
||||
articles art=new articles();
|
||||
art.setDescription(des);
|
||||
art.setPicurl(picUrl);
|
||||
art.setTitle(title);
|
||||
art.setUrl(url);
|
||||
List<articles> articles = new ArrayList<articles>();
|
||||
articles.add(art);
|
||||
news news=new news();
|
||||
news.setArticles(articles);
|
||||
this.news = news;
|
||||
}
|
||||
|
||||
public String getTouser() {
|
||||
return touser;
|
||||
}
|
||||
public void setTouser(String touser) {
|
||||
this.touser = touser;
|
||||
}
|
||||
public String getMsgtype() {
|
||||
return msgtype;
|
||||
}
|
||||
public void setMsgtype(String msgtype) {
|
||||
this.msgtype = msgtype;
|
||||
}
|
||||
public news getNews() {
|
||||
return news;
|
||||
}
|
||||
|
||||
public void setNews(news news) {
|
||||
this.news = news;
|
||||
}
|
||||
}
|
||||
30
src/main/java/com/we3e/message/wechat/req/TextMsg.java
Normal file
30
src/main/java/com/we3e/message/wechat/req/TextMsg.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.we3e.message.wechat.req;
|
||||
|
||||
public class TextMsg {
|
||||
|
||||
private text text;
|
||||
|
||||
private String touser; //普通用户openid
|
||||
private String msgtype; //消息类型text,image,voice,video,music,news
|
||||
|
||||
public String getTouser() {
|
||||
return touser;
|
||||
}
|
||||
public void setTouser(String touser) {
|
||||
this.touser = touser;
|
||||
}
|
||||
public String getMsgtype() {
|
||||
return msgtype;
|
||||
}
|
||||
public void setMsgtype(String msgtype) {
|
||||
this.msgtype = msgtype;
|
||||
}
|
||||
public text getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(text text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
36
src/main/java/com/we3e/message/wechat/req/articles.java
Normal file
36
src/main/java/com/we3e/message/wechat/req/articles.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.we3e.message.wechat.req;
|
||||
|
||||
public class articles {
|
||||
|
||||
private String title; //标题
|
||||
private String description; //描述
|
||||
private String url; //点击后跳转的链接
|
||||
private String picurl; //图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图640*320,小图80*80
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public String getPicurl() {
|
||||
return picurl;
|
||||
}
|
||||
public void setPicurl(String picurl) {
|
||||
this.picurl = picurl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
17
src/main/java/com/we3e/message/wechat/req/news.java
Normal file
17
src/main/java/com/we3e/message/wechat/req/news.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.we3e.message.wechat.req;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class news{
|
||||
|
||||
private List<articles> articles;
|
||||
|
||||
public List<articles> getArticles() {
|
||||
return articles;
|
||||
}
|
||||
|
||||
public void setArticles(List<articles> articles) {
|
||||
this.articles = articles;
|
||||
}
|
||||
|
||||
}
|
||||
15
src/main/java/com/we3e/message/wechat/req/text.java
Normal file
15
src/main/java/com/we3e/message/wechat/req/text.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.we3e.message.wechat.req;
|
||||
|
||||
public class text {
|
||||
|
||||
private String content;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
||||
45
src/main/java/com/we3e/message/wechat/res/Article.java
Normal file
45
src/main/java/com/we3e/message/wechat/res/Article.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
/**
|
||||
* 图文消息基类
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class Article {
|
||||
|
||||
// 图文消息名称
|
||||
private String Title;
|
||||
// 图文消息描述
|
||||
private String Description;
|
||||
// 图片链接,支持JPG、PNG格式,较好的效果为大图640*320,小图80*80,限制图片链接的域名需要与开发者填写的基本资料中的Url一致
|
||||
private String PicUrl;
|
||||
// 点击图文消息跳转链接
|
||||
private String Url;
|
||||
public String getTitle() {
|
||||
return Title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
Title = title;
|
||||
}
|
||||
public String getDescription() {
|
||||
return Description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
Description = description;
|
||||
}
|
||||
public String getPicUrl() {
|
||||
return PicUrl;
|
||||
}
|
||||
public void setPicUrl(String picUrl) {
|
||||
PicUrl = picUrl;
|
||||
}
|
||||
public String getUrl() {
|
||||
return Url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
Url = url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
44
src/main/java/com/we3e/message/wechat/res/BaseMessage.java
Normal file
44
src/main/java/com/we3e/message/wechat/res/BaseMessage.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
/**
|
||||
* 响应消息基类
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class BaseMessage {
|
||||
|
||||
// 接收方帐号(收到的OpenID)
|
||||
private String ToUserName;
|
||||
// 开发者微信号
|
||||
private String FromUserName;
|
||||
// 消息创建时间 (整型)
|
||||
private long CreateTime;
|
||||
// 消息类型(text/music/news)
|
||||
private String MsgType;
|
||||
|
||||
public String getToUserName() {
|
||||
return ToUserName;
|
||||
}
|
||||
public void setToUserName(String toUserName) {
|
||||
ToUserName = toUserName;
|
||||
}
|
||||
public String getFromUserName() {
|
||||
return FromUserName;
|
||||
}
|
||||
public void setFromUserName(String fromUserName) {
|
||||
FromUserName = fromUserName;
|
||||
}
|
||||
public long getCreateTime() {
|
||||
return CreateTime;
|
||||
}
|
||||
public void setCreateTime(long createTime) {
|
||||
CreateTime = createTime;
|
||||
}
|
||||
public String getMsgType() {
|
||||
return MsgType;
|
||||
}
|
||||
public void setMsgType(String msgType) {
|
||||
MsgType = msgType;
|
||||
}
|
||||
|
||||
}
|
||||
46
src/main/java/com/we3e/message/wechat/res/Music.java
Normal file
46
src/main/java/com/we3e/message/wechat/res/Music.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
/**
|
||||
* 音乐基类
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class Music {
|
||||
|
||||
// 音乐名称
|
||||
private String Title;
|
||||
// 音乐描述
|
||||
private String Description;
|
||||
// 音乐链接
|
||||
private String MusicUrl;
|
||||
// 高质量音乐链接,WIFI环境优先使用该链接播放音乐
|
||||
private String HqMusicUrl;
|
||||
public String getTitle() {
|
||||
return Title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
Title = title;
|
||||
}
|
||||
public String getDescription() {
|
||||
return Description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
Description = description;
|
||||
}
|
||||
public String getMusicUrl() {
|
||||
return MusicUrl;
|
||||
}
|
||||
public void setMusicUrl(String musicUrl) {
|
||||
MusicUrl = musicUrl;
|
||||
}
|
||||
public String getHqMusicUrl() {
|
||||
return HqMusicUrl;
|
||||
}
|
||||
public void setHqMusicUrl(String hqMusicUrl) {
|
||||
HqMusicUrl = hqMusicUrl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
23
src/main/java/com/we3e/message/wechat/res/MusicMessage.java
Normal file
23
src/main/java/com/we3e/message/wechat/res/MusicMessage.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
/**
|
||||
* 音乐消息
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class MusicMessage extends BaseMessage {
|
||||
|
||||
// 音乐
|
||||
private Music Music;
|
||||
|
||||
public Music getMusic() {
|
||||
return Music;
|
||||
}
|
||||
|
||||
public void setMusic(Music music) {
|
||||
Music = music;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
50
src/main/java/com/we3e/message/wechat/res/News.java
Normal file
50
src/main/java/com/we3e/message/wechat/res/News.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图文消息
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class News extends BaseMessage {
|
||||
|
||||
// 图文消息个数,限制为10条以内
|
||||
private int ArticleCount;
|
||||
// 多条图文消息信息,默认第一个item为大图
|
||||
private List<Article> Articles;
|
||||
public int getArticleCount() {
|
||||
return ArticleCount;
|
||||
}
|
||||
public void setArticleCount(int articleCount) {
|
||||
ArticleCount = articleCount;
|
||||
}
|
||||
public List<Article> getArticles() {
|
||||
return Articles;
|
||||
}
|
||||
public void setArticles(List<Article> articles) {
|
||||
Articles = articles;
|
||||
}
|
||||
|
||||
public News(){}
|
||||
|
||||
public News(String title,String des,String url,String picUrl,String fromUserName,String toUserName)
|
||||
{
|
||||
Article art = new Article();
|
||||
art.setTitle(title);
|
||||
art.setDescription(des);
|
||||
art.setPicUrl(picUrl);
|
||||
art.setUrl(url);
|
||||
Articles = new ArrayList<Article>();
|
||||
Articles.add(art);
|
||||
ArticleCount = 1;
|
||||
setFromUserName(fromUserName);
|
||||
setToUserName(toUserName);
|
||||
setMsgType("news");
|
||||
setCreateTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
21
src/main/java/com/we3e/message/wechat/res/TextMessage.java
Normal file
21
src/main/java/com/we3e/message/wechat/res/TextMessage.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.we3e.message.wechat.res;
|
||||
|
||||
/**
|
||||
* 文本消息
|
||||
* @author YY
|
||||
*
|
||||
*/
|
||||
public class TextMessage extends BaseMessage {
|
||||
|
||||
// 回复的消息内容
|
||||
private String Content;
|
||||
|
||||
public String getContent() {
|
||||
return Content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
Content = content;
|
||||
}
|
||||
|
||||
}
|
||||
19
src/main/java/com/we3e/model/BaseEntity.java
Normal file
19
src/main/java/com/we3e/model/BaseEntity.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.we3e.model;
|
||||
|
||||
public class BaseEntity {
|
||||
protected long uid;
|
||||
protected int apiCode;
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
public int getApiCode() {
|
||||
return apiCode;
|
||||
}
|
||||
public void setApiCode(int apiCode) {
|
||||
this.apiCode = apiCode;
|
||||
}
|
||||
|
||||
}
|
||||
14
src/main/java/com/we3e/model/Contants.java
Normal file
14
src/main/java/com/we3e/model/Contants.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.we3e.model;
|
||||
|
||||
import com.we3e.util.ServerConfig;
|
||||
|
||||
public class Contants {
|
||||
public static final String ffmpegpath = ServerConfig.getValue("FFMPEG.URL");//ffmpeg的安装位置
|
||||
public static final String mencoderpath = "E:\\ffmpeg\\mencoder\\"; // mencoder的目录
|
||||
|
||||
public static final String videofolder = ServerConfig.getValue("FFMPEG.SAVE"); // 需要被转换格式的视频目录
|
||||
public static final String targetfolder = ServerConfig.getValue("FFMPEG.SAVE"); // 转换后视频的目录
|
||||
|
||||
public static final String videoRealPath = "E:\\ffmpeg"; // 需要被截图的视频目录;
|
||||
public static final String imageRealPath = "E:\\ffmpeg"; // 截图的存放目录
|
||||
}
|
||||
94
src/main/java/com/we3e/model/msg/AppConfig.java
Normal file
94
src/main/java/com/we3e/model/msg/AppConfig.java
Normal file
@ -0,0 +1,94 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
/**
|
||||
* A class contains properties about application.The signature,made up of these
|
||||
* properties, will be a part of request-data to ensure the safety while sending
|
||||
* to HTTP.The value of properties are read from file
|
||||
* <strong>app_config.properties</strong>.The class have two
|
||||
* subclasses,MailConfig for mail settings and MessageConfig for message
|
||||
* settings.
|
||||
*
|
||||
* @see MailConfig
|
||||
* @see MessageConfig
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class AppConfig {
|
||||
/**
|
||||
* Application Id offered by user as the part of signature.
|
||||
* */
|
||||
protected String appId = null;
|
||||
/**
|
||||
* Application Key offered by user as the part of signature.
|
||||
* */
|
||||
protected String appKey = null;
|
||||
/**
|
||||
* Assign the type for encryption. md5:by md5 algorithm.If by this
|
||||
* algorithm,the format of signature is md5({@link #appId}{@link #appKey}
|
||||
* <variable>RequestData</variable>{@link #appId}{@link #appKey}); sha1:by
|
||||
* sha1 algorithm. normal:use the the value of {@link #appKey} without no
|
||||
* algorithm.It also the default value.
|
||||
* */
|
||||
protected String signType = null;
|
||||
|
||||
protected String messMUban = null;
|
||||
/**
|
||||
* Three kind of value of {@link #signType}
|
||||
* */
|
||||
public static final String TYPE_NORMAL = "normal";
|
||||
public static final String TYPE_MD5 = "md5";
|
||||
public static final String TYPE_SHA1 = "sha1";
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppKey() {
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey) {
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to get the {@link #signType}.It the value from the properties
|
||||
* file is not valid,return normal.Otherwise,return the current value.
|
||||
*
|
||||
* @return signType that is valid.
|
||||
* */
|
||||
public String getSignType() {
|
||||
if (this.checkType(this.signType)) {
|
||||
return this.signType;
|
||||
}
|
||||
return TYPE_NORMAL;
|
||||
}
|
||||
|
||||
public void setSignType(String signType) {
|
||||
this.signType = signType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge the value of {@link #signType} is valid or not.
|
||||
*
|
||||
* @param signType
|
||||
* @return If the value is inside of {@value #TYPE_MD5},{@value #TYPE_SHA1}
|
||||
* and {@value #TYPE_NORMAL}, return true,otherwise return false;
|
||||
* */
|
||||
private boolean checkType(String signType) {
|
||||
return TYPE_NORMAL.equals(signType) || TYPE_MD5.equals(signType)
|
||||
|| TYPE_SHA1.equals(signType);
|
||||
}
|
||||
|
||||
public String getMessMUban() {
|
||||
return messMUban;
|
||||
}
|
||||
|
||||
public void setMessMUban(String messMUban) {
|
||||
this.messMUban = messMUban;
|
||||
}
|
||||
|
||||
}
|
||||
96
src/main/java/com/we3e/model/msg/ConfigLoader.java
Normal file
96
src/main/java/com/we3e/model/msg/ConfigLoader.java
Normal file
@ -0,0 +1,96 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* A class obtain the value and create configuration object by loading file
|
||||
* app_config.properties,including creating <strong>MailConfig<strong> and
|
||||
* creating <strong>MessageConfig<strong>.
|
||||
*
|
||||
* @see AppConfig
|
||||
* @see MailConfig
|
||||
* @see MessageConfig
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class ConfigLoader {
|
||||
|
||||
private static Properties pros = null;
|
||||
/**
|
||||
* Loading file while class loading.The operation inside of static block
|
||||
* will be run once.
|
||||
* */
|
||||
static {
|
||||
String filep=ConfigLoader.class.getResource("/").getPath() +"app_config.properties";
|
||||
pros = new Properties();
|
||||
try {
|
||||
InputStream in = new BufferedInputStream(new FileInputStream(filep)
|
||||
);
|
||||
if (in == null) {
|
||||
} else {
|
||||
pros.load(in);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* enum define two kinds of configuration.
|
||||
* */
|
||||
public static enum ConfigType {
|
||||
Mail, Message,MessageDing
|
||||
};
|
||||
|
||||
/**
|
||||
* A static method for outer class to create configuration by loading file.
|
||||
*
|
||||
* @param type
|
||||
* ConfigType
|
||||
* @return If the type is ConfigType#Mail,return the instance of
|
||||
* {@link MailConfig}. And,if the type is ConfigType#Message,return
|
||||
* the instance of {@link MessageConfig}.
|
||||
* */
|
||||
public static AppConfig load(ConfigType type) {
|
||||
switch (type) {
|
||||
case Mail:
|
||||
return createMailConfig();
|
||||
case Message:
|
||||
return createMessageConfig();
|
||||
case MessageDing:
|
||||
return createMessageDingConfig();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static AppConfig createMailConfig() {
|
||||
AppConfig config = new MailConfig();
|
||||
config.setAppId(pros.getProperty(MailConfig.APP_ID));
|
||||
config.setAppKey(pros.getProperty(MailConfig.APP_KEY));
|
||||
config.setSignType(pros.getProperty(MailConfig.APP_SIGNTYPE));
|
||||
return config;
|
||||
}
|
||||
|
||||
private static AppConfig createMessageConfig() {
|
||||
AppConfig config = new MessageConfig();
|
||||
config.setAppId(pros.getProperty(MessageConfig.APP_ID));
|
||||
config.setAppKey(pros.getProperty(MessageConfig.APP_KEY));
|
||||
config.setSignType(pros.getProperty(MessageConfig.APP_SIGNTYPE));
|
||||
config.setMessMUban(pros.getProperty(MessageConfig.APP_MUBAN));
|
||||
return config;
|
||||
}
|
||||
|
||||
private static AppConfig createMessageDingConfig() {
|
||||
AppConfig config = new MessageConfig();
|
||||
config.setAppId(pros.getProperty(MessageConfig.APP_ID));
|
||||
config.setAppKey(pros.getProperty(MessageConfig.APP_KEY));
|
||||
config.setSignType(pros.getProperty(MessageConfig.APP_SIGNTYPE));
|
||||
config.setMessMUban(pros.getProperty(MessageConfig.APP_DING_MUBAN));
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
||||
111
src/main/java/com/we3e/model/msg/DataStore.java
Normal file
111
src/main/java/com/we3e/model/msg/DataStore.java
Normal file
@ -0,0 +1,111 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
/**
|
||||
* A class extends TreeMap in order to store the request data with format of key-value.
|
||||
* Such as appid, appkey, to and other information.The TreeMap ensure that the key can be sorted
|
||||
* descending to create signature.
|
||||
* @version 1.0 2014/11/2
|
||||
* */
|
||||
public class DataStore extends TreeMap<String, Object> {
|
||||
|
||||
public static final String COMMA = ",";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DataStore() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a adding pattern that data can be added to map one by one
|
||||
* but displayed with a string separated by comma.
|
||||
* For Example,
|
||||
* <code>
|
||||
* addWithComma("K", "v1");
|
||||
* addWithComma("K", "v2");
|
||||
* </code>
|
||||
* Then, the map is {"K", "v1, v2"}
|
||||
* @param key is the map's key
|
||||
* @param value is the adding data
|
||||
* */
|
||||
public void addWithComma(String key, String value) {
|
||||
if (StringUtil.isNullOrEmpty(key))
|
||||
return;
|
||||
if (this.containsKey(key)) {
|
||||
String item = COMMA + value;
|
||||
this.put(key, this.get(key) + item);
|
||||
} else {
|
||||
this.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a adding pattern that data can be added to map one by one
|
||||
* but displayed with a string decorated by angle brackets.
|
||||
* For Example,
|
||||
* <code>
|
||||
* addWithBracket("K", "v11", "v12");
|
||||
* addWithBracket("K", "v21", "v22");
|
||||
* </code>
|
||||
* Then, the map is {"K", "v11<v12>, v21<v22>"}
|
||||
* @param key is the map's key
|
||||
* @param left
|
||||
* @param right
|
||||
* */
|
||||
public void addWithBracket(String key, String left, String right) {
|
||||
addWithComma(key, left + "<" + right + ">");
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a adding pattern that data can be added to map one by one
|
||||
* but displayed with a json.
|
||||
* For Example,
|
||||
* <code>
|
||||
* addWithBracket("K", "jk1", "jv1");
|
||||
* addWithBracket("K", "jk2", "jv2");
|
||||
* </code>
|
||||
* Then, the map is {"K",{"jk1":"jv1","jk2":"jv2"}
|
||||
* @param key is the map's key
|
||||
* @param jKey is the key of json
|
||||
* @param jValue is the value of json
|
||||
* */
|
||||
public void addWithJson(String key, String jKey, String jValue) {
|
||||
if (StringUtil.isNullOrEmpty(key))
|
||||
return;
|
||||
try {
|
||||
JSONObject json = null;
|
||||
if (this.containsKey(key)) {
|
||||
Object val = this.get(key);
|
||||
json = JSONObject.parseObject(val.toString());
|
||||
} else {
|
||||
json = new JSONObject();
|
||||
}
|
||||
if (json != null) {
|
||||
json.put(jKey, jValue);
|
||||
this.put(key, json.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int idx = 0;
|
||||
|
||||
/**
|
||||
* Put a data with increasing key.
|
||||
* For exmaple,
|
||||
* <code>addWithIncrease("K", "v1");addWithIncrease("K", "v2");
|
||||
* </code>
|
||||
* Then, the map is {"K[0]", v1},{"K[1]", v2}
|
||||
* @param key is the map's key
|
||||
* @param value is the map's value
|
||||
* */
|
||||
public void addWithIncrease(String key, Object value) {
|
||||
this.put(key + "[" + idx++ + "]", value);
|
||||
}
|
||||
}
|
||||
35
src/main/java/com/we3e/model/msg/ISender.java
Normal file
35
src/main/java/com/we3e/model/msg/ISender.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A interface define a method of {@link #send(Map)}.All classes what can send
|
||||
* request data must implement it.And the classes are always designed as
|
||||
* communication mode or a tool,that is,mail mode and message mode.No matter
|
||||
* what kinds of mode or tool we choose,we can send a request.
|
||||
*
|
||||
* @see Mail
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public interface ISender {
|
||||
|
||||
/**
|
||||
* Send the request data.
|
||||
* @param data {@link HashMap}contains the request data.Such as
|
||||
* <p>
|
||||
* to->xxx@submail.cn
|
||||
* cc->nnn@submail.cn
|
||||
* text->Hello,world!
|
||||
* </p>
|
||||
* @return If send successfully,return true.Error occurs,return false.
|
||||
* */
|
||||
public String send(Map<String, Object> data);
|
||||
|
||||
public String xsend(Map<String, Object> data);
|
||||
|
||||
public String subscribe(Map<String, Object> data);
|
||||
|
||||
public String unsubscribe(Map<String, Object> data);
|
||||
|
||||
}
|
||||
55
src/main/java/com/we3e/model/msg/MESSAGEXsend.java
Normal file
55
src/main/java/com/we3e/model/msg/MESSAGEXsend.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
|
||||
/**
|
||||
* A SenderWapper class as decoration class for user to send request by message.
|
||||
* User can set the basic information of request by included several methods.
|
||||
* Then,send the request data by a mode of message.By this pattern,user needn't
|
||||
* offer the message content and message signature,change the message content by variable dynamicly if prividing only id which
|
||||
* created in submail application.
|
||||
*
|
||||
*
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class MESSAGEXsend extends SenderWapper {
|
||||
|
||||
/**
|
||||
* If the mode is mail,it's an instance of {@link MailConfig}. If the mode
|
||||
* is message,it's an instance of {@link MessageConfig}
|
||||
* */
|
||||
protected AppConfig config = null;
|
||||
public static final String ADDRESSBOOK = "addressbook";
|
||||
public static final String TO = "to";
|
||||
public static final String PROJECT = "project";
|
||||
public static final String VARS = "vars";
|
||||
public static final String LINKS = "links";
|
||||
|
||||
public MESSAGEXsend(AppConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void addTo(String address) {
|
||||
requestData.addWithComma(TO, address);
|
||||
}
|
||||
|
||||
public void addAddressBook(String addressbook) {
|
||||
requestData.addWithComma(ADDRESSBOOK, addressbook);
|
||||
}
|
||||
|
||||
public void setProject(String project) {
|
||||
requestData.put(PROJECT, project);
|
||||
}
|
||||
|
||||
public void addVar(String key, String val) {
|
||||
requestData.addWithJson(VARS, key, val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISender getSender() {
|
||||
return new Message(this.config);
|
||||
}
|
||||
|
||||
public String xsend(){
|
||||
return getSender().xsend(requestData);
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/we3e/model/msg/MailConfig.java
Normal file
13
src/main/java/com/we3e/model/msg/MailConfig.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
/**
|
||||
* A AppConfig class store the configuration for mail.
|
||||
* @see AppConfig
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class MailConfig extends AppConfig {
|
||||
|
||||
public static final String APP_ID = "mail_appid";
|
||||
public static final String APP_KEY = "mail_appkey";
|
||||
public static final String APP_SIGNTYPE = "normal";
|
||||
}
|
||||
60
src/main/java/com/we3e/model/msg/Message.java
Normal file
60
src/main/java/com/we3e/model/msg/Message.java
Normal file
@ -0,0 +1,60 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A Sender class define the message mode to send HTTP request.
|
||||
*
|
||||
* @see ISender
|
||||
* @see Sender
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class Message extends Sender {
|
||||
|
||||
private static final String API_SEND = "http://api.submail.cn/message/send.json";
|
||||
private static final String API_XSEND = "http://api-v4.mysubmail.com/sms/xsend.json";
|
||||
private static final String API_SUBSCRIBE = "http://api.submail.cn/addressbook/message/subscribe.json";
|
||||
private static final String API_UNSUBSCRIBE = "http://api.submail.cn/addressbook/message/unsubscribe.json";
|
||||
|
||||
public Message(AppConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send request data to server.The data consists of two parts. One of them
|
||||
* is original data,and another is signature.For example,the original data
|
||||
* is
|
||||
* <p>
|
||||
* address=jam@submail.cn?name=jam
|
||||
* </p>
|
||||
* .Then,the final request data is
|
||||
* <p>
|
||||
* address=jam@submail.cn?name=jam?appid=xxx?appkey=xxx?timestamp=xxx?signature=xxx?
|
||||
* <p>
|
||||
* The algorithm of signature is {@link #createSignature(String)}
|
||||
* @see RequestSigner#getSignature()
|
||||
* @param data
|
||||
* is the original data only contains content.
|
||||
* */
|
||||
@Override
|
||||
public String send(Map<String, Object> data) {
|
||||
return request(API_SEND, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String xsend(Map<String, Object> data) {
|
||||
return request(API_XSEND, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String subscribe(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return request(API_SUBSCRIBE, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unsubscribe(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return request(API_UNSUBSCRIBE, data);
|
||||
}
|
||||
}
|
||||
14
src/main/java/com/we3e/model/msg/MessageConfig.java
Normal file
14
src/main/java/com/we3e/model/msg/MessageConfig.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.we3e.model.msg;
|
||||
/**
|
||||
* A AppConfig class store the configuration for message.
|
||||
* @see AppConfig
|
||||
* @version 1.0 at 2014/10/28
|
||||
* */
|
||||
public class MessageConfig extends AppConfig{
|
||||
|
||||
public static final String APP_ID = "msg_appid";
|
||||
public static final String APP_KEY = "msg_appkey";
|
||||
public static final String APP_SIGNTYPE = "msg_signtype";
|
||||
public static final String APP_MUBAN = "msg_muban";
|
||||
public static final String APP_DING_MUBAN = "msg_ding_muban";
|
||||
}
|
||||
14
src/main/java/com/we3e/model/msg/MessageXSendDemo.java
Normal file
14
src/main/java/com/we3e/model/msg/MessageXSendDemo.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
|
||||
public class MessageXSendDemo {
|
||||
|
||||
public static void main(String[] args) {
|
||||
AppConfig config = ConfigLoader.load(ConfigLoader.ConfigType.Message);
|
||||
MESSAGEXsend submail = new MESSAGEXsend(config);
|
||||
submail.addTo("18981904701");
|
||||
submail.setProject(config.getMessMUban());
|
||||
submail.addVar("mcode", "123321");
|
||||
submail.xsend();
|
||||
}
|
||||
}
|
||||
68
src/main/java/com/we3e/model/msg/RequestEncoder.java
Normal file
68
src/main/java/com/we3e/model/msg/RequestEncoder.java
Normal file
@ -0,0 +1,68 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class RequestEncoder {
|
||||
|
||||
|
||||
private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
public static final String MD5 = "MD5";
|
||||
public static final String SHA1 = "SHA1";
|
||||
/**
|
||||
* encode string
|
||||
*
|
||||
* @param algorithm
|
||||
* @param str
|
||||
* @return String
|
||||
*/
|
||||
public static String encode(String algorithm, String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
|
||||
messageDigest.update(str.getBytes());
|
||||
return getFormattedText(messageDigest.digest());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the raw bytes from the digest and formats them correct.
|
||||
*
|
||||
* @param bytes
|
||||
* the raw bytes from the digest.
|
||||
* @return the formatted bytes.
|
||||
*/
|
||||
private static String getFormattedText(byte[] bytes) {
|
||||
int len = bytes.length;
|
||||
StringBuilder buf = new StringBuilder(len * 2);
|
||||
for (int j = 0; j < len; j++) { buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
|
||||
buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String formatRequest(Map<String, Object> data){
|
||||
Set<String> keySet = data.keySet();
|
||||
Iterator<String> it = keySet.iterator();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while(it.hasNext()){
|
||||
String key = it.next();
|
||||
Object value = data.get(key);
|
||||
if(value instanceof String){
|
||||
sb.append(key + "=" + value + "&");
|
||||
}
|
||||
}
|
||||
if(sb.length() != 0){
|
||||
return sb.substring(0, sb.length() - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
178
src/main/java/com/we3e/model/msg/Sender.java
Normal file
178
src/main/java/com/we3e/model/msg/Sender.java
Normal file
@ -0,0 +1,178 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* A class implements ISender contains common methods to process something that
|
||||
* occured before sending.That is, create a signature and build the request
|
||||
* data.
|
||||
*
|
||||
* @see Mail
|
||||
* @see Message
|
||||
* @version 1.0 at 2014/10/30
|
||||
* */
|
||||
public class Sender implements ISender {
|
||||
|
||||
protected AppConfig config = null;
|
||||
private static final String API_TIMESTAMP = "http://api.submail.cn/service/timestamp.json";
|
||||
public static final String APPID = "appid";
|
||||
public static final String TIMESTAMP = "timestamp";
|
||||
public static final String SIGN_TYPE = "sign_type";
|
||||
public static final String SIGNATURE = "signature";
|
||||
private CloseableHttpClient closeableHttpClient = null;
|
||||
|
||||
public Sender() {
|
||||
closeableHttpClient = HttpClientBuilder.create().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String send(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String xsend(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String subscribe(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unsubscribe(Map<String, Object> data) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a request to require timestamp from server.
|
||||
* @return timestamp
|
||||
* */
|
||||
protected String getTimestamp() {
|
||||
HttpGet httpget = new HttpGet(API_TIMESTAMP);
|
||||
HttpResponse response;
|
||||
try {
|
||||
response = closeableHttpClient.execute(httpget);
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
String jsonStr = EntityUtils.toString(httpEntity, "UTF-8");
|
||||
if (jsonStr != null) {
|
||||
JSONObject json = JSONObject.parseObject(jsonStr);
|
||||
return json.getString("timestamp");
|
||||
}
|
||||
closeableHttpClient.close();
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String createSignature(String data) {
|
||||
if (AppConfig.TYPE_NORMAL.equals(config.getSignType())) {
|
||||
return config.getAppKey();
|
||||
} else {
|
||||
return buildSignature(data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When the {@link AppConfig#setSignType(String)} is not normal,create a
|
||||
* signature with sign type.
|
||||
*
|
||||
* @param data
|
||||
* is the request data
|
||||
* @return signature
|
||||
* */
|
||||
private String buildSignature(String data) {
|
||||
String app = config.getAppId();
|
||||
String appKey = config.getAppKey();
|
||||
// order is confirmed
|
||||
String jointData = app + appKey + data + app + appKey;
|
||||
if (AppConfig.TYPE_MD5.equals(config.getSignType())) {
|
||||
return RequestEncoder.encode(RequestEncoder.MD5, jointData);
|
||||
} else if (AppConfig.TYPE_SHA1.equals(config.getSignType())) {
|
||||
return RequestEncoder.encode(RequestEncoder.SHA1, jointData);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to url with data.
|
||||
*
|
||||
* @param url
|
||||
* @param data
|
||||
* @return boolean
|
||||
* */
|
||||
protected String request(String url, Map<String, Object> data) {
|
||||
HttpPost httppost = new HttpPost(url);
|
||||
httppost.addHeader("charset", "UTF-8");
|
||||
httppost.setEntity(build(data));
|
||||
try {
|
||||
HttpResponse response = closeableHttpClient.execute(httppost);
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
if (httpEntity != null) {
|
||||
return EntityUtils.toString(httpEntity, "UTF-8");
|
||||
}
|
||||
closeableHttpClient.close();
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the request data to HttpEntity
|
||||
*
|
||||
* @param data
|
||||
* @return HttpEntity
|
||||
* */
|
||||
protected HttpEntity build(Map<String, Object> data) {
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addTextBody(APPID, config.getAppId());
|
||||
// builder.setCharset(Charset.);
|
||||
builder.addTextBody(TIMESTAMP, this.getTimestamp());
|
||||
builder.addTextBody(SIGN_TYPE, config.getSignType());
|
||||
// set the properties below for signature
|
||||
data.put(APPID, config.getAppId());
|
||||
data.put(TIMESTAMP, this.getTimestamp());
|
||||
data.put(SIGN_TYPE, config.getSignType());
|
||||
ContentType contentType = ContentType.create(HTTP.PLAIN_TEXT_TYPE, HTTP.UTF_8);
|
||||
builder.addTextBody(SIGNATURE,
|
||||
createSignature(RequestEncoder.formatRequest(data)), contentType);
|
||||
for (Map.Entry<String, Object> entry : data.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
builder.addTextBody(key, String.valueOf(value), contentType);
|
||||
} else if (value instanceof File) {
|
||||
builder.addBinaryBody(key, (File) value);
|
||||
}
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
9
src/main/java/com/we3e/model/msg/SenderWapper.java
Normal file
9
src/main/java/com/we3e/model/msg/SenderWapper.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
|
||||
public abstract class SenderWapper {
|
||||
|
||||
protected DataStore requestData = new DataStore();
|
||||
|
||||
public abstract ISender getSender();
|
||||
}
|
||||
8
src/main/java/com/we3e/model/msg/StringUtil.java
Normal file
8
src/main/java/com/we3e/model/msg/StringUtil.java
Normal file
@ -0,0 +1,8 @@
|
||||
package com.we3e.model.msg;
|
||||
|
||||
public class StringUtil {
|
||||
|
||||
public static boolean isNullOrEmpty(String text){
|
||||
return text == null || text.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/we3e/model/page/Config.java
Normal file
45
src/main/java/com/we3e/model/page/Config.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.we3e.model.page;
|
||||
|
||||
|
||||
public class Config {
|
||||
|
||||
private String code; // 常量名
|
||||
private String description; // 描述
|
||||
private String para; // 常量值
|
||||
|
||||
public Config() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Config(String code, String description, String para) {
|
||||
super();
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
this.para = para;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getPara() {
|
||||
return para;
|
||||
}
|
||||
|
||||
public void setPara(String para) {
|
||||
this.para = para;
|
||||
}
|
||||
|
||||
}
|
||||
25
src/main/java/com/we3e/model/page/DataGrid.java
Normal file
25
src/main/java/com/we3e/model/page/DataGrid.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.we3e.model.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DataGrid {
|
||||
|
||||
private Long total = 0L;
|
||||
private List rows = new ArrayList();
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
public List getRows() {
|
||||
return rows;
|
||||
}
|
||||
public void setRows(List rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
75
src/main/java/com/we3e/model/page/JsSignUtil.java
Normal file
75
src/main/java/com/we3e/model/page/JsSignUtil.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.we3e.model.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.we3e.util.OprerationProperties;
|
||||
|
||||
public class JsSignUtil implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1362889903870330282L;
|
||||
|
||||
private String appId = OprerationProperties.getInstancei().getPropList().get("appId_wechat");
|
||||
|
||||
private String noncestr ;
|
||||
|
||||
private String jsapi_ticket ;
|
||||
|
||||
private String timestamp ;
|
||||
|
||||
private String url ;
|
||||
|
||||
private String signature ;
|
||||
public JsSignUtil(){}
|
||||
public JsSignUtil(String noncestr, String jsapi_ticket, String timestamp,
|
||||
String url, String signature) {
|
||||
this.noncestr = noncestr;
|
||||
this.jsapi_ticket = jsapi_ticket;
|
||||
this.timestamp = timestamp;
|
||||
this.url = url;
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getNoncestr() {
|
||||
return noncestr;
|
||||
}
|
||||
|
||||
public void setNoncestr(String noncestr) {
|
||||
this.noncestr = noncestr;
|
||||
}
|
||||
|
||||
public String getJsapi_ticket() {
|
||||
return jsapi_ticket;
|
||||
}
|
||||
|
||||
public void setJsapi_ticket(String jsapi_ticket) {
|
||||
this.jsapi_ticket = jsapi_ticket;
|
||||
}
|
||||
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(String timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
}
|
||||
37
src/main/java/com/we3e/model/page/Json.java
Normal file
37
src/main/java/com/we3e/model/page/Json.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.we3e.model.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Json implements Serializable {
|
||||
|
||||
private boolean success = false;
|
||||
|
||||
private String msg = "";
|
||||
|
||||
private Object obj = null;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getObj() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
public void setObj(Object obj) {
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/com/we3e/model/teacher/BindAcc.java
Normal file
61
src/main/java/com/we3e/model/teacher/BindAcc.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 账号绑定查询类
|
||||
*/
|
||||
public class BindAcc extends BaseEntity{
|
||||
private String openId;
|
||||
private int userType;
|
||||
private String loginNo;
|
||||
private String password;
|
||||
private String cellphone;
|
||||
private int status = 1;
|
||||
private int type = 1;
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
public int getUserType() {
|
||||
return userType;
|
||||
}
|
||||
public void setUserType(int userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
public String getLoginNo() {
|
||||
return loginNo;
|
||||
}
|
||||
public void setLoginNo(String loginNo) {
|
||||
this.loginNo = loginNo;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
public String getCellphone() {
|
||||
return cellphone;
|
||||
}
|
||||
public void setCellphone(String cellphone) {
|
||||
this.cellphone = cellphone;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
17
src/main/java/com/we3e/model/teacher/ClassNotices.java
Normal file
17
src/main/java/com/we3e/model/teacher/ClassNotices.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
/*
|
||||
* 删除公告时的列表类
|
||||
*/
|
||||
public class ClassNotices{
|
||||
private int id;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
17
src/main/java/com/we3e/model/teacher/Classes.java
Normal file
17
src/main/java/com/we3e/model/teacher/Classes.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
/*
|
||||
* 发布公告的班级列表类
|
||||
*/
|
||||
public class Classes {
|
||||
private long classesId;
|
||||
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
|
||||
}
|
||||
133
src/main/java/com/we3e/model/teacher/DeleExam.java
Normal file
133
src/main/java/com/we3e/model/teacher/DeleExam.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
public class DeleExam extends BaseEntity{
|
||||
private int examId;
|
||||
private String examType;
|
||||
private String description;
|
||||
private String title;
|
||||
private int examPaperCount=1;
|
||||
private String examPapers;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private int isNetExam=0;
|
||||
private int isOral;
|
||||
private int isRecommend;
|
||||
private long teacherId;
|
||||
private int hearPaperId;
|
||||
private int type = 1;
|
||||
private int status = 1;
|
||||
|
||||
public int getIsRecommend() {
|
||||
return isRecommend;
|
||||
}
|
||||
public void setIsRecommend(int isRecommend) {
|
||||
this.isRecommend = isRecommend;
|
||||
}
|
||||
public long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
public void setTeacherId(long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
public int getHearPaperId() {
|
||||
return hearPaperId;
|
||||
}
|
||||
public void setHearPaperId(int hearPaperId) {
|
||||
this.hearPaperId = hearPaperId;
|
||||
}
|
||||
public int getExamId() {
|
||||
return examId;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getExamPaperCount() {
|
||||
return examPaperCount;
|
||||
}
|
||||
|
||||
public void setExamPaperCount(int examPaperCount) {
|
||||
this.examPaperCount = examPaperCount;
|
||||
}
|
||||
|
||||
public String getExamPapers() {
|
||||
return examPapers;
|
||||
}
|
||||
|
||||
public void setExamPapers(String examPapers) {
|
||||
this.examPapers = examPapers;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getIsNetExam() {
|
||||
return isNetExam;
|
||||
}
|
||||
|
||||
public void setIsNetExam(int isNetExam) {
|
||||
this.isNetExam = isNetExam;
|
||||
}
|
||||
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
|
||||
public void setExamId(int examId) {
|
||||
this.examId = examId;
|
||||
}
|
||||
|
||||
public String getExamType() {
|
||||
return examType;
|
||||
}
|
||||
|
||||
public void setExamType(String examType) {
|
||||
this.examType = examType;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
22
src/main/java/com/we3e/model/teacher/DeleNotice.java
Normal file
22
src/main/java/com/we3e/model/teacher/DeleNotice.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 删除公告时的类
|
||||
*/
|
||||
public class DeleNotice extends BaseEntity{
|
||||
private List<ClassNotices> classMessages;
|
||||
|
||||
public List<ClassNotices> getClassMessages() {
|
||||
return classMessages;
|
||||
}
|
||||
|
||||
public void setClassMessages(List<ClassNotices> classMessages) {
|
||||
this.classMessages = classMessages;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
src/main/java/com/we3e/model/teacher/DeleWork.java
Normal file
22
src/main/java/com/we3e/model/teacher/DeleWork.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 删除公告时的类
|
||||
*/
|
||||
public class DeleWork extends BaseEntity{
|
||||
private List<ClassNotices> assignments;
|
||||
|
||||
public List<ClassNotices> getAssignments() {
|
||||
return assignments;
|
||||
}
|
||||
|
||||
public void setAssignments(List<ClassNotices> assignments) {
|
||||
this.assignments = assignments;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
29
src/main/java/com/we3e/model/teacher/Lessons.java
Normal file
29
src/main/java/com/we3e/model/teacher/Lessons.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
/*
|
||||
* 布置训练的单元课程类
|
||||
*/
|
||||
public class Lessons {
|
||||
private String assignType;
|
||||
private int unitId;
|
||||
private int lessonId;
|
||||
public String getAssignType() {
|
||||
return assignType;
|
||||
}
|
||||
public void setAssignType(String assignType) {
|
||||
this.assignType = assignType;
|
||||
}
|
||||
public int getUnitId() {
|
||||
return unitId;
|
||||
}
|
||||
public void setUnitId(int unitId) {
|
||||
this.unitId = unitId;
|
||||
}
|
||||
public int getLessonId() {
|
||||
return lessonId;
|
||||
}
|
||||
public void setLessonId(int lessonId) {
|
||||
this.lessonId = lessonId;
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/com/we3e/model/teacher/Notice.java
Normal file
48
src/main/java/com/we3e/model/teacher/Notice.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 发布公告类
|
||||
*/
|
||||
public class Notice extends BaseEntity{
|
||||
private String content;
|
||||
private long teacherId;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private List<Classes> classess;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
public void setTeacherId(long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
public List<Classes> getClassess() {
|
||||
return classess;
|
||||
}
|
||||
public void setClassess(List<Classes> classess) {
|
||||
this.classess = classess;
|
||||
}
|
||||
|
||||
}
|
||||
73
src/main/java/com/we3e/model/teacher/PushMessageDetail.java
Normal file
73
src/main/java/com/we3e/model/teacher/PushMessageDetail.java
Normal file
@ -0,0 +1,73 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 微信推送微信号查询类
|
||||
*/
|
||||
public class PushMessageDetail extends BaseEntity{
|
||||
private String pushType;
|
||||
private long classesid;
|
||||
private int assignmentid;
|
||||
private int classmessageid;
|
||||
private int examId;
|
||||
private int isOral;
|
||||
private Long teacherId;
|
||||
|
||||
public Long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
|
||||
public void setTeacherId(Long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
|
||||
public int getExamId() {
|
||||
return examId;
|
||||
}
|
||||
|
||||
public void setExamId(int examId) {
|
||||
this.examId = examId;
|
||||
}
|
||||
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
|
||||
public int getClassmessageid() {
|
||||
return classmessageid;
|
||||
}
|
||||
|
||||
public void setClassmessageid(int classmessageid) {
|
||||
this.classmessageid = classmessageid;
|
||||
}
|
||||
|
||||
public String getPushType() {
|
||||
return pushType;
|
||||
}
|
||||
|
||||
public void setPushType(String pushType) {
|
||||
this.pushType = pushType;
|
||||
}
|
||||
|
||||
public long getClassesid() {
|
||||
return classesid;
|
||||
}
|
||||
|
||||
public void setClassesid(long classesid) {
|
||||
this.classesid = classesid;
|
||||
}
|
||||
|
||||
public int getAssignmentid() {
|
||||
return assignmentid;
|
||||
}
|
||||
|
||||
public void setAssignmentid(int assignmentid) {
|
||||
this.assignmentid = assignmentid;
|
||||
}
|
||||
|
||||
}
|
||||
37
src/main/java/com/we3e/model/teacher/PushQueryMessage.java
Normal file
37
src/main/java/com/we3e/model/teacher/PushQueryMessage.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 微信推送班级查询类
|
||||
*/
|
||||
public class PushQueryMessage extends BaseEntity{
|
||||
private String pushType;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
public String getPushType() {
|
||||
return pushType;
|
||||
}
|
||||
|
||||
public void setPushType(String pushType) {
|
||||
this.pushType = pushType;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
}
|
||||
51
src/main/java/com/we3e/model/teacher/QinXue.java
Normal file
51
src/main/java/com/we3e/model/teacher/QinXue.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/**
|
||||
* @ClassName: QinXue
|
||||
* @Description:
|
||||
* @date: 2019/1/16 15:37
|
||||
* @author: peanut
|
||||
* @version:
|
||||
*/
|
||||
public class QinXue extends BaseEntity {
|
||||
private long classesId;
|
||||
private long userId;
|
||||
private int listType ; //1、学霸榜 2、好声音榜 3、金牌榜 4、关注榜 5、班级金牌榜 6、班级勤学榜
|
||||
private String timeType;
|
||||
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public String getTimeType() {
|
||||
return timeType;
|
||||
}
|
||||
public void setTimeType(String timeType) {
|
||||
this.timeType = timeType;
|
||||
}
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public int getListType() {
|
||||
return listType;
|
||||
}
|
||||
public void setListType(int listType) {
|
||||
this.listType = listType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QinXue{" +
|
||||
"classesId=" + classesId +
|
||||
", userId=" + userId +
|
||||
", listType=" + listType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
38
src/main/java/com/we3e/model/teacher/QueryAssign.java
Normal file
38
src/main/java/com/we3e/model/teacher/QueryAssign.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* 查询训练类
|
||||
*/
|
||||
public class QueryAssign extends BaseEntity{
|
||||
private int assignmentId;
|
||||
private String queryType;
|
||||
// 修改延期时间
|
||||
private String endTime;
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
public void setAssignmentId(int assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
75
src/main/java/com/we3e/model/teacher/QueryAssignComm.java
Normal file
75
src/main/java/com/we3e/model/teacher/QueryAssignComm.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 训练点评类
|
||||
*/
|
||||
public class QueryAssignComm extends BaseEntity{
|
||||
private int assignCommId = 0;
|
||||
private String queryType;
|
||||
private long teacherId;
|
||||
private int assignmentId;
|
||||
private int toObject;//针对对象 1学生,2教师
|
||||
private long objectId;//对象ID 为学生时,就是studentId;为班级时,就是classesId
|
||||
private String voice;//声音文件 文件是保存在OSS上的,这里只是文件名。文件名为前缀+UUID+.MP3,如+
|
||||
private String description;//文字内容
|
||||
private int voiceLen;
|
||||
|
||||
public int getVoiceLen() {
|
||||
return voiceLen;
|
||||
}
|
||||
public void setVoiceLen(int voiceLen) {
|
||||
this.voiceLen = voiceLen;
|
||||
}
|
||||
public int getAssignCommId() {
|
||||
return assignCommId;
|
||||
}
|
||||
public void setAssignCommId(int assignCommId) {
|
||||
this.assignCommId = assignCommId;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
public void setTeacherId(long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
public int getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
public void setAssignmentId(int assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
public int getToObject() {
|
||||
return toObject;
|
||||
}
|
||||
public void setToObject(int toObject) {
|
||||
this.toObject = toObject;
|
||||
}
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
public void setObjectId(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
public String getVoice() {
|
||||
return voice;
|
||||
}
|
||||
public void setVoice(String voice) {
|
||||
this.voice = voice;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
40
src/main/java/com/we3e/model/teacher/QueryBind.java
Normal file
40
src/main/java/com/we3e/model/teacher/QueryBind.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 账号绑定类
|
||||
*/
|
||||
public class QueryBind extends BaseEntity{
|
||||
private String openId;
|
||||
private int userType;
|
||||
private String queryType;
|
||||
|
||||
public QueryBind(){
|
||||
}
|
||||
public QueryBind(long uid,String openId, int userType, String queryType) {
|
||||
setUid(uid);
|
||||
this.openId = openId;
|
||||
this.userType = userType;
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
public int getUserType() {
|
||||
return userType;
|
||||
}
|
||||
public void setUserType(int userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
|
||||
}
|
||||
32
src/main/java/com/we3e/model/teacher/QueryCIncS.java
Normal file
32
src/main/java/com/we3e/model/teacher/QueryCIncS.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 列表辅助数据请求
|
||||
*/
|
||||
public class QueryCIncS extends BaseEntity{
|
||||
private long teacherId;
|
||||
private long classesId;
|
||||
private String listName;
|
||||
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
public void setTeacherId(long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
public String getListName() {
|
||||
return listName;
|
||||
}
|
||||
public void setListName(String listName) {
|
||||
this.listName = listName;
|
||||
}
|
||||
|
||||
}
|
||||
20
src/main/java/com/we3e/model/teacher/QueryDub.java
Normal file
20
src/main/java/com/we3e/model/teacher/QueryDub.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询考试信息
|
||||
*/
|
||||
public class QueryDub extends BaseEntity{
|
||||
private long voiceId;
|
||||
|
||||
public long getVoiceId() {
|
||||
return voiceId;
|
||||
}
|
||||
|
||||
public void setVoiceId(long voiceId) {
|
||||
this.voiceId = voiceId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
94
src/main/java/com/we3e/model/teacher/QueryEssay.java
Normal file
94
src/main/java/com/we3e/model/teacher/QueryEssay.java
Normal file
@ -0,0 +1,94 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询考试信息
|
||||
*/
|
||||
public class QueryEssay extends BaseEntity{
|
||||
private String queryType;
|
||||
private long classesId;
|
||||
private String assignmentId;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private int isMax = 1;
|
||||
private int isOral = 1;
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 10;
|
||||
private int areaId;
|
||||
// private int type = 2;
|
||||
private int type = 1; //新 老的默认了2 默认了2是南方日报用到了
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
public int getIsMax() {
|
||||
return isMax;
|
||||
}
|
||||
public void setIsMax(int isMax) {
|
||||
this.isMax = isMax;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getAreaId() {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(int areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
|
||||
public void setAssignmentId(String assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
}
|
||||
99
src/main/java/com/we3e/model/teacher/QueryExam.java
Normal file
99
src/main/java/com/we3e/model/teacher/QueryExam.java
Normal file
@ -0,0 +1,99 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询考试信息
|
||||
*/
|
||||
public class QueryExam extends BaseEntity{
|
||||
private String queryType;
|
||||
private long classesId;
|
||||
private String examType;
|
||||
private String examId;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private int isMax = 1;
|
||||
private int isOral = 1;
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 10;
|
||||
private int areaId;
|
||||
// private int type = 2;
|
||||
private int type = 1; //新 老的默认了2 默认了2是南方日报用到了
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
public int getIsMax() {
|
||||
return isMax;
|
||||
}
|
||||
public void setIsMax(int isMax) {
|
||||
this.isMax = isMax;
|
||||
}
|
||||
public String getExamId() {
|
||||
return examId;
|
||||
}
|
||||
public void setExamId(String examId) {
|
||||
this.examId = examId;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public String getExamType() {
|
||||
return examType;
|
||||
}
|
||||
public void setExamType(String examType) {
|
||||
this.examType = examType;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getAreaId() {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(int areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
44
src/main/java/com/we3e/model/teacher/QueryGoodSounds.java
Normal file
44
src/main/java/com/we3e/model/teacher/QueryGoodSounds.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: passionHan
|
||||
* @Date: 2020-12-16
|
||||
* @description
|
||||
*/
|
||||
public class QueryGoodSounds extends BaseEntity {
|
||||
|
||||
private int assignmentId;
|
||||
|
||||
private List<Long> uids;
|
||||
|
||||
private int isGoodVoice;
|
||||
|
||||
|
||||
public int getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
|
||||
public void setAssignmentId(int assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
|
||||
public int getIsGoodVoice() {
|
||||
return isGoodVoice;
|
||||
}
|
||||
|
||||
public void setIsGoodVoice(int isGoodVoice) {
|
||||
this.isGoodVoice = isGoodVoice;
|
||||
}
|
||||
|
||||
public List<Long> getUids() {
|
||||
return uids;
|
||||
}
|
||||
|
||||
public void setUids(List<Long> uids) {
|
||||
this.uids = uids;
|
||||
}
|
||||
}
|
||||
46
src/main/java/com/we3e/model/teacher/QueryNotice.java
Normal file
46
src/main/java/com/we3e/model/teacher/QueryNotice.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询公告类
|
||||
*/
|
||||
public class QueryNotice extends BaseEntity{
|
||||
private String queryType;
|
||||
private long classesId;
|
||||
private int classMessageId;
|
||||
private int pageNum =1;
|
||||
private int pageSize =5 ;
|
||||
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public int getClassMessageId() {
|
||||
return classMessageId;
|
||||
}
|
||||
public void setClassMessageId(int classMessageId) {
|
||||
this.classMessageId = classMessageId;
|
||||
}
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
}
|
||||
28
src/main/java/com/we3e/model/teacher/QuerySentenceVoice.java
Normal file
28
src/main/java/com/we3e/model/teacher/QuerySentenceVoice.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
/*
|
||||
* 请求下载地址类
|
||||
*/
|
||||
public class QuerySentenceVoice extends BaseEntity{
|
||||
private String queryType;
|
||||
private Integer achivementId;
|
||||
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
|
||||
public Integer getAchivementId() {
|
||||
return achivementId;
|
||||
}
|
||||
|
||||
public void setAchivementId(Integer achivementId) {
|
||||
this.achivementId = achivementId;
|
||||
}
|
||||
}
|
||||
22
src/main/java/com/we3e/model/teacher/QueryStudent.java
Normal file
22
src/main/java/com/we3e/model/teacher/QueryStudent.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
public class QueryStudent extends BaseEntity{
|
||||
private String queryType;
|
||||
private long studentId;
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
public void setStudentId(long studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
src/main/java/com/we3e/model/teacher/QueryUrl.java
Normal file
22
src/main/java/com/we3e/model/teacher/QueryUrl.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
import org.apache.struts2.interceptor.parameter.StrutsParameter;
|
||||
|
||||
/*
|
||||
* 请求下载地址类
|
||||
*/
|
||||
public class QueryUrl extends BaseEntity{
|
||||
@StrutsParameter
|
||||
private String key;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
158
src/main/java/com/we3e/model/teacher/QueryWork.java
Normal file
158
src/main/java/com/we3e/model/teacher/QueryWork.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询训练类
|
||||
*/
|
||||
public class QueryWork extends BaseEntity{
|
||||
private String listName="weixinAssigns";
|
||||
private long teacherId;
|
||||
private long classesId;
|
||||
private int status = 1;
|
||||
private int pageNum =1;
|
||||
private int pageSize =5 ;
|
||||
private int auth = 1;
|
||||
private String queryType;
|
||||
private String title;
|
||||
private int isOral = 1;
|
||||
private int actionType;
|
||||
private int defaultTag;
|
||||
private int cityAreaId;
|
||||
private int paraId;
|
||||
private int goodsId;
|
||||
private Long studentId;
|
||||
private int isoral = 1;
|
||||
private int type = 1;
|
||||
|
||||
public int getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
public void setActionType(int actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
public int getAuth() {
|
||||
return auth;
|
||||
}
|
||||
public void setAuth(int auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getTeacherId() {
|
||||
return teacherId;
|
||||
}
|
||||
public void setTeacherId(long teacherId) {
|
||||
this.teacherId = teacherId;
|
||||
}
|
||||
public String getListName() {
|
||||
return listName;
|
||||
}
|
||||
public void setListName(String listName) {
|
||||
this.listName = listName;
|
||||
}
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getDefaultTag() {
|
||||
return defaultTag;
|
||||
}
|
||||
|
||||
public void setDefaultTag(int defaultTag) {
|
||||
this.defaultTag = defaultTag;
|
||||
}
|
||||
|
||||
public int getCityAreaId() {
|
||||
return cityAreaId;
|
||||
}
|
||||
|
||||
public void setCityAreaId(int cityAreaId) {
|
||||
this.cityAreaId = cityAreaId;
|
||||
}
|
||||
|
||||
public int getParaId() {
|
||||
return paraId;
|
||||
}
|
||||
|
||||
public void setParaId(int paraId) {
|
||||
this.paraId = paraId;
|
||||
}
|
||||
|
||||
public int getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(int goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public Long getStudentId() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
public void setStudentId(Long studentId) {
|
||||
this.studentId = studentId;
|
||||
}
|
||||
|
||||
public int getIsoral() {
|
||||
return isoral;
|
||||
}
|
||||
|
||||
public void setIsoral(int isoral) {
|
||||
this.isoral = isoral;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryWork [listName=" + listName + ", teacherId=" + teacherId + ", classesId=" + classesId + ", status="
|
||||
+ status + ", pageNum=" + pageNum + ", pageSize=" + pageSize + ", queryType=" + queryType + ", title="
|
||||
+ title + "]";
|
||||
}
|
||||
|
||||
}
|
||||
94
src/main/java/com/we3e/model/teacher/QueryXKWPractice.java
Normal file
94
src/main/java/com/we3e/model/teacher/QueryXKWPractice.java
Normal file
@ -0,0 +1,94 @@
|
||||
package com.we3e.model.teacher;
|
||||
|
||||
import com.we3e.model.BaseEntity;
|
||||
|
||||
/*
|
||||
* 查询考试信息
|
||||
*/
|
||||
public class QueryXKWPractice extends BaseEntity{
|
||||
private String queryType;
|
||||
private long classesId;
|
||||
private String assignmentId;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private int isMax = 1;
|
||||
private int isOral = 1;
|
||||
private int pageNum = 1;
|
||||
private int pageSize = 10;
|
||||
private int areaId;
|
||||
// private int type = 2;
|
||||
private int type = 1; //新 老的默认了2 默认了2是南方日报用到了
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
public int getIsOral() {
|
||||
return isOral;
|
||||
}
|
||||
public void setIsOral(int isOral) {
|
||||
this.isOral = isOral;
|
||||
}
|
||||
public int getIsMax() {
|
||||
return isMax;
|
||||
}
|
||||
public void setIsMax(int isMax) {
|
||||
this.isMax = isMax;
|
||||
}
|
||||
public String getQueryType() {
|
||||
return queryType;
|
||||
}
|
||||
public void setQueryType(String queryType) {
|
||||
this.queryType = queryType;
|
||||
}
|
||||
public long getClassesId() {
|
||||
return classesId;
|
||||
}
|
||||
public void setClassesId(long classesId) {
|
||||
this.classesId = classesId;
|
||||
}
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public int getAreaId() {
|
||||
return areaId;
|
||||
}
|
||||
|
||||
public void setAreaId(int areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
|
||||
public void setAssignmentId(String assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user