上传文件至 ''

This commit is contained in:
liwa233 2023-02-07 04:17:56 +00:00
parent 9de14d8f1a
commit 42c05ca97d
162 changed files with 24004 additions and 3 deletions

View File

@ -0,0 +1,47 @@
<component name="ArtifactManager">
<artifact type="exploded-war" name="MyCourse:war exploded">
<output-path>$PROJECT_DIR$/out/artifacts/MyCourse_war_exploded</output-path>
<root id="root">
<element id="javaee-facet-resources" facet="MyCourse/web/Web" />
<element id="directory" name="WEB-INF">
<element id="directory" name="classes">
<element id="module-output" name="MyCourse" />
</element>
<element id="directory" name="lib">
<element id="library" level="project" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: junit:junit:4.12" />
<element id="library" level="project" name="Maven: org.hamcrest:hamcrest-core:1.3" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis:3.5.1" />
<element id="library" level="project" name="Maven: mysql:mysql-connector-java:8.0.13" />
<element id="library" level="project" name="Maven: com.google.protobuf:protobuf-java:3.6.1" />
<element id="library" level="project" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" />
<element id="library" level="project" name="Maven: org.apache.logging.log4j:log4j-core:2.11.2" />
<element id="library" level="project" name="Maven: org.springframework:spring-jdbc:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.springframework:spring-tx:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis-spring:2.0.1" />
<element id="library" level="project" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" />
<element id="library" level="project" name="Maven: javax.servlet:jstl:1.2" />
<element id="library" level="project" name="Maven: org.aspectj:aspectjweaver:1.9.4" />
<element id="library" level="project" name="Maven: cglib:cglib:3.2.12" />
<element id="library" level="project" name="Maven: org.ow2.asm:asm:7.1" />
<element id="library" level="project" name="Maven: org.apache.struts:struts2-core:2.5.20" />
<element id="library" level="project" name="Maven: org.freemarker:freemarker:2.3.28" />
<element id="library" level="project" name="Maven: ognl:ognl:3.1.21" />
<element id="library" level="project" name="Maven: org.javassist:javassist:3.20.0-GA" />
<element id="library" level="project" name="Maven: commons-fileupload:commons-fileupload:1.4" />
<element id="library" level="project" name="Maven: commons-io:commons-io:2.6" />
<element id="library" level="project" name="Maven: org.apache.commons:commons-lang3:3.8.1" />
<element id="library" level="project" name="Maven: org.apache.struts:struts2-spring-plugin:2.5.20" />
<element id="library" level="project" name="Maven: com.github.penggle:kaptcha:2.3.2" />
<element id="library" level="project" name="Maven: com.jhlabs:filters:2.0.235-1" />
<element id="library" level="project" name="Maven: com.alibaba:fastjson:1.2.58" />
</element>
</element>
</root>
</artifact>
</component>

View File

@ -0,0 +1,16 @@
<?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="MyCourse" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="9">
<module name="MyCourse" target="9" />
</bytecodeTargetLevel>
</component>
</project>

View File

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

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: cglib:cglib:3.2.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.2.12/cglib-3.2.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.2.12/cglib-3.2.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/cglib/cglib/3.2.12/cglib-3.2.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.alibaba:fastjson:1.2.58">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.58/fastjson-1.2.58-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.58/fastjson-1.2.58-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.github.penggle:kaptcha:2.3.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/penggle/kaptcha/2.3.2/kaptcha-2.3.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/penggle/kaptcha/2.3.2/kaptcha-2.3.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/penggle/kaptcha/2.3.2/kaptcha-2.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.protobuf:protobuf-java:3.6.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.6.1/protobuf-java-3.6.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.jhlabs:filters:2.0.235-1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/jhlabs/filters/2.0.235-1/filters-2.0.235-1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/jhlabs/filters/2.0.235-1/filters-2.0.235-1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/jhlabs/filters/2.0.235-1/filters-2.0.235-1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-fileupload:commons-fileupload:1.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-io:commons-io:2.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.6/commons-io-2.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.servlet:javax.servlet-api:4.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: javax.servlet:jstl:1.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/jstl/1.2/jstl-1.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/jstl/1.2/jstl-1.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/javax/servlet/jstl/1.2/jstl-1.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: mysql:mysql-connector-java:8.0.13">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/mysql/mysql-connector-java/8.0.13/mysql-connector-java-8.0.13-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: ognl:ognl:3.1.21">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/ognl/ognl/3.1.21/ognl-3.1.21.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/ognl/ognl/3.1.21/ognl-3.1.21-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/ognl/ognl/3.1.21/ognl-3.1.21-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.commons:commons-lang3:3.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.logging.log4j:log4j-api:2.11.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.logging.log4j:log4j-core:2.11.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.struts:struts2-core:2.5.20">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-core/2.5.20/struts2-core-2.5.20.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-core/2.5.20/struts2-core-2.5.20-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-core/2.5.20/struts2-core-2.5.20-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.struts:struts2-spring-plugin:2.5.20">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-spring-plugin/2.5.20/struts2-spring-plugin-2.5.20.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-spring-plugin/2.5.20/struts2-spring-plugin-2.5.20-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-spring-plugin/2.5.20/struts2-spring-plugin-2.5.20-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.aspectj:aspectjweaver:1.9.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjweaver/1.9.4/aspectjweaver-1.9.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjweaver/1.9.4/aspectjweaver-1.9.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjweaver/1.9.4/aspectjweaver-1.9.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.freemarker:freemarker:2.3.28">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/freemarker/freemarker/2.3.28/freemarker-2.3.28.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/freemarker/freemarker/2.3.28/freemarker-2.3.28-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/freemarker/freemarker/2.3.28/freemarker-2.3.28-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.javassist:javassist:3.20.0-GA">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.mybatis:mybatis:3.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.1/mybatis-3.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.1/mybatis-3.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.1/mybatis-3.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.mybatis:mybatis-spring:2.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.1/mybatis-spring-2.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.1/mybatis-spring-2.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.1/mybatis-spring-2.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.ow2.asm:asm:7.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/7.1/asm-7.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/7.1/asm-7.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm/7.1/asm-7.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-aop:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.1.8.RELEASE/spring-aop-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.1.8.RELEASE/spring-aop-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aop/5.1.8.RELEASE/spring-aop-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-beans:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.1.8.RELEASE/spring-beans-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.1.8.RELEASE/spring-beans-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-beans/5.1.8.RELEASE/spring-beans-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-context:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.1.8.RELEASE/spring-context-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.1.8.RELEASE/spring-context-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-context/5.1.8.RELEASE/spring-context-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-core:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.1.8.RELEASE/spring-core-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.1.8.RELEASE/spring-core-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-core/5.1.8.RELEASE/spring-core-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-expression:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.1.8.RELEASE/spring-expression-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.1.8.RELEASE/spring-expression-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-expression/5.1.8.RELEASE/spring-expression-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.1.8.RELEASE/spring-jcl-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.1.8.RELEASE/spring-jcl-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jcl/5.1.8.RELEASE/spring-jcl-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-jdbc:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jdbc/5.1.8.RELEASE/spring-jdbc-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jdbc/5.1.8.RELEASE/spring-jdbc-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-jdbc/5.1.8.RELEASE/spring-jdbc-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-test:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/5.1.8.RELEASE/spring-test-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/5.1.8.RELEASE/spring-test-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-test/5.1.8.RELEASE/spring-test-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-tx:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-tx/5.1.8.RELEASE/spring-tx-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-tx/5.1.8.RELEASE/spring-tx-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-tx/5.1.8.RELEASE/spring-tx-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework:spring-web:5.1.8.RELEASE">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-web/5.1.8.RELEASE/spring-web-5.1.8.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-web/5.1.8.RELEASE/spring-web-5.1.8.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-web/5.1.8.RELEASE/spring-web-5.1.8.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

13
MyCourse/.idea/misc.xml Normal file
View File

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

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/MyCourse.iml" filepath="$PROJECT_DIR$/MyCourse.iml" />
</modules>
</component>
</project>

6
MyCourse/.idea/vcs.xml Normal file
View 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>

79
MyCourse/MyCourse.iml Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="web" name="Web">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/web" relative="/" />
</webroots>
<sourceRoots />
</configuration>
<facet type="Struts2" name="Struts 2">
<configuration>
<fileset id="s2fileset" name="My Fileset " removed="false">
<file>file://$MODULE_DIR$/src/main/resources/struts.xml</file>
<file>jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-core/2.5.20/struts2-core-2.5.20.jar!/struts-default.xml</file>
<file>jar://$MAVEN_REPOSITORY$/org/apache/struts/struts2-spring-plugin/2.5.20/struts2-spring-plugin-2.5.20.jar!/struts-plugin.xml</file>
</fileset>
<propertiesKeys disabled="false" />
</configuration>
</facet>
</facet>
<facet type="Spring" name="Spring">
<configuration>
<fileset id="fileset" name="ApplicationContext" removed="false">
<file>file://$MODULE_DIR$/src/main/resources/applicationContext.xml</file>
</fileset>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_9">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.1" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.13" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:jstl:1.2" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.4" level="project" />
<orderEntry type="library" name="Maven: cglib:cglib:3.2.12" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.struts:struts2-core:2.5.20" level="project" />
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.28" level="project" />
<orderEntry type="library" name="Maven: ognl:ognl:3.1.21" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.4" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.struts:struts2-spring-plugin:2.5.20" level="project" />
<orderEntry type="library" name="Maven: com.github.penggle:kaptcha:2.3.2" level="project" />
<orderEntry type="library" name="Maven: com.jhlabs:filters:2.0.235-1" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.58" level="project" />
</component>
</module>

136
MyCourse/pom.xml Normal file
View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.whileskies</groupId>
<artifactId>MyCourse</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.1.8.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.8.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.8.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.12</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.20</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.5.20</version>
</dependency>
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>9</maven.compiler.source>
<maven.compiler.target>9</maven.compiler.target>
</properties>
</project>

View File

@ -0,0 +1,107 @@
package file.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.pojo.CourseResource;
import file.service.CourseResourceService;
import login.pojo.User;
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 util.DownloadFileNameOp;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class ResourceDownloadAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(ResourceDownloadAction.class);
private User user;
private Integer resourceId;
private CourseResource resource;
private File file;
private final CourseResourceService courseResourceService;
@Autowired
public ResourceDownloadAction(CourseResourceService courseResourceService) {
this.courseResourceService = courseResourceService;
}
public String download() {
user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (resourceId == null)
return ERROR;
resource = courseResourceService.findByResourceId(resourceId);
if (resource != null)
return SUCCESS;
else
return ERROR;
}
public InputStream getInputStream() throws FileNotFoundException {
file = new File(resource.getFilePath());
return new FileInputStream(file);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getFileName() throws Exception {
LOG.debug("fileName: " + resource.getFileName());
return DownloadFileNameOp.downToUtf8String(resource.getFileName(), ServletActionContext.getRequest());
}
public Long getContentLength() {
return file.length();
}
public Integer getResourceId() {
return resourceId;
}
public void setResourceId(Integer resourceId) {
this.resourceId = resourceId;
}
public CourseResource getResource() {
return resource;
}
public void setResource(CourseResource resource) {
this.resource = resource;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
}

View File

@ -0,0 +1,82 @@
package file.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.service.CourseResourceService;
import login.pojo.User;
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 java.io.File;
import java.io.IOException;
import java.util.List;
public class ResourceUploadAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(ResourceUploadAction.class);
private List<File> file;
private List<String> fileFileName;
private List<String> fileContentType;
private final CourseResourceService courseResourceService;
private Integer courseId;
@Autowired
public ResourceUploadAction(CourseResourceService courseResourceService) {
this.courseResourceService = courseResourceService;
}
public String uploadFiles() throws IOException {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
LOG.debug("fileName: " + fileFileName + " courseId: " + courseId);
String webInfPath = ServletActionContext.getRequest().getSession().getServletContext().getRealPath("/WEB-INF");
if (courseResourceService.uploadFiles(file, webInfPath, fileFileName, courseId))
return NONE;
else
return ERROR;
}
public List<File> getFile() {
return file;
}
public void setFile(List<File> file) {
this.file = file;
}
public List<String> getFileFileName() {
return fileFileName;
}
public void setFileFileName(List<String> fileFileName) {
this.fileFileName = fileFileName;
}
public List<String> getFileContentType() {
return fileContentType;
}
public void setFileContentType(List<String> fileContentType) {
this.fileContentType = fileContentType;
}
public int getCourseId() {
return courseId;
}
public void setCourseId(int courseId) {
this.courseId = courseId;
}
}

View File

@ -0,0 +1,120 @@
package file.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.pojo.TaskFile;
import file.service.TaskFileService;
import login.pojo.User;
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 util.DownloadFileNameOp;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class TaskFileDownloadAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(TaskFileDownloadAction.class);
private Integer taskId;
private User user;
private TaskFile taskFile;
private File file;
private final TaskFileService taskFileService;
@Autowired
public TaskFileDownloadAction(TaskFileService taskFileService) {
this.taskFileService = taskFileService;
}
public String download() {
user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null)
return ERROR;
taskFile = taskFileService.findByTaskIdStudentId(taskId, user.getId());
if (taskFile != null)
return SUCCESS;
else
return ERROR;
}
private Integer studentId;
public String teacherDownload() {
user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null || studentId == null)
return ERROR;
taskFile = taskFileService.findByTaskIdStudentId(taskId, studentId);
if (taskFile != null)
return SUCCESS;
else
return ERROR;
}
public InputStream getInputStream() throws FileNotFoundException {
file = new File(taskFile.getFilePath());
return new FileInputStream(file);
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Integer getStudentId() {
return studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getFileName() throws Exception {
LOG.debug("fileName: " + taskFile.getFileName());
//return new String(taskFile.getFileName().getBytes(), "ISO-8859-1");
// return new String(taskFile.getFileName().getBytes(), "UTF-8");
return DownloadFileNameOp.downToUtf8String(taskFile.getFileName(), ServletActionContext.getRequest());
}
public Long getContentLength() {
return file.length();
}
}

View File

@ -0,0 +1,97 @@
package file.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.service.TaskFileService;
import login.pojo.User;
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 java.io.File;
import java.io.IOException;
public class TaskFileUploadAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(TaskFileUploadAction.class);
private File file;
private String fileFileName;
private String fileContentType;
private Integer taskId;
private Integer courseId;
private final TaskFileService taskFileService;
@Autowired
public TaskFileUploadAction(TaskFileService taskFileService) {
this.taskFileService = taskFileService;
}
public String upload() throws IOException {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (fileFileName == null || fileFileName.trim().equals("") ||
taskId == null || courseId == null)
return ERROR;
LOG.debug("fileName: " + fileFileName + " taskId: " + taskId + " courseId: " + courseId);
String webInfPath = ServletActionContext.getRequest().getSession().getServletContext().getRealPath("/WEB-INF");
if (taskFileService.upload(file, webInfPath, fileFileName, taskId, courseId, user.getId())) {
return NONE;
} else
return ERROR;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
}

View File

@ -0,0 +1,69 @@
package file.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.service.TaskFileService;
import login.pojo.User;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.springframework.beans.factory.annotation.Autowired;
import util.DownloadFileNameOp;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
public class ZipTaskFileDownloadAction extends ActionSupport implements ServletRequestAware {
private Integer taskId;
private File file;
private final TaskFileService taskFileService;
@Autowired
public ZipTaskFileDownloadAction(TaskFileService taskFileService) {
this.taskFileService = taskFileService;
}
public String downloadZip() throws IOException {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null)
return ERROR;
String webInf = ServletActionContext.getRequest().getSession().getServletContext().getRealPath("/WEB-INF");
file = taskFileService.downloadAsZip(webInf, taskId);
return SUCCESS;
}
public InputStream getInputStream() throws FileNotFoundException {
return new FileInputStream(file);
}
public String getFileName() throws Exception {
//return new String(file.getName().getBytes("UTF-8"), "ISO-8859-1");
return DownloadFileNameOp.downToUtf8String(file.getName(), ServletActionContext.getRequest());
}
public Long getContentLength() {
return file.length();
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
private HttpServletRequest request;
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
}

View File

@ -0,0 +1,15 @@
package file.mapper;
import file.pojo.CourseResource;
import java.util.List;
public interface CourseResourceMapper {
CourseResource selectById(Integer id);
List<CourseResource> selectAllByCourseId(Integer courseId);
int insert(CourseResource courseResource);
int delete(Integer resourceId);
}

View File

@ -0,0 +1,17 @@
package file.mapper;
import file.pojo.TaskFile;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TaskFileMapper {
TaskFile selectByTaskIdStudentId(@Param("taskId") Integer taskId, @Param("studentId") Integer StudentId);
List<TaskFile> selectAllByTaskId(Integer taskId);
int insert(TaskFile taskFile);
int update(TaskFile taskFile);
}

View File

@ -0,0 +1,83 @@
package file.pojo;
import java.util.Date;
public class CourseResource {
private Integer id;
private Integer courseId;
private String fileName;
private String filePath;
private Date uploadTime;
private String hUploadTime;
private String hFileSize;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
public String gethUploadTime() {
return hUploadTime;
}
public void sethUploadTime(String hUploadTime) {
this.hUploadTime = hUploadTime;
}
public String gethFileSize() {
return hFileSize;
}
public void sethFileSize(String hFileSize) {
this.hFileSize = hFileSize;
}
@Override
public String toString() {
return "CourseResource{" +
"id=" + id +
", courseId=" + courseId +
", fileName='" + fileName + '\'' +
", filePath='" + filePath + '\'' +
", uploadTime=" + uploadTime +
", hUploadTime='" + hUploadTime + '\'' +
", hFileSize='" + hFileSize + '\'' +
'}';
}
}

View File

@ -0,0 +1,83 @@
package file.pojo;
import java.util.Date;
public class TaskFile {
private Integer id;
private Integer taskId;
private Integer userId;
private Date uploadTime;
private String fileName;
private String filePath;
private String hUploadTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String gethUploadTime() {
return hUploadTime;
}
public void sethUploadTime(String hUploadTime) {
this.hUploadTime = hUploadTime;
}
@Override
public String toString() {
return "TaskFile{" +
"id=" + id +
", taskId=" + taskId +
", userId=" + userId +
", uploadTime=" + uploadTime +
", fileName='" + fileName + '\'' +
", filePath='" + filePath + '\'' +
", hUploadTime='" + hUploadTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,19 @@
package file.service;
import file.pojo.CourseResource;
import java.io.File;
import java.io.IOException;
import java.util.List;
public interface CourseResourceService {
boolean uploadFiles(List<File> files, String webInfPath, List<String> fileNames, Integer courseId) throws IOException;
List<CourseResource> findByCourseId(Integer courseId);
CourseResource findByResourceId(Integer resourceId);
boolean deleteResource(Integer resourceId);
}

View File

@ -0,0 +1,17 @@
package file.service;
import file.pojo.TaskFile;
import java.io.File;
import java.io.IOException;
public interface TaskFileService {
boolean upload(File file, String webInfPath, String fileName, Integer taskId, Integer courseId, Integer userId) throws IOException;
TaskFile findByTaskIdStudentId(Integer taskId, Integer studentId);
TaskFile findTaskFile(Integer taskId, Integer userId);
File downloadAsZip(String webInfPath, Integer taskId) throws IOException;
}

View File

@ -0,0 +1,105 @@
package file.service.impl;
import file.mapper.CourseResourceMapper;
import file.pojo.CourseResource;
import file.service.CourseResourceService;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service
public class CourseResourceServiceImpl implements CourseResourceService {
private static final String BASE_DIR = "/upload/";
private final CourseResourceMapper courseResourceMapper;
@Autowired
public CourseResourceServiceImpl(CourseResourceMapper courseResourceMapper) {
this.courseResourceMapper = courseResourceMapper;
}
public boolean uploadFiles(List<File> files, String webInfPath, List<String> fileNames, Integer courseId) throws IOException {
String courseDirStr = webInfPath + BASE_DIR + "course-" + courseId;
File courseDir = new File(courseDirStr);
if (!courseDir.exists()) {
if (!courseDir.mkdirs())
return false;
}
String resourceDirStr = courseDirStr + "/resource";
File resourceDirFile = new File(resourceDirStr);
if (!resourceDirFile.exists()) {
if (!resourceDirFile.mkdirs())
return false;
}
for (int i = 0; i < files.size(); i++) {
CourseResource resource = new CourseResource();
String uuid = UUID.randomUUID().toString();
String uuidFileName = resourceDirStr + "/" + uuid;
File uuidFile = new File(uuidFileName);
resource.setCourseId(courseId);
resource.setFileName(fileNames.get(i));
resource.setUploadTime(new Date());
resource.setFilePath(uuidFile.getAbsolutePath());
FileUtils.copyFile(files.get(i), uuidFile);
if (courseResourceMapper.insert(resource) < 1) {
uuidFile.deleteOnExit();
return false;
}
}
return true;
}
public List<CourseResource> findByCourseId(Integer courseId) {
List<CourseResource> courseResources = courseResourceMapper.selectAllByCourseId(courseId);
for (CourseResource resource : courseResources) {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
resource.sethUploadTime(f.format(resource.getUploadTime()));
File file = new File(resource.getFilePath());
String fileSizeStr;
long fileSize = file.length();
if (fileSize < 1024)
fileSizeStr = Long.toString(fileSize) + "B";
else if (fileSize < 1024 * 1024)
fileSizeStr = String.format("%.2f", fileSize / 1024.0) + "KB";
else if (fileSize < 1024 * 1024 * 1024)
fileSizeStr = String.format("%.2f", fileSize / 1024.0 / 1024.0) + "MB";
else
fileSizeStr = String.format("%.2f", fileSize / 1024.0 / 1024.0 / 1024.0) + "GB";
resource.sethFileSize(fileSizeStr);
}
return courseResources;
}
public CourseResource findByResourceId(Integer resourceId) {
return courseResourceMapper.selectById(resourceId);
}
public boolean deleteResource(Integer resourceId) {
CourseResource resource = courseResourceMapper.selectById(resourceId);
if (resource == null)
return false;
File file = new File(resource.getFilePath());
if (!file.delete())
return false;
courseResourceMapper.delete(resourceId);
return true;
}
}

View File

@ -0,0 +1,156 @@
package file.service.impl;
import file.mapper.TaskFileMapper;
import file.pojo.TaskFile;
import file.service.TaskFileService;
import login.mapper.UserMapper;
import login.pojo.User;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import teacher.mapper.TeaCourseMapper;
import teacher.mapper.TeaCourseTaskMapper;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaTask;
import java.io.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@Service
public class TaskFileServiceImpl implements TaskFileService {
private static final Logger LOG = LogManager.getLogger(TaskFileServiceImpl.class);
private static final String BASE_DIR = "/upload/";
private final TaskFileMapper taskFileMapper;
private final TeaCourseTaskMapper teaCourseTaskMapper;
private final TeaCourseMapper teaCourseMapper;
private final UserMapper userMapper;
@Autowired
public TaskFileServiceImpl(TaskFileMapper taskFileMapper, TeaCourseTaskMapper teaCourseTaskMapper, TeaCourseMapper teaCourseMapper, UserMapper userMapper) {
this.taskFileMapper = taskFileMapper;
this.teaCourseTaskMapper = teaCourseTaskMapper;
this.teaCourseMapper = teaCourseMapper;
this.userMapper = userMapper;
}
public boolean upload(File file, String webInfPath, String fileName, Integer taskId, Integer courseId, Integer userId) throws IOException {
String courseDirStr = webInfPath + BASE_DIR + "course-" + courseId;
File courseDir = new File(courseDirStr);
if (!courseDir.exists()) {
if (!courseDir.mkdirs())
return false;
}
String taskDirStr = courseDirStr + "/task-" + taskId;
File taskDir = new File(taskDirStr);
if (!taskDir.exists()) {
if (!taskDir.mkdirs())
return false;
}
File taskFile = null;
TaskFile old = taskFileMapper.selectByTaskIdStudentId(taskId, userId);
if (old != null) {
//原文件存在替换
taskFile = new File(old.getFilePath());
FileUtils.copyFile(file, taskFile);
old.setFileName(fileName);
old.setUploadTime(new Date());
if (taskFileMapper.update(old) > 0) {
return true;
} else {
taskFile.deleteOnExit();
return false;
}
} else {
String uuidName = UUID.randomUUID().toString();
String taskFileName = taskDirStr + "/" + uuidName;
taskFile = new File(taskFileName);
//原文件不存在
TaskFile tf = new TaskFile();
tf.setFileName(fileName);
tf.setTaskId(taskId);
tf.setUserId(userId);
tf.setUploadTime(new Date());
tf.setFilePath(taskFile.getAbsolutePath());
FileUtils.copyFile(file, taskFile);
if(taskFileMapper.insert(tf) > 0) {
return true;
} else {
taskFile.deleteOnExit();
return false;
}
}
}
public TaskFile findByTaskIdStudentId(Integer taskId, Integer studentId) {
return taskFileMapper.selectByTaskIdStudentId(taskId, studentId);
}
public TaskFile findTaskFile(Integer taskId, Integer userId) {
return taskFileMapper.selectByTaskIdStudentId(taskId, userId);
}
public File downloadAsZip(String webInfPath, Integer taskId) throws IOException {
String tmpDir = webInfPath + BASE_DIR + "tmp/";
TeaTask task = teaCourseTaskMapper.selectByTaskId(taskId);
TeaCourse teaCourse = teaCourseMapper.selectByCourseId(task.getCourseId());
String zipName = tmpDir + teaCourse.getName() + "-" + task.getTitle() + ".zip";
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipName));
List<TaskFile> taskFiles = taskFileMapper.selectAllByTaskId(taskId);
for (TaskFile t : taskFiles) {
BufferedInputStream bis = new BufferedInputStream(
new FileInputStream(t.getFilePath())
);
User stu = userMapper.selectById(t.getUserId());
String entryName = "";
if (!stu.getSchoolId().equals(""))
entryName += stu.getSchoolId() + "-";
entryName += stu.getName() + "-" + t.getFileName();
zos.putNextEntry(new ZipEntry(entryName));
while (true) {
byte[] b = new byte[100];
int len = bis.read(b);
if (len == -1)
break;
zos.write(b, 0, len);
}
bis.close();
}
zos.close();
return new File(zipName);
}
}

View File

@ -0,0 +1,177 @@
package login.action;
import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import login.service.LoginService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
public class LoginAction extends ActionSupport implements ServletResponseAware {
private String email;
private String password;
private String verificationCode;
private final LoginService loginService;
private ServletResponse response;
private static final Logger LOG = LogManager.getLogger(LoginAction.class);
@Autowired
public LoginAction(LoginService loginService) {
this.loginService = loginService;
}
public String toLogin() {
return SUCCESS;
}
public String login() throws IOException {
LoginJson loginJson = new LoginJson();
loginJson.code = LOGIN_CODE;
if (email == null || email.trim().length() == 0 || password == null || password.trim().length() == 0
|| verificationCode == null || verificationCode.trim().length() == 0) {
loginJson.msg = "存在空字段";
loginJson.status = FAIL_EMPYT_PARAM;
} else {
Map<String, Object> session = ActionContext.getContext().getSession();
String realVerificationCode = (String) session.get("verificationCode");
if (verificationCode.equals(realVerificationCode)) {
User user = new User();
user.setEmail(email);
user.setPassword(password);
user = loginService.loginByEmailPassword(user);
if (user == null) {
loginJson.msg = "账号或密码错误";
loginJson.status = FAIL_EMAIL_PASS;
} else {
LOG.debug("user: " + user);
loginJson.msg = "登录成功";
loginJson.status = SUCC_STATUS;
loginJson.data.put("user_id", user.getId().toString());
loginJson.data.put("user_role", user.getRole());
ActionContext.getContext().getSession().put("user", user);
}
} else {
loginJson.msg = "验证码错误";
loginJson.status = FAIL_VERIFICATION;
}
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
String ret = JSON.toJSONString(loginJson);
LOG.debug("ret: " + loginJson);
LOG.debug("json: " + ret);
PrintWriter writer = response.getWriter();
writer.print(ret);
writer.flush();
writer.close();
return NONE;
}
public String logout() {
ActionContext.getContext().getSession().remove("user");
return SUCCESS;
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
public void setEmail(String email) {
this.email = email;
}
public void setPassword(String password) {
this.password = password;
}
public void setVerificationCode(String verificationCode) {
this.verificationCode = verificationCode;
}
/**
* code:登录业务代码
* msg:消息
* status:0-成功 1-验证码错误 2-邮箱或密码错误 3-存在空字段
* data:{'user_id' : '1', 'user_role' : 's'}
*/
private static final int LOGIN_CODE = 1;
private static final int SUCC_STATUS = 0;
private static final int FAIL_VERIFICATION = 1;
private static final int FAIL_EMAIL_PASS = 2;
private static final int FAIL_EMPYT_PARAM = 3;
class LoginJson {
int code;
String msg;
int status;
Map<String, String> data = new HashMap<String, String>();
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Map<String, String> getData() {
return data;
}
public void setData(Map<String, String> data) {
this.data = data;
}
@Override
public String toString() {
return "LoginJson{" +
"code=" + code +
", msg='" + msg + '\'' +
", status=" + status +
", data=" + data +
'}';
}
}
}

View File

@ -0,0 +1,245 @@
package login.action;
import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import login.service.LoginService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class RegisterAction extends ActionSupport implements ServletResponseAware {
private static final Logger LOG = LogManager.getLogger(RegisterJson.class);
private String email;
private String password;
private String role;
private String name;
private String schoolId;
private String school;
private String dept;
private String major;
private String schoolClass;
private final LoginService loginService;
private HttpServletResponse response;
@Autowired
public RegisterAction(LoginService loginService) {
this.loginService = loginService;
}
public String toRegister() {
return SUCCESS;
}
public String register() throws IOException {
RegisterJson registerJson = new RegisterJson();
registerJson.code = REGISTER_CODE;
if (email == null || email.trim().length() == 0 || password == null || password.trim().length() == 0 ||
(!role.equals("s") && !role.equals("t")) || name == null || name.trim().length() == 0 ||
!testEmail(email) || !testPassword(password)) {
registerJson.msg = "存在非法字段";
registerJson.status = INVALID_FILD_STATUS;
} else {
User user = new User();
user.setEmail(email.trim());
user.setPassword(password.trim());
user.setRole(role);
user.setName(name.trim());
if (schoolId == null)
user.setSchoolId("");
else
user.setSchoolId(schoolId.trim());
if (school == null)
user.setSchool("");
else
user.setSchool(school.trim());
if (dept == null)
user.setDept("");
else
user.setDept(dept.trim());
if (major == null)
user.setMajor("");
else
user.setMajor(major.trim());
if (schoolClass == null)
user.setSchoolClass("");
else
user.setSchoolClass(schoolClass);
int ret = loginService.registerUser(user);
if (ret == LoginService.REGISTER_SUCC) {
registerJson.msg = "注册成功";
registerJson.status = SUCC_STATUS;
registerJson.data.put("user_id", user.getId().toString());
registerJson.data.put("user_role", user.getRole());
ActionContext.getContext().getSession().put("user", user);
} else if (ret == LoginService.REGISTER_EMAIL_EXISTS) {
registerJson.msg = "邮箱已存在";
registerJson.status = EMAIL_EXITS_STATUS;
} else if (ret == LoginService.REGISTER_ERROR) {
registerJson.msg = "注册失败";
registerJson.status = ERROR_STATUS;
}
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
String ret = JSON.toJSONString(registerJson);
LOG.debug("json: " + ret);
PrintWriter writer = response.getWriter();
writer.print(ret);
writer.flush();
writer.close();
return NONE;
}
private boolean testEmail(String email) {
String re = "^[A-Za-z\\d]+([-_.][A-Za-z\\d]+)*@([A-Za-z\\d]+[-.])+[A-Za-z\\d]{2,4}$";
return Pattern.matches(re, email);
}
private boolean testPassword(String password) {
String re = "^[0-9a-zA-Z_]{6,18}$";
return Pattern.matches(re, password);
}
private static final int REGISTER_CODE = 2;
private static final int SUCC_STATUS = 0;
private static final int INVALID_FILD_STATUS = 1;
private static final int EMAIL_EXITS_STATUS = 2;
private static final int ERROR_STATUS = 3;
class RegisterJson {
int code;
String msg;
int status;
Map<String, String> data = new HashMap<String, String>();
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Map<String, String> getData() {
return data;
}
public void setData(Map<String, String> data) {
this.data = data;
}
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getSchoolClass() {
return schoolClass;
}
public void setSchoolClass(String schoolClass) {
this.schoolClass = schoolClass;
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
}

View File

@ -0,0 +1,67 @@
package login.action;
import com.google.code.kaptcha.Producer;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.beans.factory.annotation.Autowired;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.awt.image.BufferedImage;
import java.io.IOException;
public class VerificationCodeAction extends ActionSupport implements ServletRequestAware, ServletResponseAware {
private final static Logger LOG = LogManager.getLogger(VerificationCodeAction.class);
private HttpServletRequest request;
private HttpServletResponse response;
private final Producer captchaProducer;
@Autowired
public VerificationCodeAction(Producer captchaProducer) {
this.captchaProducer = captchaProducer;
}
public String execute() throws IOException {
HttpSession session = request.getSession();
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");
//生成验证码
String capText = captchaProducer.createText();
session.setAttribute("verificationCode", capText);
LOG.debug("verificationCode: " + capText);
//向客户端写出
BufferedImage bi = captchaProducer.createImage(capText);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(bi, "jpg", out);
try {
out.flush();
} finally {
out.close();
}
return NONE;
}
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
}

View File

@ -0,0 +1,13 @@
package login.mapper;
import login.pojo.User;
public interface UserMapper {
User selectByEmailPassword(User user);
User selectById(Integer id);
User selectByEmail(String email);
int insertUser(User user);
}

View File

@ -0,0 +1,110 @@
package login.pojo;
public class User {
private Integer id;
private String email = "";
private String password = "";
private String role = "";
private String name = "";
private String schoolId = "";
private String school = "";
private String dept = "";
private String major = "";
private String schoolClass = "";
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getSchoolClass() {
return schoolClass;
}
public void setSchoolClass(String schoolClass) {
this.schoolClass = schoolClass;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", email='" + email + '\'' +
", password='" + password + '\'' +
", role='" + role + '\'' +
", name='" + name + '\'' +
", schoolId='" + schoolId + '\'' +
", school='" + school + '\'' +
", dept='" + dept + '\'' +
", major='" + major + '\'' +
", schoolClass='" + schoolClass + '\'' +
'}';
}
}

View File

@ -0,0 +1,23 @@
package login.service;
import login.pojo.User;
public interface LoginService {
/**
* 根据账号和密码进行登录
* @param user 用户对象
* @return user详细信息null表示邮箱或密码错误
*/
User loginByEmailPassword(User user);
/**
* 注册用户
* @param user 用户对象
* @return 注册结果状态
*/
int REGISTER_EMAIL_EXISTS = 1;
int REGISTER_ERROR = 2;
int REGISTER_SUCC = 3;
int registerUser(User user);
}

View File

@ -0,0 +1,35 @@
package login.service.impl;
import login.mapper.UserMapper;
import login.pojo.User;
import login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class LoginServiceImpl implements LoginService {
private final UserMapper userMapper;
@Autowired
public LoginServiceImpl(UserMapper userMapper) {
this.userMapper = userMapper;
}
public User loginByEmailPassword(User user) {
return userMapper.selectByEmailPassword(user);
}
public int registerUser(User user) {
User u = userMapper.selectByEmail(user.getEmail());
if (u == null) {
int ret = userMapper.insertUser(user);
if (ret > 0) {
return REGISTER_SUCC;
} else {
return REGISTER_ERROR;
}
} else {
return REGISTER_EMAIL_EXISTS;
}
}
}

View File

@ -0,0 +1,194 @@
package student.action;
import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.mapper.UserMapper;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.beans.factory.annotation.Autowired;
import student.pojo.StuCourse;
import student.pojo.StuTask;
import student.service.StuCourseListService;
import student.service.StuCourseService;
import student.service.StuCourseTaskService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
public class StuCourseListAction extends ActionSupport implements ServletResponseAware {
private static final Logger LOG = LogManager.getLogger(StuCourseListAction.class);
@Autowired
private UserMapper userMapper;
private final StuCourseListService stuCourseListService;
private final StuCourseService stuCourseService;
@Autowired
private StuCourseTaskService stuCourseTaskService;
@Autowired
public StuCourseListAction(StuCourseListService stuCourseListService, StuCourseService stuCourseService) {
this.stuCourseListService = stuCourseListService;
this.stuCourseService = stuCourseService;
}
private List<StuCourse> stuCourses;
public String showCourseList() {
User user = (User) ActionContext.getContext().getSession().get("user");
LOG.debug(user);
if (user == null)
return LOGIN;
stuCourses = stuCourseListService.findSCourses(user);
LOG.debug("stuCourses: " + stuCourses);
for (StuCourse s : stuCourses) {
List<StuTask> stuTasks = stuCourseTaskService.findTasks(s);
for (StuTask task : stuTasks) {
if (task.getTitle().length() > 12)
task.setTitle(task.getTitle().substring(0, 12) + "...");
}
if (stuTasks.size() > 3)
s.setStuTasks(stuTasks.subList(0, 3));
else
s.setStuTasks(stuTasks);
}
return SUCCESS;
}
public List<StuCourse> getStuCourses() {
return stuCourses;
}
public void setStuCourses(List<StuCourse> stuCourses) {
this.stuCourses = stuCourses;
}
private HttpServletResponse response;
private String courseCode;
private static final int ENTER_COURSE_CODE = 4;
private static final int SUCC_STATUS = 0;
private static final int INVAID_FILED_STATUS = 1;
private static final int NO_COURSE_STATUS = 2;
private static final int HAS_ENTERED_STATUS = 3;
private static final int ERROR_STATUS = 4;
public String enterCourse() throws IOException {
User user = (User) ActionContext.getContext().getSession().get("user");
LOG.debug(user);
if (user == null)
return LOGIN;
EnterCourseJson enterCourseJson = new EnterCourseJson();
enterCourseJson.code = ENTER_COURSE_CODE;
if (courseCode == null || courseCode.trim().equals("")) {
enterCourseJson.msg = "存在空字段";
enterCourseJson.status = INVAID_FILED_STATUS;
} else {
StuCourse stuCourse = new StuCourse();
stuCourse.setCode(courseCode.trim().toUpperCase());
stuCourse.setEnterTime(new Date());
int ret = stuCourseListService.enterCourse(stuCourse, user);
if (ret == StuCourseListService.ENTER_COURSE_NOT_EXISTS) {
enterCourseJson.msg = "该课程不存在";
enterCourseJson.status = NO_COURSE_STATUS;
} else if (ret == StuCourseListService.ENTER_HAS_ENTERED) {
enterCourseJson.msg = "已加入该课程";
enterCourseJson.status = HAS_ENTERED_STATUS;
} else if (ret == StuCourseListService.ENTER_FAIL) {
enterCourseJson.msg = "加入失败";
enterCourseJson.status = ERROR_STATUS;
} else if (ret == StuCourseListService.ENTER_SUCC) {
enterCourseJson.msg = "加入成功";
enterCourseJson.status = SUCC_STATUS;
enterCourseJson.name = stuCourse.getName();
}
LOG.debug("stuCourse: " + stuCourse);
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
String ret = JSON.toJSONString(enterCourseJson);
LOG.debug("json: " + ret);
PrintWriter writer = response.getWriter();
writer.print(ret);
writer.flush();
writer.close();
return NONE;
}
class EnterCourseJson {
int code;
String msg;
int status;
String name;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
public String getCourseCode() {
return courseCode;
}
public void setCourseCode(String courseCode) {
this.courseCode = courseCode;
}
}

View File

@ -0,0 +1,98 @@
package student.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.mapper.UserMapper;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import student.pojo.StuCourse;
import student.pojo.StuNotice;
import student.service.StuCourseNoticeService;
import student.service.StuCourseService;
import java.util.List;
public class StuCourseNoticeAction extends ActionSupport{
private static final Logger LOG = LogManager.getLogger(StuCourseNoticeAction.class);
private Integer courseId;
private final StuCourseNoticeService stuCourseNoticeService;
private final StuCourseService stuCourseService;
private final UserMapper userMapper;
@Autowired
public StuCourseNoticeAction(StuCourseNoticeService stuCourseNoticeService, StuCourseService stuCourseService, UserMapper userMapper) {
this.stuCourseNoticeService = stuCourseNoticeService;
this.stuCourseService = stuCourseService;
this.userMapper = userMapper;
}
/* private void autoLogin() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user != null)
return;
user = new User();
user.setEmail("gt110@qq.com");
user.setPassword("gt1997531");
user = userMapper.selectByEmailPassword(user);
ActionContext.getContext().getSession().put("user", user);
}*/
private List<StuNotice> stuNotices;
private StuCourse stuCourse;
public String getNotice() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
StuCourse s = new StuCourse();
s.setId(courseId);
stuNotices = stuCourseNoticeService.findNotices(s);
stuCourse = stuCourseService.findStuCourse(s);
LOG.debug("stuNotices: " + stuNotices);
LOG.debug("stuCourse: " + stuCourse);
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public List<StuNotice> getStuNotices() {
return stuNotices;
}
public void setStuNotices(List<StuNotice> stuNotices) {
this.stuNotices = stuNotices;
}
public StuCourse getStuCourse() {
return stuCourse;
}
public void setStuCourse(StuCourse stuCourse) {
this.stuCourse = stuCourse;
}
}

View File

@ -0,0 +1,76 @@
package student.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.pojo.CourseResource;
import file.service.CourseResourceService;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import student.pojo.StuCourse;
import student.service.StuCourseService;
import java.util.List;
public class StuCourseResourceAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(StuCourseResourceAction.class);
private Integer courseId;
private StuCourse stuCourse;
@Autowired
private StuCourseService stuCourseService;
@Autowired
private CourseResourceService courseResourceService;
private List<CourseResource> resources;
public String getResource() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
StuCourse s = new StuCourse();
s.setId(courseId);
stuCourse = stuCourseService.findStuCourse(s);
resources = courseResourceService.findByCourseId(courseId);
LOG.debug("resources " + resources);
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public StuCourse getStuCourse() {
return stuCourse;
}
public void setStuCourse(StuCourse stuCourse) {
this.stuCourse = stuCourse;
}
public List<CourseResource> getResources() {
return resources;
}
public void setResources(List<CourseResource> resources) {
this.resources = resources;
}
}

View File

@ -0,0 +1,143 @@
package student.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.pojo.TaskFile;
import file.service.TaskFileService;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import student.pojo.StuCourse;
import student.pojo.StuTask;
import student.service.StuCourseService;
import student.service.StuCourseTaskService;
import java.text.SimpleDateFormat;
import java.util.List;
public class StuCourseTaskAction extends ActionSupport{
private static final Logger LOG = LogManager.getLogger(StuCourseTaskAction.class);
private final StuCourseTaskService stuCourseTaskService;
private final StuCourseService stuCourseService;
private final TaskFileService taskFileService;
@Autowired
public StuCourseTaskAction(StuCourseTaskService stuCourseTaskService, StuCourseService stuCourseService, TaskFileService taskFileService) {
this.stuCourseTaskService = stuCourseTaskService;
this.stuCourseService = stuCourseService;
this.taskFileService = taskFileService;
}
private List<StuTask> stuTasks;
private StuCourse stuCourse;
private Integer courseId;
public String getTasks() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
StuCourse s = new StuCourse();
s.setId(courseId);
stuTasks = stuCourseTaskService.findTasks(s);
stuCourse = stuCourseService.findStuCourse(s);
LOG.debug("stuTasks: " + stuTasks);
LOG.debug("stuCourse: " + stuCourse);
return SUCCESS;
}
private Integer taskId;
private StuTask stuTask;
private TaskFile taskFile;
public String taskDetail() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null || courseId == null)
return ERROR;
stuTask = stuCourseTaskService.findTaskById(taskId);
StuCourse s = new StuCourse();
s.setId(courseId);
stuCourse = stuCourseService.findStuCourse(s);
taskFile = taskFileService.findByTaskIdStudentId(taskId, user.getId());
if (taskFile != null) {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm");
taskFile.sethUploadTime(f.format(taskFile.getUploadTime()));
}
if (stuTask == null || stuCourse == null)
return ERROR;
else
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public List<StuTask> getStuTasks() {
return stuTasks;
}
public void setStuTasks(List<StuTask> stuTasks) {
this.stuTasks = stuTasks;
}
public StuCourse getStuCourse() {
return stuCourse;
}
public void setStuCourse(StuCourse stuCourse) {
this.stuCourse = stuCourse;
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public StuTask getStuTask() {
return stuTask;
}
public void setStuTask(StuTask stuTask) {
this.stuTask = stuTask;
}
public TaskFile getTaskFile() {
return taskFile;
}
public void setTaskFile(TaskFile taskFile) {
this.taskFile = taskFile;
}
}

View File

@ -0,0 +1,26 @@
package student.mapper;
import login.pojo.User;
import org.apache.ibatis.annotations.Param;
import student.pojo.StuCourse;
import java.util.Date;
import java.util.List;
public interface StuCourseMapper {
List<StuCourse> selectByStudentId(Integer studentId);
StuCourse selectByCourseId(Integer courseId);
StuCourse selectByCode(String code);
int selectStudentCount(Integer courseId);
User selectTeacherByCourseId(Integer courseId);
Date selectEnterTimeByStudentId(@Param("courseId") Integer courseId, @Param("studentId") Integer studentId);
int insertCourseStudent(@Param("courseId") Integer courseId, @Param("studentId") Integer studentId, @Param("enterTime") Date enterTime);
}

View File

@ -0,0 +1,12 @@
package student.mapper;
import student.pojo.StuNotice;
import java.util.List;
public interface StuCourseNoticeMapper {
List<StuNotice> selectAllByCourseId(Integer courseId);
}

View File

@ -0,0 +1,11 @@
package student.mapper;
import student.pojo.StuTask;
import java.util.List;
public interface StuCourseTaskMapper {
List<StuTask> selectAllByCourseId(Integer courseId);
StuTask selectByTaskId(Integer taskId);
}

View File

@ -0,0 +1,98 @@
package student.pojo;
import login.pojo.User;
import java.util.Date;
import java.util.List;
public class StuCourse {
private Integer id;
private String code;
private String name;
private Date createTime;
private Integer studentCount;
private User teacher;
private Date EnterTime;
private List<StuTask> stuTasks;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getStudentCount() {
return studentCount;
}
public void setStudentCount(Integer studentCount) {
this.studentCount = studentCount;
}
public User getTeacher() {
return teacher;
}
public void setTeacher(User teacher) {
this.teacher = teacher;
}
public Date getEnterTime() {
return EnterTime;
}
public void setEnterTime(Date enterTime) {
EnterTime = enterTime;
}
public List<StuTask> getStuTasks() {
return stuTasks;
}
public void setStuTasks(List<StuTask> stuTasks) {
this.stuTasks = stuTasks;
}
@Override
public String toString() {
return "StuCourse{" +
"id=" + id +
", code='" + code + '\'' +
", name='" + name + '\'' +
", createTime=" + createTime +
", studentCount=" + studentCount +
", teacher=" + teacher +
", EnterTime=" + EnterTime +
'}';
}
}

View File

@ -0,0 +1,115 @@
package student.pojo;
import login.pojo.User;
import java.util.Date;
public class StuNotice {
private Integer id;
private Integer courseId;
private String title;
private String content;
private String plainTextContent;
private Integer writerId;
private Date createTime;
private Date updateTime;
private User teacher;
private String hUpdateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPlainTextContent() {
return plainTextContent;
}
public void setPlainTextContent(String plainTextContent) {
this.plainTextContent = plainTextContent;
}
public Integer getWriterId() {
return writerId;
}
public void setWriterId(Integer writerId) {
this.writerId = writerId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public User getTeacher() {
return teacher;
}
public void setTeacher(User teacher) {
this.teacher = teacher;
}
public String gethUpdateTime() {
return hUpdateTime;
}
public void sethUpdateTime(String hUpdateTime) {
this.hUpdateTime = hUpdateTime;
}
@Override
public String toString() {
return "TeaNotice{" +
"id=" + id +
", courseId=" + courseId +
", title='" + title + '\'' +
", content='" + content + '\'' +
", plainTextContent='" + plainTextContent + '\'' +
", writerId=" + writerId +
", createTime=" + createTime +
", updateTime=" + updateTime +
", teacher=" + teacher +
", hUpdateTime='" + hUpdateTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,136 @@
package student.pojo;
import login.pojo.User;
import java.util.Date;
public class StuTask {
private Integer id;
private Integer courseId;
private String title;
private String content;
private Date deadline;
private Integer writerId;
private Date createTime;
private Date updateTime;
private String plainTextContent;
private User teacher;
private String hUpdateTime;
private String hDeadline;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDeadline() {
return deadline;
}
public void setDeadline(Date deadline) {
this.deadline = deadline;
}
public Integer getWriterId() {
return writerId;
}
public void setWriterId(Integer writerId) {
this.writerId = writerId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getPlainTextContent() {
return plainTextContent;
}
public void setPlainTextContent(String plainTextContent) {
this.plainTextContent = plainTextContent;
}
public User getTeacher() {
return teacher;
}
public void setTeacher(User teacher) {
this.teacher = teacher;
}
public String gethUpdateTime() {
return hUpdateTime;
}
public void sethUpdateTime(String hUpdateTime) {
this.hUpdateTime = hUpdateTime;
}
public String gethDeadline() {
return hDeadline;
}
public void sethDeadline(String hDeadline) {
this.hDeadline = hDeadline;
}
@Override
public String toString() {
return "TeaTask{" +
"id=" + id +
", courseId=" + courseId +
", title='" + title + '\'' +
", content='" + content + '\'' +
", deadline=" + deadline +
", writerId=" + writerId +
", createTime=" + createTime +
", updateTime=" + updateTime +
", plainTextContent='" + plainTextContent + '\'' +
", teacher=" + teacher +
", hUpdateTime='" + hUpdateTime + '\'' +
", hDeadline='" + hDeadline + '\'' +
'}';
}
}

View File

@ -0,0 +1,27 @@
package student.service;
import login.pojo.User;
import student.pojo.StuCourse;
import java.util.List;
public interface StuCourseListService {
/**
* 查询user用户拥有的课程
* @param user 用户
* @return 课程列表
*/
List<StuCourse> findSCourses(User user);
/**
* 进入课堂
* @param course 课程对象
* @param student 学生对象
* @return 状态码
*/
int ENTER_COURSE_NOT_EXISTS = 0;
int ENTER_HAS_ENTERED = 1;
int ENTER_FAIL = 2;
int ENTER_SUCC = 3;
int enterCourse(StuCourse course, User student);
}

View File

@ -0,0 +1,18 @@
package student.service;
import student.pojo.StuCourse;
import student.pojo.StuNotice;
import java.util.List;
public interface StuCourseNoticeService {
/**
* 获取课程所有通知
* @param stuCourse 课程对象
* @return 通知集合
*/
List<StuNotice> findNotices(StuCourse stuCourse);
}

View File

@ -0,0 +1,12 @@
package student.service;
import student.pojo.StuCourse;
public interface StuCourseService {
/**
* 根据courseId或courseCode查询课程信息
* @param stuCourse 课程对象
* @return 查找结果对象
*/
StuCourse findStuCourse(StuCourse stuCourse);
}

View File

@ -0,0 +1,25 @@
package student.service;
import student.pojo.StuCourse;
import student.pojo.StuTask;
import java.util.List;
public interface StuCourseTaskService {
/**
* 获取课程所有作业
* @param stuCourse 课程对象
* @return 作业集合
*/
List<StuTask> findTasks(StuCourse stuCourse);
/**
* 根据id获取作业对象
* @param taskId 作业id
* @return 作业对象
*/
StuTask findTaskById(Integer taskId);
}

View File

@ -0,0 +1,47 @@
package student.service.impl;
import login.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import student.mapper.StuCourseMapper;
import student.pojo.StuCourse;
import student.service.StuCourseListService;
import java.util.List;
@Service
public class StuCourseListServiceImpl implements StuCourseListService {
private final StuCourseMapper stuCourseMapper;
@Autowired
public StuCourseListServiceImpl(StuCourseMapper stuCourseMapper) {
this.stuCourseMapper = stuCourseMapper;
}
public List<StuCourse> findSCourses(User user) {
List<StuCourse> stuCourses = stuCourseMapper.selectByStudentId(user.getId());
for (StuCourse stuCourse : stuCourses) {
stuCourse.setStudentCount(stuCourseMapper.selectStudentCount(stuCourse.getId()));
stuCourse.setTeacher(stuCourseMapper.selectTeacherByCourseId(stuCourse.getId()));
}
return stuCourses;
}
public int enterCourse(StuCourse course, User student) {
StuCourse old = stuCourseMapper.selectByCode(course.getCode());
if (old == null)
return ENTER_COURSE_NOT_EXISTS;
course.setId(old.getId());
course.setName(old.getName());
if (stuCourseMapper.selectEnterTimeByStudentId(course.getId(), student.getId()) != null)
return ENTER_HAS_ENTERED;
boolean ret = stuCourseMapper.insertCourseStudent(course.getId(), student.getId(), course.getEnterTime()) > 0;
if (ret)
return ENTER_SUCC;
else
return ENTER_FAIL;
}
}

View File

@ -0,0 +1,42 @@
package student.service.impl;
import login.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import student.mapper.StuCourseNoticeMapper;
import student.pojo.StuCourse;
import student.pojo.StuNotice;
import student.service.StuCourseNoticeService;
import util.Html2Text;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class StuCourseNoticeServiceImpl implements StuCourseNoticeService {
private final StuCourseNoticeMapper stuCourseNoticeMapper;
private final UserMapper userMapper;
@Autowired
public StuCourseNoticeServiceImpl(StuCourseNoticeMapper stuCourseNoticeMapper, UserMapper userMapper) {
this.stuCourseNoticeMapper = stuCourseNoticeMapper;
this.userMapper = userMapper;
}
public List<StuNotice> findNotices(StuCourse stuCourse) {
List<StuNotice> stuNotices = stuCourseNoticeMapper.selectAllByCourseId(stuCourse.getId());
for (StuNotice stuNotice : stuNotices) {
stuNotice.setPlainTextContent(Html2Text.StripHT(stuNotice.getContent(), 100));
SimpleDateFormat f = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
stuNotice.sethUpdateTime(f.format(stuNotice.getUpdateTime()));
stuNotice.setTeacher(userMapper.selectById(stuNotice.getWriterId()));
}
return stuNotices;
}
}

View File

@ -0,0 +1,25 @@
package student.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import student.mapper.StuCourseMapper;
import student.pojo.StuCourse;
import student.service.StuCourseService;
@Service
public class StuCourseServiceImpl implements StuCourseService {
private final StuCourseMapper stuCourseMapper;
@Autowired
public StuCourseServiceImpl(StuCourseMapper stuCourseMapper) {
this.stuCourseMapper = stuCourseMapper;
}
public StuCourse findStuCourse(StuCourse stuCourse) {
if (stuCourse.getId() != null)
return stuCourseMapper.selectByCourseId(stuCourse.getId());
if (stuCourse.getCode() != null)
return stuCourseMapper.selectByCode(stuCourse.getCode());
return null;
}
}

View File

@ -0,0 +1,58 @@
package student.service.impl;
import login.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import student.mapper.StuCourseTaskMapper;
import student.pojo.StuCourse;
import student.pojo.StuTask;
import student.service.StuCourseTaskService;
import util.Html2Text;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class StuCourseTaskServiceImpl implements StuCourseTaskService {
private final StuCourseTaskMapper stuCourseTaskMapper;
private final UserMapper userMapper;
@Autowired
public StuCourseTaskServiceImpl(StuCourseTaskMapper stuCourseTaskMapper, UserMapper userMapper) {
this.stuCourseTaskMapper = stuCourseTaskMapper;
this.userMapper = userMapper;
}
public List<StuTask> findTasks(StuCourse stuCourse) {
List<StuTask> stuTasks = stuCourseTaskMapper.selectAllByCourseId(stuCourse.getId());
for (StuTask stuTask : stuTasks) {
stuTask.setPlainTextContent(Html2Text.StripHT(stuTask.getContent(), 100));
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm");
stuTask.sethUpdateTime(f.format(stuTask.getUpdateTime()));
if (stuTask.getDeadline() != null)
stuTask.sethDeadline(f.format(stuTask.getDeadline()));
stuTask.setTeacher(userMapper.selectById(stuTask.getWriterId()));
}
return stuTasks;
}
public StuTask findTaskById(Integer taskId) {
StuTask stuTask = stuCourseTaskMapper.selectByTaskId(taskId);
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm");
stuTask.sethUpdateTime(f.format(stuTask.getUpdateTime()));
if (stuTask.getDeadline() != null)
stuTask.sethDeadline(f.format(stuTask.getDeadline()));
stuTask.setTeacher(userMapper.selectById(stuTask.getWriterId()));
return stuTask;
}
}

View File

@ -0,0 +1,51 @@
package teacher.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.service.CourseResourceService;
import login.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
public class ResourceDeleteAction extends ActionSupport {
private Integer resourceId;
private Integer courseId;
@Autowired
private CourseResourceService courseResourceService;
public String delete() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (resourceId == null || courseId == null)
return ERROR;
if (courseResourceService.deleteResource(resourceId)) {
return SUCCESS;
} else {
return ERROR;
}
}
public Integer getResourceId() {
return resourceId;
}
public void setResourceId(Integer resourceId) {
this.resourceId = resourceId;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
}

View File

@ -0,0 +1,206 @@
package teacher.action;
import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.beans.factory.annotation.Autowired;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaTask;
import teacher.service.TeaCourseListService;
import teacher.service.TeaCourseService;
import teacher.service.TeaCourseTaskService;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
public class TeaCourseListAction extends ActionSupport implements ServletResponseAware {
private static final Logger LOG = LogManager.getLogger(TeaCourseListAction.class);
private final TeaCourseListService TeaCourseListService;
@Autowired
private TeaCourseTaskService teaCourseTaskService;
@Autowired
private TeaCourseService teaCourseService;
@Autowired
public TeaCourseListAction(TeaCourseListService TeaCourseListService) {
this.TeaCourseListService = TeaCourseListService;
}
private List<TeaCourse> teaCourses;
public String showCourseList() {
User user = (User) ActionContext.getContext().getSession().get("user");
LOG.debug(user);
if (user == null)
return LOGIN;
teaCourses = TeaCourseListService.findTCourses(user);
LOG.debug("courses: " + teaCourses);
for (TeaCourse t : teaCourses) {
List<TeaTask> teaTasks = teaCourseTaskService.findTasks(t);
for (TeaTask task : teaTasks) {
if (task.getTitle().length() > 12)
task.setTitle(task.getTitle().substring(0, 12) + "...");
}
if (teaTasks.size() > 3)
t.setTeaTasks(teaTasks.subList(0, 3));
else
t.setTeaTasks(teaTasks);
}
return SUCCESS;
}
public List<TeaCourse> getTeaCourses() {
return teaCourses;
}
public void setTeaCourses(List<TeaCourse> teaCourses) {
this.teaCourses = teaCourses;
}
private HttpServletResponse response;
private String courseName;
private static final int CREATE_COURSE_CODE = 3;
private static final int SUCC_STATUS = 0;
private static final int INVAID_FILED_STATUS = 1;
private static final int FAIL_STATUS = 2;
public String createCourse() throws IOException {
User user = (User) ActionContext.getContext().getSession().get("user");
LOG.debug(user);
if (user == null)
return LOGIN;
CreateCourseJson createCourseJson = new CreateCourseJson();
createCourseJson.code = CREATE_COURSE_CODE;
if (courseName == null || courseName.trim().equals("")) {
createCourseJson.msg = "存在空字段";
createCourseJson.status = INVAID_FILED_STATUS;
} else {
TeaCourse teaCourse = new TeaCourse();
teaCourse.setName(courseName.trim());
boolean ret = TeaCourseListService.addCourse(teaCourse, user);
if (ret) {
//创建课程成功
createCourseJson.msg = "创建成功";
createCourseJson.status = SUCC_STATUS;
createCourseJson.data.put("code", teaCourse.getCode());
createCourseJson.data.put("id", teaCourse.getId());
} else {
createCourseJson.msg = "创建失败";
createCourseJson.status = FAIL_STATUS;
}
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
String ret = JSON.toJSONString(createCourseJson);
LOG.debug("json: " + ret);
PrintWriter writer = response.getWriter();
writer.print(ret);
writer.flush();
writer.close();
return NONE;
}
class CreateCourseJson {
int code;
String msg;
int status;
HashMap<String, Object > data = new HashMap<String, Object>();
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public HashMap<String, Object> getData() {
return data;
}
public void setData(HashMap<String, Object> data) {
this.data = data;
}
}
private Integer courseId;
public String deleteCourse() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
if (teaCourseService.deleteByCourseId(courseId)) {
return SUCCESS;
} else {
return ERROR;
}
}
public void setServletResponse(HttpServletResponse response) {
this.response = response;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
}

View File

@ -0,0 +1,153 @@
package teacher.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaNotice;
import teacher.service.TeaCourseNoticeService;
import teacher.service.TeaCourseService;
import java.util.Date;
import java.util.List;
public class TeaCourseNoticeAction extends ActionSupport{
private static final Logger LOG = LogManager.getLogger(TeaCourseNoticeAction.class);
private Integer courseId;
private final TeaCourseNoticeService teaCourseNoticeService;
private final TeaCourseService teaCourseService;
@Autowired
public TeaCourseNoticeAction(TeaCourseNoticeService teaCourseNoticeService, TeaCourseService teaCourseService) {
this.teaCourseNoticeService = teaCourseNoticeService;
this.teaCourseService = teaCourseService;
}
private List<TeaNotice> teaNotices;
private TeaCourse teaCourse;
public String getNotice() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
TeaCourse c = new TeaCourse();
c.setId(courseId);
teaNotices = teaCourseNoticeService.findNotices(c);
teaCourse = teaCourseService.findTCourse(c);
LOG.debug("teaNotices: " + teaNotices);
LOG.debug("teaCourse: " + teaCourse);
return SUCCESS;
}
private String noticeName;
private String noticeContent;
public String addNotice() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (noticeName == null || noticeName.trim().equals("") ||
noticeContent == null || courseId == null)
return ERROR;
TeaNotice teaNotice = new TeaNotice();
teaNotice.setTitle(noticeName.trim());
teaNotice.setContent(noticeContent);
teaNotice.setCourseId(courseId);
teaNotice.setWriterId(user.getId());
teaNotice.setCreateTime(new Date());
teaNotice.setUpdateTime(new Date());
if (teaCourseNoticeService.addNotice(teaNotice))
return SUCCESS;
else
return ERROR;
}
private Integer noticeId;
public String deleteNotice() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (noticeId == null || courseId == null)
return ERROR;
TeaNotice teaNotice = new TeaNotice();
teaNotice.setId(noticeId);
if (teaCourseNoticeService.deleteNotice(teaNotice))
return SUCCESS;
else
return ERROR;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public List<TeaNotice> getTeaNotices() {
return teaNotices;
}
public void setTeaNotices(List<TeaNotice> teaNotices) {
this.teaNotices = teaNotices;
}
public TeaCourse getTeaCourse() {
return teaCourse;
}
public void setTeaCourse(TeaCourse teaCourse) {
this.teaCourse = teaCourse;
}
public String getNoticeName() {
return noticeName;
}
public void setNoticeName(String noticeName) {
this.noticeName = noticeName;
}
public String getNoticeContent() {
return noticeContent;
}
public void setNoticeContent(String noticeContent) {
this.noticeContent = noticeContent;
}
public Integer getNoticeId() {
return noticeId;
}
public void setNoticeId(Integer noticeId) {
this.noticeId = noticeId;
}
}

View File

@ -0,0 +1,79 @@
package teacher.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import file.pojo.CourseResource;
import file.service.CourseResourceService;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import teacher.pojo.TeaCourse;
import teacher.service.TeaCourseService;
import java.util.List;
public class TeaCourseResourceAction extends ActionSupport {
private static final Logger LOG = LogManager.getLogger(TeaCourseResourceAction.class);
private Integer courseId;
private TeaCourse teaCourse;
private final TeaCourseService teaCourseService;
private final CourseResourceService courseResourceService;
@Autowired
public TeaCourseResourceAction(TeaCourseService teaCourseService, CourseResourceService courseResourceService) {
this.teaCourseService = teaCourseService;
this.courseResourceService = courseResourceService;
}
private List<CourseResource> resources;
public String getResource() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
TeaCourse c = new TeaCourse();
c.setId(courseId);
teaCourse = teaCourseService.findTCourse(c);
resources = courseResourceService.findByCourseId(courseId);
LOG.debug("resources " + resources);
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public TeaCourse getTeaCourse() {
return teaCourse;
}
public void setTeaCourse(TeaCourse teaCourse) {
this.teaCourse = teaCourse;
}
public List<CourseResource> getResources() {
return resources;
}
public void setResources(List<CourseResource> resources) {
this.resources = resources;
}
}

View File

@ -0,0 +1,69 @@
package teacher.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import teacher.pojo.TeaCourse;
import teacher.service.TeaCourseService;
import teacher.service.TeaCourseStudentService;
import java.util.List;
public class TeaCourseStudentAction extends ActionSupport {
private Integer courseId;
private List<User> students;
private TeaCourse teaCourse;
@Autowired
private TeaCourseService teaCourseService;
@Autowired
private TeaCourseStudentService teaCourseStudentService;
public String findStudents() {
User user = (User) ActionContext.getContext().getSession().get("user");
if(user == null)
return LOGIN;
if(courseId == null)
return ERROR;
students = teaCourseStudentService.findAllByCourseId(courseId);
TeaCourse c = new TeaCourse();
c.setId(courseId);
teaCourse = teaCourseService.findTCourse(c);
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public void setStudents(List<User> students) {
this.students = students;
}
public List<User> getStudents() {
return students;
}
public TeaCourse getTeaCourse() {
return teaCourse;
}
public void setTeaCourse(TeaCourse teaCourse) {
this.teaCourse = teaCourse;
}
}

View File

@ -0,0 +1,278 @@
package teacher.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import login.pojo.User;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import teacher.pojo.StuTaskFiles;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaTask;
import teacher.service.TeaCourseService;
import teacher.service.TeaCourseTaskService;
import java.util.Date;
import java.util.List;
public class TeaCourseTaskAction extends ActionSupport{
private static final Logger LOG = LogManager.getLogger(TeaCourseTaskAction.class);
private Integer courseId;
private final TeaCourseTaskService teaCourseTaskService;
private final TeaCourseService teaCourseService;
@Autowired
public TeaCourseTaskAction(TeaCourseTaskService teaCourseTaskService, TeaCourseService teaCourseService) {
this.teaCourseTaskService = teaCourseTaskService;
this.teaCourseService = teaCourseService;
}
private List<TeaTask> teaTasks;
private TeaCourse teaCourse;
public String getTasks() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (courseId == null)
return ERROR;
TeaCourse c = new TeaCourse();
c.setId(courseId);
teaTasks = teaCourseTaskService.findTasks(c);
teaCourse = teaCourseService.findTCourse(c);
LOG.debug("teaTasks: " + teaTasks);
LOG.debug("teaCourse: " + teaCourse);
return SUCCESS;
}
private String taskName;
private String taskContent;
private long deadlineTime;
public String addTask() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskName == null || taskName.trim().equals("") ||
taskContent == null || courseId == null)
return ERROR;
TeaTask teaTask = new TeaTask();
teaTask.setTitle(taskName.trim());
teaTask.setContent(taskContent);
teaTask.setCourseId(courseId);
teaTask.setWriterId(user.getId());
teaTask.setCreateTime(new Date());
teaTask.setUpdateTime(new Date());
if (deadlineTime != 0)
teaTask.setDeadline(new Date(deadlineTime));
if (teaCourseTaskService.addTask(teaTask))
return SUCCESS;
else
return ERROR;
}
public String updateTask() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskName == null || taskName.trim().equals("") ||
taskContent == null || courseId == null || taskId == null)
return ERROR;
TeaTask teaTask = teaCourseTaskService.findTaskById(taskId);
if (teaTask == null || !courseId.equals(teaTask.getCourseId())) return ERROR;
teaTask.setTitle(taskName.trim());
teaTask.setContent(taskContent);
teaTask.setWriterId(user.getId());
teaTask.setUpdateTime(new Date());
if(deadlineTime != 0)
teaTask.setDeadline(new Date(deadlineTime));
else
teaTask.setDeadline(null);
if (teaCourseTaskService.updateTask(teaTask))
return SUCCESS;
else
return ERROR;
}
private Integer taskId;
public String deleteTask() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null || courseId == null)
return ERROR;
TeaTask teaTask = new TeaTask();
teaTask.setId(taskId);
if (teaCourseTaskService.deleteTask(teaTask))
return SUCCESS;
else
return ERROR;
}
private TeaTask teaTask;
public String toUpdate() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null || courseId == null)
return ERROR;
teaTask = teaCourseTaskService.findTaskById(taskId);
TeaCourse t = new TeaCourse();
t.setId(courseId);
teaCourse = teaCourseService.findTCourse(t);
if (teaTask == null || teaCourse == null)
return ERROR;
else
return SUCCESS;
}
private List<StuTaskFiles> stuTaskFiles;
private int allNum = 0;
private int uploadNum = 0;
public String taskDetail() {
User user = (User) ActionContext.getContext().getSession().get("user");
if (user == null)
return LOGIN;
if (taskId == null || courseId == null)
return ERROR;
teaTask = teaCourseTaskService.findTaskById(taskId);
TeaCourse t = new TeaCourse();
t.setId(courseId);
teaCourse = teaCourseService.findTCourse(t);
stuTaskFiles = teaCourseTaskService.findStuTaskFiles(courseId, taskId);
LOG.debug("stuTaskFiles: " + stuTaskFiles);
allNum = stuTaskFiles.size();
for (StuTaskFiles s : stuTaskFiles) {
if (s.getTaskFile() != null)
uploadNum++;
}
return SUCCESS;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public List<TeaTask> getTeaTasks() {
return teaTasks;
}
public void setTeaTasks(List<TeaTask> teaTasks) {
this.teaTasks = teaTasks;
}
public TeaCourse getTeaCourse() {
return teaCourse;
}
public void setTeaCourse(TeaCourse teaCourse) {
this.teaCourse = teaCourse;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskContent() {
return taskContent;
}
public void setTaskContent(String taskContent) {
this.taskContent = taskContent;
}
public long getDeadlineTime() {
return deadlineTime;
}
public void setDeadlineTime(long deadlineTime) {
this.deadlineTime = deadlineTime;
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public TeaTask getTeaTask() {
return teaTask;
}
public void setTeaTask(TeaTask teaTask) {
this.teaTask = teaTask;
}
public List<StuTaskFiles> getStuTaskFiles() {
return stuTaskFiles;
}
public void setStuTaskFiles(List<StuTaskFiles> stuTaskFiles) {
this.stuTaskFiles = stuTaskFiles;
}
public int getAllNum() {
return allNum;
}
public void setAllNum(int allNum) {
this.allNum = allNum;
}
public int getUploadNum() {
return uploadNum;
}
public void setUploadNum(int uploadNum) {
this.uploadNum = uploadNum;
}
}

View File

@ -0,0 +1,10 @@
package teacher.action;
import com.opensymphony.xwork2.ActionSupport;
public class TeaCourseTestAction extends ActionSupport {
public String toAddTest() {
return SUCCESS;
}
}

View File

@ -0,0 +1,5 @@
package teacher.mapper;
public interface StuTaskFilesMapper {
}

View File

@ -0,0 +1,26 @@
package teacher.mapper;
import login.pojo.User;
import org.apache.ibatis.annotations.Param;
import teacher.pojo.TeaCourse;
import java.util.List;
public interface TeaCourseMapper {
List<TeaCourse> selectByTeacherId(Integer teacherId);
TeaCourse selectByCode(String code);
TeaCourse selectByCourseId(Integer courseId);
int selectStudentCount(TeaCourse teaCourse);
int insertCourse(TeaCourse teaCourse);
int insertCourseTeacher(@Param("courseId") Integer courseId, @Param("teacherId") Integer teacherId);
List<User> selectCourseStudent(Integer courseId);
int delete(Integer courseId);
}

View File

@ -0,0 +1,13 @@
package teacher.mapper;
import teacher.pojo.TeaNotice;
import java.util.List;
public interface TeaCourseNoticeMapper {
List<TeaNotice> selectAllByCourseId(Integer courseId);
int insertNotice(TeaNotice teaNotice);
int deleteNotice(Integer noticeId);
}

View File

@ -0,0 +1,17 @@
package teacher.mapper;
import teacher.pojo.TeaTask;
import java.util.List;
public interface TeaCourseTaskMapper {
List<TeaTask> selectAllByCourseId(Integer courseId);
TeaTask selectByTaskId(Integer taskId);
int insertTask(TeaTask teaTask);
int updateTask(TeaTask teaTask);
int deleteTask(Integer taskId);
}

View File

@ -0,0 +1,33 @@
package teacher.pojo;
import file.pojo.TaskFile;
import login.pojo.User;
public class StuTaskFiles {
private User user;
private TaskFile taskFile;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public TaskFile getTaskFile() {
return taskFile;
}
public void setTaskFile(TaskFile taskFile) {
this.taskFile = taskFile;
}
@Override
public String toString() {
return "StuTaskFiles{" +
"user=" + user +
", taskFile=" + taskFile +
'}';
}
}

View File

@ -0,0 +1,74 @@
package teacher.pojo;
import java.util.Date;
import java.util.List;
public class TeaCourse {
private Integer id;
private String code;
private String name;
private Date createTime;
private Integer studentCount;
private List<TeaTask> teaTasks;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getStudentCount() {
return studentCount;
}
public void setStudentCount(Integer studentCount) {
this.studentCount = studentCount;
}
public List<TeaTask> getTeaTasks() {
return teaTasks;
}
public void setTeaTasks(List<TeaTask> teaTasks) {
this.teaTasks = teaTasks;
}
@Override
public String toString() {
return "StuCourse{" +
"id=" + id +
", code='" + code + '\'' +
", name='" + name + '\'' +
", createTime=" + createTime +
", studentCount=" + studentCount +
'}';
}
}

View File

@ -0,0 +1,115 @@
package teacher.pojo;
import login.pojo.User;
import java.util.Date;
public class TeaNotice {
private Integer id;
private Integer courseId;
private String title;
private String content;
private String plainTextContent;
private Integer writerId;
private Date createTime;
private Date updateTime;
private User teacher;
private String hUpdateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPlainTextContent() {
return plainTextContent;
}
public void setPlainTextContent(String plainTextContent) {
this.plainTextContent = plainTextContent;
}
public Integer getWriterId() {
return writerId;
}
public void setWriterId(Integer writerId) {
this.writerId = writerId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public User getTeacher() {
return teacher;
}
public void setTeacher(User teacher) {
this.teacher = teacher;
}
public String gethUpdateTime() {
return hUpdateTime;
}
public void sethUpdateTime(String hUpdateTime) {
this.hUpdateTime = hUpdateTime;
}
@Override
public String toString() {
return "TeaNotice{" +
"id=" + id +
", courseId=" + courseId +
", title='" + title + '\'' +
", content='" + content + '\'' +
", plainTextContent='" + plainTextContent + '\'' +
", writerId=" + writerId +
", createTime=" + createTime +
", updateTime=" + updateTime +
", teacher=" + teacher +
", hUpdateTime='" + hUpdateTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,136 @@
package teacher.pojo;
import login.pojo.User;
import java.util.Date;
public class TeaTask {
private Integer id;
private Integer courseId;
private String title;
private String content;
private Date deadline;
private Integer writerId;
private Date createTime;
private Date updateTime;
private String plainTextContent;
private User teacher;
private String hUpdateTime;
private String hDeadline;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDeadline() {
return deadline;
}
public void setDeadline(Date deadline) {
this.deadline = deadline;
}
public Integer getWriterId() {
return writerId;
}
public void setWriterId(Integer writerId) {
this.writerId = writerId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getPlainTextContent() {
return plainTextContent;
}
public void setPlainTextContent(String plainTextContent) {
this.plainTextContent = plainTextContent;
}
public User getTeacher() {
return teacher;
}
public void setTeacher(User teacher) {
this.teacher = teacher;
}
public String gethUpdateTime() {
return hUpdateTime;
}
public void sethUpdateTime(String hUpdateTime) {
this.hUpdateTime = hUpdateTime;
}
public String gethDeadline() {
return hDeadline;
}
public void sethDeadline(String hDeadline) {
this.hDeadline = hDeadline;
}
@Override
public String toString() {
return "TeaTask{" +
"id=" + id +
", courseId=" + courseId +
", title='" + title + '\'' +
", content='" + content + '\'' +
", deadline=" + deadline +
", writerId=" + writerId +
", createTime=" + createTime +
", updateTime=" + updateTime +
", plainTextContent='" + plainTextContent + '\'' +
", teacher=" + teacher +
", hUpdateTime='" + hUpdateTime + '\'' +
", hDeadline='" + hDeadline + '\'' +
'}';
}
}

View File

@ -0,0 +1,23 @@
package teacher.service;
import login.pojo.User;
import teacher.pojo.TeaCourse;
import java.util.List;
public interface TeaCourseListService {
/**
* 查询user用户拥有的课程
* @param user 用户
* @return 课程列表
*/
List<TeaCourse> findTCourses(User user);
/**
* 添加新课程
* @param teaCourse 课程对象
* @param user 创建者对象
* @return 是否成功
*/
boolean addCourse(TeaCourse teaCourse, User user);
}

View File

@ -0,0 +1,32 @@
package teacher.service;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaNotice;
import java.util.List;
public interface TeaCourseNoticeService {
/**
* 获取课程所有通知
* @param teaCourse 课程对象
* @return 通知集合
*/
List<TeaNotice> findNotices(TeaCourse teaCourse);
/**
* 增加公告
* @param teaNotice 公告
* @return 是否成功
*/
boolean addNotice(TeaNotice teaNotice);
/**
* 删除公告
* @param teaNotice 公告对象
* @return 是否成功删除
*/
boolean deleteNotice(TeaNotice teaNotice);
}

View File

@ -0,0 +1,14 @@
package teacher.service;
import teacher.pojo.TeaCourse;
public interface TeaCourseService {
/**
* 根据courseId或courseCode查询课程信息
* @param teaCourse 课程对象
* @return 查找结果对象
*/
TeaCourse findTCourse(TeaCourse teaCourse);
boolean deleteByCourseId(Integer courseId);
}

View File

@ -0,0 +1,9 @@
package teacher.service;
import login.pojo.User;
import java.util.List;
public interface TeaCourseStudentService {
List<User> findAllByCourseId(Integer courseId);
}

View File

@ -0,0 +1,55 @@
package teacher.service;
import teacher.pojo.StuTaskFiles;
import teacher.pojo.TeaCourse;
import teacher.pojo.TeaTask;
import java.util.List;
public interface TeaCourseTaskService {
/**
* 获取课程所有作业
* @param teaCourse 课程对象
* @return 作业集合
*/
List<TeaTask> findTasks(TeaCourse teaCourse);
/**
* 根据id获取作业对象
* @param taskId 作业id
* @return 作业对象
*/
TeaTask findTaskById(Integer taskId);
/**
* 增加作业
* @param teaTask 作业
* @return 是否成功
*/
boolean addTask(TeaTask teaTask);
/**
* 修改作业
* @param teaTask 作业
* @return 是否成功
*/
boolean updateTask(TeaTask teaTask);
/**
* 删除作业
* @param teaTask 作业对象
* @return 是否成功删除
*/
boolean deleteTask(TeaTask teaTask);
/**
* 获取学生作业文件集
* @param courseId 课程id
* @param taskId 作业id
* @return 作业集
*/
List<StuTaskFiles> findStuTaskFiles(Integer courseId, Integer taskId);
}

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