mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
317 Commits
zcwy0927-y
...
dev0525
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ac3a92618 | ||
|
|
c8f113ed32 | ||
|
|
339ee671a1 | ||
|
|
a790b8622e | ||
|
|
dcb70ab705 | ||
|
|
40eebd7e86 | ||
|
|
cefdee3cfc | ||
|
|
0c7f6f0a8d | ||
|
|
f2d6b0cce9 | ||
|
|
44ffc93310 | ||
|
|
3890ad04b9 | ||
|
|
1039af40db | ||
|
|
efcee67fe1 | ||
|
|
284207fb5b | ||
|
|
20c05afda9 | ||
|
|
1eca154b02 | ||
|
|
3ebd110f1c | ||
|
|
18614bae7a | ||
|
|
e508c546fa | ||
|
|
8bdd69ca60 | ||
|
|
336283dae3 | ||
|
|
0b4cd71cd1 | ||
|
|
cc385f32aa | ||
|
|
c02c9246b3 | ||
|
|
0988145ac3 | ||
|
|
9e3183b93d | ||
|
|
3d6e97cba8 | ||
|
|
f82dfb7402 | ||
|
|
6e6ce7b323 | ||
|
|
ff43f046d0 | ||
|
|
0f5727bc0d | ||
|
|
6a9deb1bac | ||
|
|
4a26209008 | ||
|
|
4ac7acb033 | ||
|
|
350921dbe6 | ||
|
|
2e596e1e9a | ||
|
|
3c674317c3 | ||
|
|
9461c692e2 | ||
|
|
580e5bd100 | ||
|
|
7eda4f8a7c | ||
|
|
8627a72d91 | ||
|
|
a6bcc50f16 | ||
|
|
0d95b756a6 | ||
|
|
f852674994 | ||
|
|
3a5b13dfe8 | ||
|
|
e4adadcdbf | ||
|
|
b40391ba6a | ||
|
|
d1e9b53625 | ||
|
|
24894444f6 | ||
|
|
48ac060ab2 | ||
|
|
0e8f8b1cb7 | ||
|
|
a6336b2bf2 | ||
|
|
323aca88da | ||
|
|
b5b17f9b86 | ||
|
|
44c87232eb | ||
|
|
70d81ebca8 | ||
|
|
aa50cd64fd | ||
|
|
a0976e48a8 | ||
|
|
f049759428 | ||
|
|
1fbf56dec3 | ||
|
|
e60e110ab4 | ||
|
|
f8452e4702 | ||
|
|
d976e37bc5 | ||
|
|
bedc922585 | ||
|
|
2d223c5f1f | ||
|
|
9758ef056c | ||
|
|
bb894c996c | ||
|
|
8db557a8f6 | ||
|
|
f19b24641e | ||
|
|
67d34224e3 | ||
|
|
74f51601d3 | ||
|
|
d24df7e30a | ||
|
|
708eeade22 | ||
|
|
695ec18b04 | ||
|
|
a06a353c68 | ||
|
|
05629b721d | ||
|
|
a8a31d7d86 | ||
|
|
b9bcf02484 | ||
|
|
77e347f8d4 | ||
|
|
3b0435f246 | ||
|
|
93ad2f4693 | ||
|
|
58c05e7e47 | ||
|
|
f8949af69f | ||
|
|
3f0a32de14 | ||
|
|
a1e0918aec | ||
|
|
94c63a8907 | ||
|
|
b5bee5a6a4 | ||
|
|
d467e0974d | ||
|
|
aa5495dbfe | ||
|
|
5ef57add02 | ||
|
|
f6c61534aa | ||
|
|
9d0cf1a988 | ||
|
|
4a187a4c18 | ||
|
|
4c36a29ee7 | ||
|
|
7321f7de6c | ||
|
|
7be0acf350 | ||
|
|
87892fe8ef | ||
|
|
a0c891cd35 | ||
|
|
6e805590b8 | ||
|
|
33ebd209ff | ||
|
|
7569c95241 | ||
|
|
07d0578edc | ||
|
|
5430c149e1 | ||
|
|
42c953f05a | ||
|
|
5236f13c14 | ||
|
|
4e7b4e4a51 | ||
|
|
fe1a59359d | ||
|
|
6a3cbf290a | ||
|
|
65e1e752d0 | ||
|
|
ba62bc6403 | ||
|
|
21e780c589 | ||
|
|
89060ad3d9 | ||
|
|
0e7e11b3f1 | ||
|
|
a13ad69e1f | ||
|
|
3973cb1421 | ||
|
|
d7d9a3c2c9 | ||
|
|
b0321d4f28 | ||
|
|
21e12c815b | ||
|
|
4e7661530c | ||
|
|
cdd6879aee | ||
|
|
7a9859cf9c | ||
|
|
eb70c7a985 | ||
|
|
0556fce863 | ||
|
|
becebadfe0 | ||
|
|
2a78c13abb | ||
|
|
50745e8398 | ||
|
|
036df70e83 | ||
|
|
55b35db9a9 | ||
|
|
2f1983d76b | ||
|
|
c607d35281 | ||
|
|
f6e5d7539d | ||
|
|
3e0a6d4487 | ||
|
|
da103bde52 | ||
|
|
92b302316b | ||
|
|
c973bd1573 | ||
|
|
fc34ab91ce | ||
|
|
e8b95bcd5a | ||
|
|
914b06bc77 | ||
|
|
450693cdad | ||
|
|
41c1321769 | ||
|
|
653a617912 | ||
|
|
973c6fb9f5 | ||
|
|
c1da0a2d05 | ||
|
|
fc7d3d00b9 | ||
|
|
84ee2fd916 | ||
|
|
d2a7fe07da | ||
|
|
ce6730dd2d | ||
|
|
d71f098e91 | ||
|
|
aa3be9c091 | ||
|
|
08acab350e | ||
|
|
1cd0fd1ba0 | ||
|
|
7887736fb2 | ||
|
|
5d31baa027 | ||
|
|
d0ec40a947 | ||
|
|
8a0d0219a5 | ||
|
|
4620f85eba | ||
|
|
73b198af4c | ||
|
|
68ea50b1f3 | ||
|
|
386afebce4 | ||
|
|
9bec1afacf | ||
|
|
dd68754a1e | ||
|
|
6aae7ac070 | ||
|
|
b81bdc7179 | ||
|
|
de6c405af4 | ||
|
|
275cc76f55 | ||
|
|
dba0386bcd | ||
|
|
290417534c | ||
|
|
db6febcd54 | ||
|
|
16239a68dc | ||
|
|
1be244e483 | ||
|
|
c25fd9c384 | ||
|
|
e0b0516ae0 | ||
|
|
897a44e2c3 | ||
|
|
802130aa75 | ||
|
|
c72f3eb640 | ||
|
|
1df65fce85 | ||
|
|
529fb59167 | ||
|
|
262463bb7f | ||
|
|
a019726181 | ||
|
|
4e08676639 | ||
|
|
3b34cc1bde | ||
|
|
c7f4f9fc01 | ||
|
|
be18e35583 | ||
|
|
ae3a56891c | ||
|
|
bd25fc1d1a | ||
|
|
b049aa81f5 | ||
|
|
91b0b899b0 | ||
|
|
85753b7261 | ||
|
|
983313e845 | ||
|
|
a71b6232cb | ||
|
|
f4c1bd7eed | ||
|
|
ef40c39749 | ||
|
|
0ac6622526 | ||
|
|
6924744c07 | ||
|
|
00fa85add2 | ||
|
|
9a83f64e38 | ||
|
|
aab518b522 | ||
|
|
20484a83da | ||
|
|
3116bed63c | ||
|
|
45d5233448 | ||
|
|
1f2fa21c93 | ||
|
|
26a2a8e709 | ||
|
|
b219a46a74 | ||
|
|
d90f4d883f | ||
|
|
43d99828e6 | ||
|
|
901638dea9 | ||
|
|
532a502cf1 | ||
|
|
170dc45c64 | ||
|
|
5594e07264 | ||
|
|
e868833696 | ||
|
|
13b5e6ab4c | ||
|
|
d0944b05e0 | ||
|
|
e144fde444 | ||
|
|
0cdbdfbb30 | ||
|
|
439737f9a5 | ||
|
|
88158e7ebf | ||
|
|
4e870985a8 | ||
|
|
973afb94b4 | ||
|
|
da566414eb | ||
|
|
e69ab94c8c | ||
|
|
9aa852e56f | ||
|
|
42040f023d | ||
|
|
e7b6d08802 | ||
|
|
ddf846fe2f | ||
|
|
ebaf8e09d3 | ||
|
|
1f2a07efb3 | ||
|
|
cdccb6f0ef | ||
|
|
4c1c19c364 | ||
|
|
f6e167e024 | ||
|
|
7287c6d7b8 | ||
|
|
6749aaa594 | ||
|
|
ac552d5452 | ||
|
|
c9dbc8a622 | ||
|
|
559f525450 | ||
|
|
7e2b3506c6 | ||
|
|
7aa30aff77 | ||
|
|
d2f323bb38 | ||
|
|
e57a02bf87 | ||
|
|
2b63fe1db6 | ||
|
|
49f920e730 | ||
|
|
8d3eed6603 | ||
|
|
2adb039a82 | ||
|
|
5bd71c539b | ||
|
|
332aa68960 | ||
|
|
4fdd7b1352 | ||
|
|
cb7bedf353 | ||
|
|
a4f260b99a | ||
|
|
745e2299e5 | ||
|
|
2ebb945198 | ||
|
|
de7d26f447 | ||
|
|
a6b9fb8da2 | ||
|
|
8868d3771b | ||
|
|
e2e0aeb9cb | ||
|
|
2fb3cf28e6 | ||
|
|
340091b916 | ||
|
|
f1a92fd371 | ||
|
|
b934c71e3a | ||
|
|
7217348ae9 | ||
|
|
3d5c9620f7 | ||
|
|
bcdc784e7d | ||
|
|
21b990898d | ||
|
|
7c4a6feb78 | ||
|
|
77c8991d13 | ||
|
|
aa245e52c6 | ||
|
|
43950ccff3 | ||
|
|
83458c030b | ||
|
|
13af22baea | ||
|
|
f610b0725c | ||
|
|
805f40f6d6 | ||
|
|
e72edb9c77 | ||
|
|
f4d00c7ad4 | ||
|
|
9fb1b432ee | ||
|
|
d47669b3ea | ||
|
|
ec8ffcb947 | ||
|
|
105d29b754 | ||
|
|
a227cb96d2 | ||
|
|
b2ff1a208d | ||
|
|
76aa90a0ce | ||
|
|
7168452b0d | ||
|
|
4b4f3b9620 | ||
|
|
72f033a769 | ||
|
|
9deeed5764 | ||
|
|
1bd4764eee | ||
|
|
7f2c57099b | ||
|
|
16b6c419ab | ||
|
|
726fc2e684 | ||
|
|
cc1900f907 | ||
|
|
61caaa6b12 | ||
|
|
4c1afd1130 | ||
|
|
58e694aaf1 | ||
|
|
eb0184762a | ||
|
|
b595800344 | ||
|
|
85eb11c30a | ||
|
|
5f223d9183 | ||
|
|
b74141a036 | ||
|
|
c7841adcaa | ||
|
|
9f0a926841 | ||
|
|
dc3e47ec15 | ||
|
|
3acf58e8d4 | ||
|
|
2ff595062c | ||
|
|
0b3c6b057e | ||
|
|
56866a51df | ||
|
|
c1e45afbca | ||
|
|
219b406e8a | ||
|
|
06d14582cc | ||
|
|
08763593cd | ||
|
|
5f1f3ebf9f | ||
|
|
c66c6369c6 | ||
|
|
402015f5b1 | ||
|
|
f61c7ed83f | ||
|
|
8e3231b506 | ||
|
|
1c3a70bc12 | ||
|
|
a62c39b13c | ||
|
|
189a47d4d0 | ||
|
|
0c98dbef06 | ||
|
|
bdfb400ad6 | ||
|
|
858704a3d0 |
@@ -20,7 +20,7 @@ import com.xboe.common.utils.StringUtil;
|
||||
public class ElasticsearchConfig {
|
||||
|
||||
@Value("${xboe.elasticsearch.server.ip}")
|
||||
private String esIp="10.251.88.214";
|
||||
private String esIp="127.0.0.1";
|
||||
|
||||
@Value("${xboe.elasticsearch.server.port}")
|
||||
private int esPort=9200;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -16,38 +16,38 @@
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
<nacos-client.version>2.2.0</nacos-client.version>
|
||||
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||
<nacos-client.version>2.2.0</nacos-client.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- 引入Cloud -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
<version>${nacos-client.version}</version>
|
||||
</dependency>
|
||||
<!-- end -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
<version>${nacos-client.version}</version>
|
||||
</dependency>
|
||||
<!-- end -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-api</artifactId>
|
||||
@@ -58,7 +58,7 @@
|
||||
<artifactId>xboe-module-scorm</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
@@ -92,9 +92,9 @@
|
||||
<systemPath>${project.basedir}/src/main/resources/libs/jave-1.0.2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.18.3</version>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>3.18.3</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
@@ -109,8 +109,8 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -129,10 +129,10 @@
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
@@ -184,13 +184,13 @@
|
||||
</dependency>
|
||||
|
||||
<!-- aspose -->
|
||||
<dependency>
|
||||
<groupId>com.aspose</groupId>
|
||||
<artifactId>slides</artifactId>
|
||||
<version>15.9.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/aspose/aspose.slides-15.9.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aspose</groupId>
|
||||
<artifactId>slides</artifactId>
|
||||
<version>15.9.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/aspose/aspose.slides-15.9.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aspose</groupId>
|
||||
<artifactId>words</artifactId>
|
||||
@@ -213,20 +213,20 @@
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-client</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-client</artifactId>
|
||||
<version>7.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
@@ -235,32 +235,32 @@
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application-${profileActive}.properties</include>
|
||||
<include>application.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>application-${profileActive}.properties</include>
|
||||
<include>application.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<!-- <version>3.8.0</version> -->
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<!-- <version>3.8.0</version> -->
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
@@ -271,8 +271,8 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -295,12 +295,12 @@
|
||||
<profileActive>test</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test135</id>
|
||||
<properties>
|
||||
<profileActive>test135</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>test135</id>
|
||||
<properties>
|
||||
<profileActive>test135</profileActive>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
|
||||
@@ -12,14 +12,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.system.ApplicationPid;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
@EnableAsync
|
||||
@EnableRetry
|
||||
@EnableScheduling
|
||||
public class BoeServerAllApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -34,6 +34,8 @@ public class UrlSecurityFilterImpl implements IUrlSecurityFilter{
|
||||
noLoginUrls.add("/xboe/m/exam/alone-extend/save");
|
||||
|
||||
noLoginUrls.add("/xboe/m/course/manage/test");
|
||||
// 暂时取消验证 todo by yyk
|
||||
noLoginUrls.add("/xboe/m/course/manage/getCourseCoverUrl");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,11 +4,14 @@ import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.module.course.vo.StudyCourseVo;
|
||||
import com.xboe.module.course.vo.TeacherInfoVo;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.dict.entity.DictDto;
|
||||
import com.xboe.module.exam.entity.AloneExam;
|
||||
import com.xboe.module.exam.entity.ExamTest;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
@@ -18,16 +21,18 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ThirdApi {
|
||||
@@ -69,12 +74,15 @@ public class ThirdApi {
|
||||
@Value("${manageApi.editExam}")
|
||||
private String editExam;
|
||||
|
||||
@Value("${userBasic.getUserBasicInfo}")
|
||||
private String getUserBasicInfo;
|
||||
@Value("${userBasic.getUserIdByWorkNum}")
|
||||
private String getUserIdByWorkNum;
|
||||
|
||||
@Value("${coursesuilt.syncExamScoreToCourseSuite}")
|
||||
private String syncExamScoreToCourseSuite;
|
||||
|
||||
//获取例外人员的id
|
||||
public List<String> getUserId(){
|
||||
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
|
||||
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=136&type=1").execute() //prod 316
|
||||
.body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
log.info("正在获取例外人员工号 responseBody = " + responseBody);
|
||||
try {
|
||||
@@ -224,6 +232,7 @@ public class ThirdApi {
|
||||
Opt.ofBlankAble(resp).map(t -> JSONUtil.toBean(t, DynamicBean.class).success());
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJjb21wYW55Q29kZSI6IkMwMDEiLCJ1SWQiOiI5NjUzNDIwMjc0OTc2MDcxNjgiLCJjb21wYW55SWQiOiIxMDQxNjczOTc3Mzc5OTQ2NDk2IiwibG9naW5JZCI6IjE2ODg0NDg5MjIwNzY0OTE3NzgiLCJpc3MiOiJodHRwOi8vdS5ib2UuY29tIiwiR2l2ZW5OYW1lIjoiYm9ldSIsImV4cCI6MTY5MTM5OTc2NzU1OCwidXNlck5hbWUiOiLmnY7njonlhrAiLCJ1c2VySWQiOiI2QjA0OUZBRi1DMzE0LTdDQ0YtMEQyOC0wRDIzRjRDNDI1MzEifQ==.8b52dcf4d48a790ed258b9ca2b279bb269f5301722095382fbd352705b51c893";
|
||||
String resp = Optional.ofNullable(HttpRequest.post("https://u-pre.boe.com/statApi/xboe/m/stat/userdynamic/list").body(JSONUtil.toJsonStr(UserdynamicParam.builder().
|
||||
@@ -235,9 +244,42 @@ public class ThirdApi {
|
||||
List<UserDynamic> list = a.getResult().getList();
|
||||
System.out.println(" list = " +list.size());
|
||||
System.out.println(" list = " +list);
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String, String> getUserIdByWorkNum(String token, List<String> workNumList) {
|
||||
// 将workNum列表转换为逗号分隔的字符串
|
||||
String workNums = workNumList.stream()
|
||||
.collect(Collectors.joining(","));
|
||||
// 构建请求URL
|
||||
String url = getUserIdByWorkNum+"?workNums=" + workNums;
|
||||
String respStr = Optional.ofNullable(
|
||||
HttpRequest.get(url)
|
||||
.header("token", token)
|
||||
.execute().body()
|
||||
).orElseThrow(() -> new RuntimeException("Token校验失败"));
|
||||
// 解析JSON字符串为HashMap
|
||||
GetUserIdByWorkNumResult getUserIdByWorkNumResult = JSONUtil.parseObj(respStr).toBean(GetUserIdByWorkNumResult.class);
|
||||
HashMap<String, String> result = getUserIdByWorkNumResult.getResult();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void syncExamScoreToCourseSuite(AloneExam aloneExam,String token) {
|
||||
Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
|
||||
.create();
|
||||
|
||||
String json = gson.toJson(aloneExam);
|
||||
String resp = HttpRequest.post(syncExamScoreToCourseSuite)
|
||||
.body(json)
|
||||
.header("token", token)
|
||||
.execute()
|
||||
.body();
|
||||
|
||||
if (StringUtils.isBlank(resp)){
|
||||
return;
|
||||
}
|
||||
JSONUtil.toBean(resp, SyncExamScoreBean.class).success();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,32 +316,4 @@ public class ThirdApi {
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 虽然当前已存在接口查询用户基本信息,目前仅仅包括用户名、工号、用户ID
|
||||
*/
|
||||
public List<UserBasicInfo> getUserBasicInfoByUserId(List<String> userIds, HttpServletRequest request) {
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("x-access-token");
|
||||
}
|
||||
|
||||
// 将userIds列表转换为逗号分隔的字符串
|
||||
String userIdsStr = userIds.stream()
|
||||
.collect(Collectors.joining(","));
|
||||
String url = getUserBasicInfo +"?userIds=" + userIdsStr;
|
||||
|
||||
String respStr = Optional.ofNullable(HttpRequest
|
||||
.get(url)
|
||||
.header("token", token)
|
||||
.execute().body()).orElseThrow(() -> new RuntimeException("用户中心用户数据获取失败"));
|
||||
|
||||
UserBasicInfoResult userBasicInfoResult = JSONUtil.parseObj(respStr).toBean(UserBasicInfoResult.class);
|
||||
List<UserBasicInfo> basicInfos = userBasicInfoResult.getResult();
|
||||
return basicInfos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CheckExamBandingBean {
|
||||
|
||||
private boolean show;
|
||||
private String version;
|
||||
private int code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
private boolean success;
|
||||
|
||||
public CheckExamBandingBean success() {
|
||||
if (this.code!=200) {
|
||||
log.error("获取绑定关系失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.exam.dto.ExamTestDto;
|
||||
import com.xboe.module.exam.entity.AloneExam;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
public class GetExamSyncResult {
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<AloneExam> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public GetExamSyncResult success() {
|
||||
if (this.status != 200) {
|
||||
log.error("同步考试记录失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -8,26 +8,31 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Auto-generated: 2022-12-10 14:3:18
|
||||
*
|
||||
* @author bejson.com (i@bejson.com)
|
||||
* @website http://www.bejson.com/java2pojo/
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserBasicInfoResult {
|
||||
public class GetUserIdByWorkNumResult {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<UserBasicInfo> result;
|
||||
private HashMap<String,String> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public UserBasicInfoResult success() {
|
||||
public GetUserIdByWorkNumResult success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取用户基本信息失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
log.error("获取用户ID列表失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonElement;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonPrimitive;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonSerializationContext;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonSerializer;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class LocalDateTimeSerializer implements JsonSerializer<LocalDateTime> {
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
return new JsonPrimitive(formatter.format(src));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SyncExamScoreBean {
|
||||
|
||||
private boolean show;
|
||||
private String version;
|
||||
private int code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
private boolean success;
|
||||
|
||||
public SyncExamScoreBean success() {
|
||||
if (this.code!=200) {
|
||||
log.error("同步考试到boe库失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBasicInfo {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名。
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 工号。
|
||||
*/
|
||||
private String workNum;
|
||||
|
||||
}
|
||||
@@ -134,8 +134,6 @@ public interface CacheName {
|
||||
* */
|
||||
String KEY_DICT="dict";
|
||||
|
||||
String STUDY_KEY = "StudyKey:";
|
||||
|
||||
/**
|
||||
* 季度观看量排行key
|
||||
* */
|
||||
@@ -155,4 +153,6 @@ public interface CacheName {
|
||||
* 总点赞排行key
|
||||
* */
|
||||
String CASE_RANK_PRAISE_ALL="case:rank:praise:all";
|
||||
|
||||
String STUDY_KEY = "StudyKey:";
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.xboe.module.boecase.api;
|
||||
|
||||
import com.xboe.module.boecase.service.ICasesService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class CaseScheduledTasks {
|
||||
|
||||
@Resource
|
||||
private ICasesService casesService;
|
||||
|
||||
/**
|
||||
* 每月的第一天的1:00执行
|
||||
*/
|
||||
@Scheduled(cron = "0 0 1 1 * ?")
|
||||
public void refreshViewsRankOfMajor() {
|
||||
casesService.refreshViewsRankOfMajor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 季初第一天两点执行,cron表达式设置为每个季度的第一个月的第一天的特定时间。每个季度的第一个月是1月、4月、7月和10月:
|
||||
*/
|
||||
@Scheduled(cron = "0 0 2 1 1,4,7,10 ?")
|
||||
public void refreshLastQuarterStatistics() {
|
||||
casesService.refreshLastQuarterStatistics();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -686,7 +686,7 @@ public class CasesApi extends ApiBaseController {
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryPopularityOfMajor")
|
||||
public JsonResponse<List<Cases>> queryPopularityOfMajor(@RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam String majorId,
|
||||
@RequestParam Long majorId,
|
||||
@RequestParam LocalDateTime rankMonth) {
|
||||
String accountId = getCurrent().getAccountId();
|
||||
List<Cases> caseRankingVoList =casesService.queryPopularityOfMajor(pageSize,majorId,rankMonth,accountId);
|
||||
@@ -698,8 +698,8 @@ public class CasesApi extends ApiBaseController {
|
||||
* 所有上榜的的(专业ID-时间), 用于下拉框.优化可将majorName一并查询,返回为List<List<Entity>> todo by anyone
|
||||
*/
|
||||
@GetMapping("/queryAllTimePopularityOfMajor")
|
||||
public JsonResponse<Map<String, List<String>>> queryAllTimePopularityOfMajor() {
|
||||
Map<String, List<String>> time = casesService.queryAllTimePopularityOfMajor();
|
||||
public JsonResponse<Map<Long, List<String>>> queryAllTimePopularityOfMajor() {
|
||||
Map<Long, List<String>> time = casesService.queryAllTimePopularityOfMajor();
|
||||
return success(time);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,18 +15,17 @@ import java.util.stream.Collectors;
|
||||
@Repository
|
||||
@Slf4j
|
||||
public class CasesRankDao extends BaseDao<CasesRank> {
|
||||
/**
|
||||
* 获取类别榜记录,默认按上榜时间降序排列
|
||||
*/
|
||||
|
||||
public List<CasesRank> findViewsRankRecordByCaseId(String caseId) {
|
||||
String sql =
|
||||
"SELECT bdmt.name,bcvr.rise_rank_time,bcvr.rank,bcvr.major_id \n" +
|
||||
"FROM\n" +
|
||||
" boe_cases_rank bcvr\n" +
|
||||
"JOIN boe_dict_major_type bdmt \n" +
|
||||
" ON bdmt.code = bcvr.major_id \n" +
|
||||
" ON CAST(bdmt.code AS SIGNED) = bcvr.major_id \n" +
|
||||
"WHERE bcvr.case_id = ?1 AND bcvr.deleted=0 AND bdmt.deleted=0\n" +
|
||||
"ORDER BY bcvr.rise_rank_time DESC;";
|
||||
"ORDER BY bcvr.sys_update_time DESC \n" +
|
||||
"LIMIT 2;";
|
||||
|
||||
List<Object[]> list = this.sqlFindList(sql, caseId);
|
||||
|
||||
@@ -36,7 +35,7 @@ public class CasesRankDao extends BaseDao<CasesRank> {
|
||||
casesRank.setMajorName(o[0].toString());
|
||||
casesRank.setRiseRankTime(((Timestamp) o[1]).toLocalDateTime());
|
||||
casesRank.setRank(Integer.valueOf(o[2].toString()));
|
||||
casesRank.setMajorId(o[3].toString());
|
||||
casesRank.setMajorId(Long.valueOf(o[3].toString()));
|
||||
resultList.add(casesRank);
|
||||
}
|
||||
return resultList;
|
||||
@@ -64,7 +63,7 @@ public class CasesRankDao extends BaseDao<CasesRank> {
|
||||
}
|
||||
|
||||
|
||||
public List<HashMap<String, Object>> findPopularityOfMajor(Integer pageSize, LocalDateTime startTime, LocalDateTime endTime, String majorId) {
|
||||
public List<HashMap<String, Object>> findPopularityOfMajor(Integer pageSize, LocalDateTime startTime, LocalDateTime endTime, Long majorId) {
|
||||
|
||||
String sql =
|
||||
"SELECT bcr.case_id,bcr.rank\n" +
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CasesRank extends BaseEntity {
|
||||
* 专业ID
|
||||
*/
|
||||
@Column(name = "major_id")
|
||||
private String majorId;
|
||||
private Long majorId;
|
||||
|
||||
/**
|
||||
* 排名
|
||||
@@ -54,7 +54,7 @@ public class CasesRank extends BaseEntity {
|
||||
@Transient
|
||||
private String majorName;
|
||||
|
||||
public CasesRank(String majorId, LocalDateTime riseRankTime) {
|
||||
public CasesRank(Long majorId, LocalDateTime riseRankTime) {
|
||||
this.majorId = majorId;
|
||||
this.riseRankTime = riseRankTime;
|
||||
}
|
||||
|
||||
@@ -133,12 +133,12 @@ public interface ICasesService{
|
||||
|
||||
List<CaseRankingVo> queryRank(Integer pageSize, Integer rankType);
|
||||
|
||||
List<Cases> queryPopularityOfMajor(Integer pageSize, String majorId, LocalDateTime month, String accountId);
|
||||
List<Cases> queryPopularityOfMajor(Integer pageSize, Long majorId, LocalDateTime month, String accountId);
|
||||
|
||||
PageList<FavoriteCaseOfIndexVo> queryFavoriteCaseOfIndex(Integer pageIndex, Integer pageSize, String accountId);
|
||||
|
||||
PageList<CasesBrowsingHistoryVo> browsingHistory(Integer pageIndex, Integer pageSize, String accountId, HttpServletRequest request);
|
||||
|
||||
Map<String, List<String>> queryAllTimePopularityOfMajor();
|
||||
Map<Long, List<String>> queryAllTimePopularityOfMajor();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -416,36 +415,14 @@ public class CasesServiceImpl implements ICasesService {
|
||||
if (CollUtil.isEmpty(casesList)) {
|
||||
return casesList;
|
||||
}
|
||||
|
||||
//1.推荐案例数据处理
|
||||
recommendCasesDataHandle(casesList, accountId);
|
||||
//2.标签处理,添加作者标签和新的案例标签
|
||||
addAuthorTagAndCaseNewTag(casesList);
|
||||
//3.案例类型处理
|
||||
// majorTypeHandle(casesList);
|
||||
|
||||
return casesList;
|
||||
}
|
||||
|
||||
private void majorTypeHandle(List<Cases> casesList) {
|
||||
if (CollUtil.isNotEmpty(casesList)) {
|
||||
for (Cases c : casesList) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", c.getId()));
|
||||
if (caseId != null && !caseId.isEmpty()) {
|
||||
for (CasesMajorType cm : caseId) {
|
||||
stringBuffer.append(cm.getMajorId());
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
}
|
||||
if (stringBuffer.length() > 0) {
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
c.setMajorType(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void recommendCasesDataHandle(List<Cases> casesList, String accountId) {
|
||||
if (StrUtil.isNotBlank(accountId)) {
|
||||
List<String> caseIdList = casesList.stream().map(Cases::getId).collect(Collectors.toList());
|
||||
@@ -505,7 +482,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
|
||||
|
||||
caseList.forEach(e -> {
|
||||
// 获取浏览量上榜记录
|
||||
// 获取最新的两个浏览量上榜记录
|
||||
List<CasesRank> viewsRankRecords = casesRankDao.findViewsRankRecordByCaseId(e.getId());
|
||||
if (CollUtil.isNotEmpty(viewsRankRecords)) {
|
||||
// 拼接生成浏览量排行榜的标签
|
||||
@@ -531,11 +508,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
|
||||
// 拼接生成年度最佳标签
|
||||
if (e.getExcellent()!=null && e.getExcellent()) {
|
||||
if (e.getDraftingTime()!=null){
|
||||
e.setExcellentTag(e.getDraftingTime().format(DateTimeFormatter.ofPattern("yy年"))+"度最佳");
|
||||
} else {
|
||||
e.setExcellentTag(e.getSysCreateTime().format(DateTimeFormatter.ofPattern("yy年"))+"度最佳");
|
||||
}
|
||||
e.setExcellentTag(e.getExcellentTime().format(DateTimeFormatter.ofPattern("yy年"))+"度最佳");
|
||||
}
|
||||
|
||||
List<String> authorTags = new ArrayList<>();
|
||||
@@ -1190,7 +1163,6 @@ public class CasesServiceImpl implements ICasesService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void refreshViewsRankOfMajor(){
|
||||
log.info("开始执行每月案例浏览量相关定时任务");
|
||||
// 获取上个月的第一天的00:00
|
||||
// LocalDateTime firstDayOfLastMonth = LocalDateTime.now().minusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).toLocalDate().atStartOfDay();
|
||||
// 获取上个月的最后一天的23:59:59,将其设置为上榜时间。注意,定时统计任务是在本月月初执行的,而上榜时间是在上个月最后一天23:59:59
|
||||
@@ -1203,16 +1175,10 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
//获取案例当月排名
|
||||
// String sql =
|
||||
// "SELECT bc.id,bcmt.major_id,bc.views - COALESCE(bc.last_month_views, 0) AS increment\n" +
|
||||
// "FROM boe_cases bc\n" +
|
||||
// "JOIN boe_cases_major_type bcmt ON bcmt.case_id = bc.id and bc.deleted=0 and file_path is not null and file_path!='' and bc.views - COALESCE(bc.last_month_views, 0)!=0";
|
||||
|
||||
String sql =
|
||||
"SELECT bc.id,bcmt.major_id,bc.views AS increment\n" +
|
||||
"FROM boe_cases bc\n" +
|
||||
"JOIN boe_cases_major_type bcmt ON bcmt.case_id = bc.id and bc.deleted=0 and file_path is not null and file_path!='' and bc.views !=0 and bc.views is not null";
|
||||
|
||||
"SELECT bc.id,bcmt.major_id,bc.views - COALESCE(bc.last_month_views, 0) AS increment\n" +
|
||||
"FROM boe_cases bc\n" +
|
||||
"JOIN boe_cases_major_type bcmt ON bcmt.case_id = bc.id and bc.deleted=0 and file_path is not null and file_path!='' and bc.views - COALESCE(bc.last_month_views, 0)!=0";
|
||||
List<Object> caseListOfObject = casesDao.sqlFindList(sql);
|
||||
|
||||
// 转为casesRank
|
||||
@@ -1220,13 +1186,13 @@ public class CasesServiceImpl implements ICasesService {
|
||||
.map(o -> {
|
||||
CasesRank casesRank = new CasesRank();
|
||||
casesRank.setCaseId(Long.valueOf(Array.get(o, 0).toString()));
|
||||
casesRank.setMajorId(Array.get(o, 1).toString());
|
||||
casesRank.setMajorId(Long.valueOf(Array.get(o, 1).toString()));
|
||||
casesRank.setMonthlyIncrement(Integer.parseInt(Array.get(o, 2).toString()));
|
||||
casesRank.setRiseRankTime(lastDayOfLastMonth);
|
||||
return casesRank;
|
||||
}).collect(Collectors.toList());
|
||||
// 根据专业分类进行分组
|
||||
Map<String, List<CasesRank>> casesRankMap = casesRankList.stream().collect(Collectors.groupingBy(CasesRank::getMajorId));
|
||||
Map<Long, List<CasesRank>> casesRankMap = casesRankList.stream().collect(Collectors.groupingBy(CasesRank::getMajorId));
|
||||
|
||||
// 生成当前月不同分类的最新的浏览量排名
|
||||
ArrayList<CasesRank> lastMonthRank = new ArrayList<>();
|
||||
@@ -1243,18 +1209,15 @@ public class CasesServiceImpl implements ICasesService {
|
||||
|
||||
casesRankDao.saveList(lastMonthRank);
|
||||
// 重置上月观看量:last_month_views
|
||||
int i = casesDao.sqlUpdate("update boe_cases set last_month_views=views where deleted=0");
|
||||
log.info("每月案例浏览量相关定时任务执行完成,boe_cases更新数据量为条数为"+i);
|
||||
log.info("每月案例浏览量相关定时任务执行完成,boe_cases_rank添加数据量为条数为"+lastMonthRank.size());
|
||||
casesDao.sqlUpdate("update boe_cases set last_month_views=views where deleted=0");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void refreshLastQuarterStatistics() {
|
||||
log.info("开始执行每季案例相关定时任务");
|
||||
int i = casesDao.sqlUpdate("update boe_cases set last_quarter_views=views,last_quarter_praises=praises where deleted=0");
|
||||
log.info("每季案例相关定时任务执行完成,boe_cases更新数据量为条数为"+i);
|
||||
casesDao.sqlUpdate("update boe_cases set last_quarter_views=views where deleted=0");
|
||||
casesDao.sqlUpdate("update boe_cases set last_quarter_praise=praise where deleted=0");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1284,8 +1247,8 @@ public class CasesServiceImpl implements ICasesService {
|
||||
if (CollectionUtil.isNotEmpty(casesList)) {
|
||||
// 缓存不存在数据,数据库中不存在数据,重建缓存
|
||||
List<String> serializedCases = casesList.stream().map(item -> JSONUtil.toJsonStr(item)).collect(Collectors.toList());
|
||||
stringRedisTemplate.opsForList().rightPushAll(cacheKey, serializedCases);
|
||||
stringRedisTemplate.expire(cacheKey, 600, TimeUnit.SECONDS);
|
||||
// stringRedisTemplate.opsForList().rightPushAll(cacheKey, serializedCases);
|
||||
// stringRedisTemplate.expire(cacheKey, 600, TimeUnit.SECONDS);
|
||||
return casesList;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
@@ -1294,7 +1257,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<Cases> queryPopularityOfMajor(Integer pageSize, String majorId, LocalDateTime month, String accountId) {
|
||||
public List<Cases> queryPopularityOfMajor(Integer pageSize, Long majorId, LocalDateTime month, String accountId) {
|
||||
if (pageSize == null) {
|
||||
pageSize = 10;
|
||||
}
|
||||
@@ -1305,18 +1268,15 @@ public class CasesServiceImpl implements ICasesService {
|
||||
List<HashMap<String, Object>> popularityOfMajor = casesRankDao.findPopularityOfMajor(pageSize, startTime, endTime, majorId);
|
||||
List<String> caseIdList = popularityOfMajor.stream().map(map -> map.get("caseId").toString()).collect(Collectors.toList());
|
||||
|
||||
Map<Object, Integer> collect = popularityOfMajor.stream().collect(Collectors.toMap(map -> map.get("caseId").toString(), map -> Integer.valueOf(map.get("rank").toString())));
|
||||
|
||||
QueryBuilder query = QueryBuilder.from(Cases.class);
|
||||
query.addFilter(FieldFilters.in("id",caseIdList));
|
||||
query.addFilter(FieldFilters.eq("deleted",false));
|
||||
|
||||
List<Cases> casesList = casesDao.findList(query.builder());
|
||||
//处理案例数据-通用操作
|
||||
casesList = caseListCommonHandle(casesList, accountId);
|
||||
//获取案例与排名的映射关系
|
||||
Map<Object, Integer> collect = popularityOfMajor.stream().collect(Collectors.toMap(map -> map.get("caseId").toString(), map -> Integer.valueOf(map.get("rank").toString())));
|
||||
|
||||
//排序榜单案例顺序
|
||||
Collections.sort(casesList, new Comparator<Cases>() {
|
||||
@Override
|
||||
public int compare(Cases c1, Cases c2) {
|
||||
@@ -1325,26 +1285,6 @@ public class CasesServiceImpl implements ICasesService {
|
||||
return Integer.compare(order1, order2);
|
||||
}
|
||||
});
|
||||
|
||||
casesList.forEach(cases -> {
|
||||
List<CaseViewRankingItemVo> viewRankTags = cases.getViewRankTags();
|
||||
|
||||
// 使用 Stream API 进行排序,保持其余元素的原始顺序
|
||||
List<CaseViewRankingItemVo> sortedList = viewRankTags.stream()
|
||||
.sorted((o1, o2) -> {
|
||||
// majorId 相等时放前面
|
||||
boolean o1Matches = o1.getMajorId().equals(majorId);
|
||||
boolean o2Matches = o2.getMajorId().equals(majorId);
|
||||
|
||||
if (o1Matches && !o2Matches) return -1; // o1是majorId, o2不是,o1排前
|
||||
if (!o1Matches && o2Matches) return 1; // o2是majorId, o1不是,o2排前
|
||||
return 0; // 如果两者都是或都不是majorId, 保持原有顺序
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 更新原列表
|
||||
cases.setViewRankTags(sortedList);
|
||||
});
|
||||
return casesList;
|
||||
}
|
||||
|
||||
@@ -1543,7 +1483,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> queryAllTimePopularityOfMajor() {
|
||||
public Map<Long, List<String>> queryAllTimePopularityOfMajor() {
|
||||
QueryBuilder builder = QueryBuilder.from(CasesRank.class);
|
||||
builder.addField("new CasesRank(majorId,riseRankTime)");
|
||||
builder.addFilter(FieldFilters.eq("deleted",false));
|
||||
@@ -1553,7 +1493,7 @@ public class CasesServiceImpl implements ICasesService {
|
||||
// 定义日期时间的格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yy-MM");
|
||||
|
||||
Map<String, List<String>> collect = list.stream().collect(Collectors.groupingBy
|
||||
Map<Long, List<String>> collect = list.stream().collect(Collectors.groupingBy
|
||||
(CasesRank::getMajorId, Collectors.mapping(casesRank -> casesRank.getRiseRankTime().format(formatter), Collectors.toList())));
|
||||
|
||||
return collect;
|
||||
|
||||
@@ -4,10 +4,13 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.log.AutoLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
@@ -74,22 +77,7 @@ public class CourseContentApi extends ApiBaseController{
|
||||
}
|
||||
return success(obj);
|
||||
}
|
||||
|
||||
@GetMapping("/exam/paper-content")
|
||||
@AutoLog(module = "试卷",action = "查看试卷试题",info = "查看当前试题内容")
|
||||
public JsonResponse<Object> paperContent(String courseExamId){
|
||||
if(StringUtil.isBlank(courseExamId)){
|
||||
return badRequest("缺少必要参数");
|
||||
}
|
||||
try {
|
||||
Object paperContentOfOnline = ccontentService.getPaperContentOfOnline(courseExamId);
|
||||
return success(paperContentOfOnline);
|
||||
} catch (Exception e) {
|
||||
log.error("查询试卷内容json错误",e);
|
||||
return error("查询失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取评估信息
|
||||
* @param ccid
|
||||
|
||||
@@ -7,9 +7,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -238,22 +236,46 @@ public class CourseFileApi extends ApiBaseController {
|
||||
|
||||
file.setDeleted(false);
|
||||
file.setDown(true);//默认允许下载
|
||||
file.setDuration(0);
|
||||
if (file.getResType() == null) {
|
||||
if ("mp4".indexOf(file.getFileType()) > -1) {
|
||||
file.setResType(10);//以后换成变量
|
||||
} else if ("jpg,png,gif".indexOf(file.getFileType()) > -1) {
|
||||
file.setResType(30);//以后换成变量
|
||||
if (file.getDuration()!=null){
|
||||
file.setDuration(file.getDuration()*60);
|
||||
}
|
||||
} else if ("mp3,wmv".indexOf(file.getFileType()) > -1) {
|
||||
file.setResType(20);//以后换成变量
|
||||
} else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType()) > -1) {
|
||||
file.setResType(40);//以后换成变量
|
||||
if (file.getDuration()!=null){
|
||||
file.setDuration(file.getDuration()*60);
|
||||
}
|
||||
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
||||
file.setResType(BoedxCourseFileType.Scrom.getValue());//scorm课件
|
||||
if (file.getDuration()!=null){
|
||||
file.setDuration(file.getDuration()*60);
|
||||
}
|
||||
} else {
|
||||
file.setResType(90);//以后换成变量
|
||||
}
|
||||
}
|
||||
if (file.getResType() != null) {
|
||||
if ("jpg,png,gif".indexOf(file.getFileType()) > -1) {
|
||||
if (file.getDuration() != null) {
|
||||
file.setDuration(file.getDuration() * 60);
|
||||
}
|
||||
}else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType()) > -1) {
|
||||
if (file.getDuration() != null) {
|
||||
file.setDuration(file.getDuration() * 60);
|
||||
}
|
||||
} else if (file.getFileType().equalsIgnoreCase("zip")) {
|
||||
file.setResType(BoedxCourseFileType.Scrom.getValue());//scorm课件
|
||||
if (file.getDuration() != null) {
|
||||
file.setDuration(file.getDuration() * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + file.getFilePath();
|
||||
if ("mp3,mp4".indexOf(file.getFileType()) > -1){
|
||||
log.info("上传 "+file.getFileType()+"文件:"+file.getFilePath());
|
||||
@@ -284,12 +306,12 @@ public class CourseFileApi extends ApiBaseController {
|
||||
}
|
||||
|
||||
try {
|
||||
Set<String> officeFileTypes = new HashSet<>(Arrays.asList("doc", "xls", "ppt", "docx", "xlsx", "pptx"));
|
||||
file.setFileType(file.getFileType());
|
||||
|
||||
if(file.getFileType().equalsIgnoreCase("pdf")) {
|
||||
file.setPreviewFilePath(file.getFilePath());
|
||||
file.setConverStatus(0);//代表不需要转化
|
||||
}else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType().toLowerCase()) > -1) {
|
||||
}else if (officeFileTypes.contains(file.getFileType().toLowerCase())) {
|
||||
file.setConverStatus(1);//转化中
|
||||
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
||||
//scorm包的内容
|
||||
|
||||
@@ -9,12 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
@@ -1164,5 +1159,11 @@ public class CourseManageApi extends ApiBaseController{
|
||||
return success(courses);
|
||||
}
|
||||
|
||||
@GetMapping("/getCourseCoverUrl")
|
||||
public JsonResponse<Map<String, String>> getCourseCoverUrl(@RequestParam String courseIds){
|
||||
Map<String, String> courseUrlMap = courseService.getCourseCoverUrl(courseIds);
|
||||
return success(courseUrlMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,51 +1,65 @@
|
||||
package com.xboe.module.course.api;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.UserBasicInfo;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.dto.CourseTeacherDto;
|
||||
import com.xboe.module.course.dto.RankingDto;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.course.vo.CourseStudyVo;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyHomeWork;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
import com.xboe.school.study.service.IStudyHomeWorkService;
|
||||
import com.xboe.school.study.service.IStudyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyHomeWork;
|
||||
import com.xboe.school.study.service.IStudyHomeWorkService;
|
||||
import com.xboe.school.study.service.IStudyService;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.dto.CourseTeacherDto;
|
||||
import com.xboe.module.course.dto.RankingDto;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
import com.xboe.module.course.vo.CourseStudyVo;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.service.IStudyCourseService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
/**
|
||||
* 门户课程的相关接口处理,主要是查询显示。只查询已发布的.
|
||||
@@ -60,19 +74,19 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
|
||||
@Resource
|
||||
private ICourseService courseService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ITeacherService teacherService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ICourseContentService contentService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ICourseSectionService sectionService;
|
||||
|
||||
@Resource
|
||||
private ICourseTeacherService courseTeacherService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IUserGroupService userGroupService;
|
||||
|
||||
@@ -110,9 +124,9 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
Map<String,Object> list=courseService.findImages(cids);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 人气榜
|
||||
* 人气榜
|
||||
* */
|
||||
@PostMapping("/ranking")
|
||||
public JsonResponse<List<RankingDto>> Ranking(Integer type,Integer time){
|
||||
@@ -138,7 +152,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return success(rankingDtos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询列表,数量,类型,最新,最热
|
||||
* @param num
|
||||
@@ -164,7 +178,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
dto.setDevice(device);
|
||||
try {
|
||||
|
||||
|
||||
List<Course> list=courseService.findList(num, dto);
|
||||
return success(list);
|
||||
}catch(Exception e) {
|
||||
@@ -172,10 +186,10 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return error("查询课程列表失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/pagelist-new")
|
||||
public JsonResponse<PageList<Course>> findNewPage(Pagination pager,CourseQueryDto dto){
|
||||
|
||||
|
||||
//只是查询已发布的
|
||||
|
||||
dto.setPublish(true);
|
||||
@@ -197,9 +211,9 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success(coursePageList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +224,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
*/
|
||||
@PostMapping("/pagelist")
|
||||
public JsonResponse<PageList<Course>> findPage(Pagination pager,CourseQueryDto dto){
|
||||
|
||||
|
||||
//只是查询已发布的
|
||||
|
||||
dto.setPublish(true);
|
||||
@@ -231,11 +245,11 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success(coursePageList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取详细信息
|
||||
* @param id
|
||||
@@ -246,19 +260,19 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
if(StringUtils.isBlank(id)) {
|
||||
return badRequest("参数错误,未指定课程");
|
||||
}
|
||||
|
||||
|
||||
//当前对于课程不增加浏览量,课程的意义并不是看过
|
||||
// if(addView==null) {
|
||||
// addView=false;
|
||||
// }
|
||||
|
||||
|
||||
Map<String,Object> rs=new HashMap<String,Object>();
|
||||
Course course=courseService.getAddView(id);
|
||||
if(course==null || course.getDeleted()){
|
||||
return badRequest("课程不存在或已被删除");
|
||||
}
|
||||
rs.put("course",course);
|
||||
|
||||
|
||||
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(id);
|
||||
if(crowd!=null && crowd) {
|
||||
rs.put("crowds",courseCrowdList);
|
||||
@@ -301,7 +315,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
List<CourseContent> cclist=contentService.getByCourseId(id);
|
||||
List<CourseSection> sectionlist=sectionService.getByCourseId(id);
|
||||
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(id);
|
||||
|
||||
|
||||
|
||||
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化
|
||||
for(CourseTeacher ct : teachers) {
|
||||
@@ -321,7 +335,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
rs.put("isCrowd",pass);
|
||||
@@ -330,7 +344,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
rs.put("teachers",teachers);
|
||||
//查询课程
|
||||
return success(rs);
|
||||
|
||||
|
||||
}
|
||||
private void getTeacherInfo(String token, List<String> teacherIds) {
|
||||
List<TeacherVo> teacherInfo = thirdApi.getTeacherInfo(teacherIds, token);
|
||||
@@ -349,17 +363,15 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
}
|
||||
//作业导出
|
||||
//作业导出
|
||||
@GetMapping("/export")
|
||||
public JsonResponse<String> export(String courseId,String courseName,String contentId,String name,Integer status,HttpServletRequest request) throws IOException {
|
||||
public JsonResponse<String> export(String courseId,String courseName,String contentId,String name,Integer status) throws IOException {
|
||||
Map<String, String>map=new HashMap<>();
|
||||
List<String> userIds = studyCourseDao.findList(FieldFilters.eq("courseId", courseId)).stream().filter(Objects::nonNull).map(StudyCourse::getAid).collect(Collectors.toList());
|
||||
if (userIds.isEmpty()){
|
||||
return error("查询不到用户");
|
||||
}
|
||||
|
||||
List <UserBasicInfo> userBasicInfoList =thirdApi.getUserBasicInfoByUserId(userIds,request);
|
||||
|
||||
List<User>user=studyService.getUserNo(userIds);
|
||||
try {//筛选出的人员
|
||||
List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status);
|
||||
if(list.isEmpty()){
|
||||
@@ -371,12 +383,12 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return success("暂无数据");
|
||||
}
|
||||
studyHomeWorks.forEach(e->{
|
||||
userBasicInfoList.forEach(u->{
|
||||
if(u.getUserId().equals(s.getAid())){
|
||||
user.forEach(u->{
|
||||
if(u.getId().equals(s.getAid())){
|
||||
//取后缀
|
||||
int dotIndex = e.getFilePath().lastIndexOf('.'); // 查找最后一个'.'的位置
|
||||
String extension = e.getFilePath().substring(dotIndex);
|
||||
map.put(u.getUserName()+"-"+u.getWorkNum()+extension,"/home/www/elearning/upload"+e.getFilePath());
|
||||
map.put(u.getName()+"-"+u.getUserNo()+extension,"/home/www/elearning/upload"+e.getFilePath());
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -396,6 +408,49 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
String zipFilePath = "/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip";
|
||||
createZipFile(map, zipFilePath);
|
||||
return success(zipFilePath);
|
||||
// 创建一个临时文件用于存储ZIP文件
|
||||
// File tempZipFile = new File("/home/www/elearning/upload/temp.zip");
|
||||
//
|
||||
// try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(tempZipFile))) {
|
||||
// for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
// File fileToZip = new File(e.getValue());
|
||||
// // 添加 ZIP 条目
|
||||
// ZipEntry entry = new ZipEntry(e.getKey());
|
||||
// entry.setSize(fileToZip.length());
|
||||
//
|
||||
// zos.putNextEntry(entry);
|
||||
//
|
||||
// try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
// byte[] buffer = new byte[4096];
|
||||
// int len;
|
||||
// while ((len = fis.read(buffer)) > 0) {
|
||||
// zos.write(buffer, 0, len);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// zos.closeEntry();
|
||||
// }
|
||||
// }
|
||||
// // 将临时文件移动到指定位置
|
||||
// Path source = tempZipFile.toPath();
|
||||
// //生成uuid
|
||||
//// String uuid = UUID.randomUUID().toString();
|
||||
// Path destination = Paths.get("/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip");
|
||||
//
|
||||
// // 确保目标目录存在
|
||||
// Files.createDirectories(destination.getParent());
|
||||
//
|
||||
// // 删除目标文件如果已存在
|
||||
// if (Files.exists(destination)) {
|
||||
// Files.delete(destination);
|
||||
// }
|
||||
//
|
||||
// // 移动文件
|
||||
// Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING);
|
||||
//
|
||||
// // 返回文件路径给前端
|
||||
// String filePath = destination.toAbsolutePath().toString();
|
||||
// return success(filePath);
|
||||
}
|
||||
private static void createZipFile(Map<String, String> map, String zipFilePath) throws IOException {
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
|
||||
@@ -467,7 +522,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
cv.setStatus(9);
|
||||
}
|
||||
}
|
||||
//音视频
|
||||
//音视频
|
||||
}else{
|
||||
cv.setStatus(study.getStatus());
|
||||
|
||||
|
||||
@@ -85,6 +85,6 @@ public interface ICourseContentService{
|
||||
|
||||
void updateProcessVideo(String contentId, String courseId, Float processVideo);
|
||||
|
||||
Object getPaperContentOfOnline(String courseExamId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -340,9 +340,8 @@ public interface ICourseService {
|
||||
* */
|
||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取课程封面
|
||||
* */
|
||||
Map<String, String> getCourseCoverUrl(String courseIds);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.core.cache.IXaskCache;
|
||||
import com.xboe.core.cache.XaskCacheProvider;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.*;
|
||||
import com.xboe.module.course.dao.CourseAssessDao;
|
||||
import com.xboe.module.course.dao.CourseContentDao;
|
||||
import com.xboe.module.course.dao.CourseExamDao;
|
||||
import com.xboe.module.course.dao.CourseHomeWorkDao;
|
||||
import com.xboe.module.course.dao.CourseSectionDao;
|
||||
import com.xboe.module.course.dto.CourseContentDto;
|
||||
import com.xboe.module.course.dto.SortItem;
|
||||
import com.xboe.module.course.entity.CourseAssess;
|
||||
@@ -19,21 +25,8 @@ import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseExam;
|
||||
import com.xboe.module.course.entity.CourseHomeWork;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.exam.dao.ExamPaperDao;
|
||||
import com.xboe.module.exam.vo.TestQuestionVo;
|
||||
import com.xboe.standard.enums.BoedxContentType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CourseContentServiceImpl implements ICourseContentService {
|
||||
|
||||
@@ -51,13 +44,7 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
|
||||
@Resource
|
||||
private CourseHomeWorkDao homeworkDao;
|
||||
|
||||
@Resource
|
||||
private CourseExamDao courseExamDao;
|
||||
|
||||
@Resource
|
||||
private ExamPaperDao examPaperDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -66,13 +53,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
CourseAssess assess=dto.getAssess();
|
||||
CourseExam exam=dto.getExam();
|
||||
CourseHomeWork homework=dto.getHomework();
|
||||
|
||||
if(StringUtils.isBlank(cc.getId())) {
|
||||
//新增的情况
|
||||
cc.setDeleted(false);
|
||||
if(cc.getDuration()==null) {
|
||||
if (cc.getDuration()==null){
|
||||
cc.setDuration(0);
|
||||
}
|
||||
if(exam!=null) {
|
||||
if (exam.getTestDuration()!=null) {
|
||||
cc.setDuration(exam.getTestDuration() * 60);
|
||||
}
|
||||
}
|
||||
//如果是没有目录的,并具是课程内容
|
||||
if(dto.getType()!=null && dto.getType()==10) {
|
||||
if(cc.getSortIndex()==1) {
|
||||
@@ -82,6 +73,11 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
}
|
||||
ccDao.save(cc);
|
||||
}else {
|
||||
if(exam!=null) {
|
||||
if (exam.getTestDuration()!=null) {
|
||||
cc.setDuration(exam.getTestDuration() * 60);
|
||||
}
|
||||
}
|
||||
ccDao.update(cc);
|
||||
cc.setSysVersion(ccDao.getVersion(cc.getId()));
|
||||
}
|
||||
@@ -91,9 +87,6 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
assessDao.saveOrUpdate(assess);
|
||||
}
|
||||
if(exam!=null) {
|
||||
if ((exam.getRandomMode() && !(exam.getQnum() > 0)) || (!exam.getRandomMode() && exam.getQnum() > 0)) {
|
||||
throw new RuntimeException("随机选题处参数错误");
|
||||
}
|
||||
exam.setCourseId(cc.getCourseId());
|
||||
exam.setContentId(cc.getId());
|
||||
if(exam.getPercentScore()==null) {
|
||||
@@ -204,68 +197,4 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
|
||||
return ccDao.sumDurationByCourseId(courseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPaperContentOfOnline(String courseExamId) {
|
||||
CourseExam courseExam = courseExamDao.findOne(FieldFilters.eq("id", courseExamId));
|
||||
if (courseExam == null) {
|
||||
throw new RuntimeException("课程考试不存在");
|
||||
}
|
||||
|
||||
String paperId = courseExam.getPaperId();
|
||||
Integer qnum = courseExam.getQnum();
|
||||
Boolean randomMode = courseExam.getRandomMode();
|
||||
|
||||
String paperJson = "";
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
// 判断试卷类型
|
||||
if (courseExam.getPaperType() == 1 && StringUtils.isNotBlank(courseExam.getPaperContent())) {
|
||||
paperJson = courseExam.getPaperContent();
|
||||
JsonNode rootNode = objectMapper.readTree(paperJson);
|
||||
JsonNode itemsNode = rootNode.path("items");
|
||||
List<JsonNode> itemsNodes = new ArrayList<>();
|
||||
itemsNode.forEach(itemsNodes::add);
|
||||
|
||||
if (randomMode && qnum != null && qnum > 0 && randomMode && qnum != null && qnum > 0 && itemsNodes.size() > qnum) {
|
||||
Collections.shuffle(itemsNodes);
|
||||
itemsNodes = itemsNodes.subList(0, qnum);
|
||||
}
|
||||
return itemsNodes;
|
||||
} else if (courseExam.getPaperType() == 2) {
|
||||
IXaskCache cache = XaskCacheProvider.getCache();
|
||||
String cacheKey = "course:exam:" + courseExamId + ":" + paperId;
|
||||
String cacheData = cache.getCacheObject(cacheKey);
|
||||
|
||||
if (StringUtils.isBlank(cacheData)) {
|
||||
paperJson = (String) examPaperDao.findField("paperContent", FieldFilters.eq("id", paperId));
|
||||
cache.setCacheObject(cacheKey, paperJson, 5, TimeUnit.HOURS);
|
||||
} else {
|
||||
paperJson = cacheData;
|
||||
}
|
||||
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
List<TestQuestionVo> eqVoList = objectMapper.readValue(paperJson, new TypeReference<List<TestQuestionVo>>() {
|
||||
});
|
||||
|
||||
if (randomMode && qnum != null && qnum > 0 && eqVoList.size() > qnum) {
|
||||
Collections.shuffle(eqVoList);
|
||||
eqVoList = eqVoList.subList(0, qnum);
|
||||
}
|
||||
return eqVoList;
|
||||
}
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("JSON处理错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(paperJson)) {
|
||||
throw new RuntimeException("此考试无试卷内容,考试已经过期或试卷已被删除");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"rt.course_id\n" +
|
||||
"FROM\n" +
|
||||
"boe_new.student s INNER JOIN boe_new.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
|
||||
"boe.student s INNER JOIN boe.router_task rt on s.pid=rt.router_id inner join boe_course c on c.id=rt.course_id\n" +
|
||||
"\n" +
|
||||
"WHERE\n" +
|
||||
"\n" +
|
||||
@@ -504,7 +504,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"pt.course_id\n" +
|
||||
"FROM\n" +
|
||||
"boe_new.student s INNER JOIN boe_new.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
|
||||
"boe.student s INNER JOIN boe.project_task pt on s.pid=pt.project_id inner join boe_course c on c.id=pt.course_id\n" +
|
||||
"\n" +
|
||||
"WHERE\n" +
|
||||
"\n" +
|
||||
@@ -561,8 +561,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
String sql = "SELECT DISTINCT\n" +
|
||||
"\tc.id \n" +
|
||||
"FROM\n" +
|
||||
"\tboe_new.student s\n" +
|
||||
"\tINNER JOIN boe_new.grow_task gt ON s.pid = gt.grow_id\n" +
|
||||
"\tboe.student s\n" +
|
||||
"\tINNER JOIN boe.grow_task gt ON s.pid = gt.grow_id\n" +
|
||||
"\tINNER JOIN boe_course c ON gt.course_id = c.id \n" +
|
||||
"WHERE\n" +
|
||||
"\ts.type = 14 \n" +
|
||||
@@ -1979,5 +1979,16 @@ public class CourseServiceImpl implements ICourseService {
|
||||
return courseDao.findListByHql("Select new Course(id,studys,score) from Course where id in(?1)", ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getCourseCoverUrl(String courseIds) {
|
||||
List<String> courseIdList = Arrays.asList(courseIds.split(","));
|
||||
List<Course> courseList = courseDao.findList(FieldFilters.in("id", courseIdList));
|
||||
Map<String, String> coverUrlMap = courseList.stream()
|
||||
.filter(course -> StringUtils.isNotBlank(course.getCoverImg()))
|
||||
.collect(Collectors.toMap(Course::getId, Course::getCoverImg));
|
||||
|
||||
return coverUrlMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.module.exam.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@@ -14,15 +15,12 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.module.exam.dto.SaveExamScoreDto;
|
||||
import com.xboe.module.exam.entity.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -41,9 +39,6 @@ import com.xboe.core.cache.IXaskCache;
|
||||
import com.xboe.core.cache.XaskCacheProvider;
|
||||
import com.xboe.core.exception.XaskException;
|
||||
import com.xboe.module.exam.dto.AloneExamExportDto;
|
||||
import com.xboe.module.exam.entity.AloneExam;
|
||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||
import com.xboe.module.exam.entity.ExamTest;
|
||||
import com.xboe.module.exam.service.IAloneExamService;
|
||||
import com.xboe.module.exam.service.IExamPaperService;
|
||||
import com.xboe.module.exam.service.IExamTestService;
|
||||
@@ -553,6 +548,7 @@ public class AloneExamApi extends ApiBaseController {
|
||||
//转化成百分数
|
||||
//answer.setScore(this.calculateScore(detail));
|
||||
service.submit(answer,scoreType);
|
||||
service.syncExamScoreToCourseSuite(answer, request);
|
||||
return success(map);
|
||||
} catch (Exception e) {
|
||||
log.error("提交答卷错误", e);
|
||||
@@ -707,4 +703,19 @@ public class AloneExamApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* @param saveExamScoreDtoList
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/examScoreBatchAdd")
|
||||
public JsonResponse examScoreBatchAdd(HttpServletRequest request, @RequestBody List<SaveExamScoreDto> saveExamScoreDtoList){
|
||||
service.examScoreBatchAdd(request, saveExamScoreDtoList);
|
||||
return success("导入成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
//从第二行开始获取数据
|
||||
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
||||
QuestionDto questionDto = new QuestionDto();
|
||||
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)") && !sheetAt.getRow(1).getCell(0).getStringCellValue().equals("")){
|
||||
if(sheetAt.getRow(1).getCell(1).getStringCellValue().equals("标题(*)")){
|
||||
row = sheetAt.getRow(1);
|
||||
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||
//获取每一行
|
||||
@@ -190,56 +190,45 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}
|
||||
Cell cell = row1.getCell(3);
|
||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}
|
||||
Cell cell = row1.getCell(4);
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||
|
||||
//单选
|
||||
if (!cell.getStringCellValue().contains(",")){
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examQuestion.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=6;j<=12;j++) {
|
||||
for (int j=7;j<=13;j++) {
|
||||
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
// 截取表头
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
} else {
|
||||
examOption.setIsAnswer(false);
|
||||
}
|
||||
if (examOption.getIsAnswer()) {
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
}
|
||||
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
@@ -269,19 +258,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=6;j<=12;j++){
|
||||
for (int j=7;j<=13;j++){
|
||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||
ExamOption examOption=new ExamOption();
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
@@ -312,56 +301,45 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
if(row1.getCell(2).getStringCellValue().equals("中")){
|
||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
} else if(row1.getCell(2).getStringCellValue().equals("易")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}else if(row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}
|
||||
Cell cell = row1.getCell(3);
|
||||
if(row1.getCell(3).getStringCellValue().equals("难")){
|
||||
examQuestion.setDifficulty(3f);
|
||||
}
|
||||
if(row1.getCell(3).getStringCellValue().equals("低")){
|
||||
examQuestion.setDifficulty(1f);
|
||||
}
|
||||
Cell cell = row1.getCell(4);
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||
|
||||
//单选
|
||||
if (!cell.getStringCellValue().contains(",")){
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examQuestion.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
examQuestion.setDefaultScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=6;j<=12;j++) {
|
||||
for (int j=7;j<=13;j++) {
|
||||
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
// 截取表头
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
} else {
|
||||
examOption.setIsAnswer(false);
|
||||
}
|
||||
if (examOption.getIsAnswer()) {
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).getStringCellValue()));
|
||||
}
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
}
|
||||
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
@@ -391,19 +369,19 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=6;j<=13;j++){
|
||||
for (int j=7;j<=13;j++){
|
||||
if(row1.getCell(j)!=null && StringUtil.isNotBlank(row1.getCell(j).getStringCellValue())){
|
||||
ExamOption examOption=new ExamOption();
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
examOption.setContent(row1.getCell(j).getStringCellValue());
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(strings[j-6]));
|
||||
examOption.setScore(Float.valueOf(strings[j-7]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
@@ -435,30 +413,27 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
ExamQuestion examQuestion1 = new ExamQuestion();
|
||||
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
||||
examQuestion1.setType(3);
|
||||
System.out.println("1+++++++"+row2.getCell(1));
|
||||
if(row2.getCell(1).getStringCellValue().equals("中")){
|
||||
examQuestion1.setKnowledge(row2.getCell(1).getStringCellValue());
|
||||
if(row2.getCell(2).getStringCellValue().equals("中")){
|
||||
examQuestion1.setDifficulty(2f);
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("难")){
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("难")){
|
||||
examQuestion1.setDifficulty(3f);
|
||||
} else if(row2.getCell(1).getStringCellValue().equals("易")){
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("易")){
|
||||
examQuestion1.setDifficulty(1f);
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("")){
|
||||
examQuestion1.setDifficulty(null);
|
||||
}
|
||||
Cell cell1 = row2.getCell(2);
|
||||
Cell cell1 = row2.getCell(3);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
if (row2.getCell(2).getStringCellValue().isEmpty()){
|
||||
examQuestion1.setDefaultScore(null);
|
||||
}else {
|
||||
examQuestion1.setDefaultScore(Float.valueOf(row2.getCell(2).getStringCellValue()));
|
||||
}
|
||||
if(row2.getCell(3)!=null) {
|
||||
examQuestion1.setAnalysis(row2.getCell(3).getStringCellValue());
|
||||
examQuestion1.setDefaultScore(Float.valueOf(cell1.getStringCellValue()));
|
||||
|
||||
if(row2.getCell(4)!=null) {
|
||||
examQuestion1.setAnalysis(row2.getCell(4).getStringCellValue());
|
||||
}else {
|
||||
examQuestion1.setAnalysis("");
|
||||
}
|
||||
|
||||
String cvalue=row2.getCell(4).getStringCellValue();
|
||||
String cvalue=row2.getCell(5).getStringCellValue();
|
||||
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
||||
if(examQuestion1!=null){
|
||||
examQuestions2.add(examQuestion1);
|
||||
|
||||
@@ -3,14 +3,12 @@ package com.xboe.module.exam.api;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.hibernate.exception.ConstraintViolationException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
@@ -23,6 +21,8 @@ import com.xboe.module.exam.service.IExamTestService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试
|
||||
* */
|
||||
@@ -33,8 +33,10 @@ public class ExamTestApi extends ApiBaseController {
|
||||
|
||||
@Resource
|
||||
private IExamTestService examTestService;
|
||||
|
||||
@Resource
|
||||
ThirdApi thirdApi;
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
/**
|
||||
*查询考试,分页,搜索,资源归属,状态
|
||||
**/
|
||||
@@ -133,10 +135,16 @@ public class ExamTestApi extends ApiBaseController {
|
||||
* */
|
||||
@GetMapping("/delete")
|
||||
@AutoLog(module = "考试",action = "删除考试",info = "删除考试")
|
||||
public JsonResponse<Boolean> delete(String id){
|
||||
public JsonResponse<Boolean> delete(String id, HttpServletRequest request){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("缺少必要参数");
|
||||
}
|
||||
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtil.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
|
||||
try {
|
||||
examTestService.delete(id);
|
||||
return success(true);
|
||||
@@ -183,4 +191,21 @@ public class ExamTestApi extends ApiBaseController {
|
||||
return error("上下级失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 引用关系移除
|
||||
* */
|
||||
@PostMapping("/removeRel")
|
||||
public JsonResponse<Boolean> removeRel(@RequestParam List<String> ids){
|
||||
if(CollectionUtil.isEmpty(ids)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
examTestService.removeRel(ids);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("引用关系移除异常",e);
|
||||
return error("引用关系移除异常",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.xboe.module.exam.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 单独的考虑答卷信息
|
||||
*/
|
||||
@Data
|
||||
public class SaveExamScoreDto {
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 考试id
|
||||
*/
|
||||
private String testId;
|
||||
|
||||
// /**
|
||||
// * 考试名称
|
||||
// */
|
||||
// private String testName;
|
||||
|
||||
// /**
|
||||
// * 考试时长 分钟
|
||||
// */
|
||||
// private Integer testDuration;
|
||||
|
||||
/**
|
||||
* 试题排列 1试题乱序,2选项乱序,3全部乱序
|
||||
*/
|
||||
private Integer arrange;
|
||||
|
||||
// /**
|
||||
// * 及格线
|
||||
// */
|
||||
// private Integer passLine;
|
||||
|
||||
/**
|
||||
* 账户的代码,用于区别于同姓名的用户
|
||||
*/
|
||||
private String workNum;
|
||||
|
||||
|
||||
/**
|
||||
* 独立考试任务的id
|
||||
*/
|
||||
private String aloneId;
|
||||
|
||||
/**
|
||||
* 试卷总分
|
||||
*/
|
||||
@Column(name = "total_score")
|
||||
private Float totalScore;
|
||||
|
||||
|
||||
// /**
|
||||
// * 答卷内容
|
||||
// */
|
||||
// @Column(name = "answer_json", columnDefinition = "mediumtext")
|
||||
// private String answerJson;
|
||||
|
||||
// todo by yyk 2024-05-17 14:10:32 确定分数
|
||||
/**
|
||||
* 用户的实际得分
|
||||
*/
|
||||
private Float realScore;
|
||||
|
||||
// /**
|
||||
// * 用时秒
|
||||
// */
|
||||
// private Integer useMinute;
|
||||
|
||||
|
||||
/**
|
||||
* 最终成绩,如果是百分制,用户的实际得分会换算为百分制
|
||||
*/
|
||||
private Float score;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
// /**
|
||||
// * 完成状态
|
||||
// */
|
||||
// private Integer status;
|
||||
|
||||
// /**
|
||||
// * 考试次数
|
||||
// */
|
||||
// private Integer times;
|
||||
|
||||
|
||||
// /**
|
||||
// * 记录最后的操作时间
|
||||
// */
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
|
||||
// private LocalDateTime lastTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public class AloneExam extends IdBaseEntity {
|
||||
private String ucode;
|
||||
|
||||
/**关联类型*/
|
||||
/**关联类型 新增关联类型14,代表成长路径图*/
|
||||
@Column(name = "ref_type", length = 30)
|
||||
private String refType;
|
||||
|
||||
|
||||
@@ -178,4 +178,14 @@ public class ExamTest extends BaseEntity {
|
||||
|
||||
@Transient
|
||||
private String paperName;
|
||||
|
||||
/** 关联类型,1、项目 2、学习路径图 3、面授课 14、成长路径图 */
|
||||
@Column(name = "ref_type")
|
||||
private Integer refType;
|
||||
|
||||
@Column(name = "ref_id")
|
||||
private String refId;
|
||||
|
||||
@Column(name = "ref_status")
|
||||
private Integer refStatus;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import java.util.Map;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.module.exam.dto.SaveExamScoreDto;
|
||||
import com.xboe.module.exam.dto.TestUserDto;
|
||||
import com.xboe.module.exam.dto.TestUserQuery;
|
||||
import com.xboe.module.exam.entity.AloneExam;
|
||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 独立考试的处理。此信息无删除操作,更新也只是更新answerJson字段
|
||||
@@ -92,10 +94,18 @@ public interface IAloneExamService {
|
||||
|
||||
/**
|
||||
* 提交考试
|
||||
*
|
||||
* @param aea
|
||||
*/
|
||||
void submit(AloneExamAnswer aea,Integer scoreType);
|
||||
|
||||
void submit(AloneExamAnswer aea, Integer scoreType);
|
||||
|
||||
/**
|
||||
* 同步考试成绩
|
||||
* @param aea
|
||||
* @param request
|
||||
*/
|
||||
void syncExamScoreToCourseSuite(AloneExamAnswer aea, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 更新答案
|
||||
* @param id
|
||||
@@ -156,5 +166,7 @@ public interface IAloneExamService {
|
||||
* @throws Exception
|
||||
*/
|
||||
PageList<TestUserDto> findTestUserAnswers(TestUserQuery params) throws Exception;
|
||||
|
||||
|
||||
void examScoreBatchAdd(HttpServletRequest request, List<SaveExamScoreDto> saveExamScoreDtoList);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.xboe.module.exam.service;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.module.exam.entity.ExamTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IExamTestService {
|
||||
/**
|
||||
* 分页查,状态,搜索,资源归属
|
||||
@@ -51,4 +53,5 @@ public interface IExamTestService {
|
||||
* */
|
||||
void enabled(String id,Boolean enabled);
|
||||
|
||||
void removeRel(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
package com.xboe.module.exam.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.module.exam.dao.ExamTestDao;
|
||||
import com.xboe.module.exam.dto.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
@@ -20,31 +30,40 @@ import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
||||
import com.xboe.module.exam.dao.AloneExamDao;
|
||||
import com.xboe.module.exam.dto.TestUserAnswerDto;
|
||||
import com.xboe.module.exam.dto.TestUserDto;
|
||||
import com.xboe.module.exam.dto.TestUserQuery;
|
||||
import com.xboe.module.exam.entity.AloneExam;
|
||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||
import com.xboe.module.exam.entity.ExamTest;
|
||||
import com.xboe.module.exam.service.IAloneExamService;
|
||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
@Service
|
||||
public class AloneExamServiceImpl implements IAloneExamService{
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AloneExamServiceImpl.class);
|
||||
@Resource
|
||||
AloneExamAnswerDao dao;
|
||||
|
||||
@Resource
|
||||
AloneExamDao aeDao;
|
||||
|
||||
@Autowired
|
||||
private ExamTestDao examTestDao;
|
||||
|
||||
@Autowired
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(AloneExamAnswer aea){
|
||||
dao.save(aea);
|
||||
AloneExam ae=aeDao.findOne(FieldFilters.eq("aid", aea.getAid()),FieldFilters.eq("testId", aea.getTestId()));
|
||||
int currentTimes = ae.getTimes() != null ? ae.getTimes() : 0;
|
||||
//更新状态
|
||||
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
||||
.addUpdateField("status", AloneExam.STATUS_NORMAL)
|
||||
.addUpdateField("times", currentTimes+1)
|
||||
.addFilter(FieldFilters.eq("aid", aea.getAid()))
|
||||
.addFilter(FieldFilters.eq("testId", aea.getTestId()))
|
||||
.addFilter(FieldFilters.eq("status",AloneExam.STATUS_NONE))
|
||||
@@ -53,8 +72,8 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void submit(AloneExamAnswer aea,Integer scoreType){
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void submit(AloneExamAnswer aea, Integer scoreType){
|
||||
//dao.update(aea);
|
||||
aea.setStatus(AloneExamAnswer.STATUS_FINISH);
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
@@ -102,6 +121,27 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
||||
// }
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void syncExamScoreToCourseSuite(AloneExamAnswer aea, HttpServletRequest request) {
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
|
||||
String finalToken = token;
|
||||
CompletableFuture.supplyAsync(() -> {
|
||||
AloneExam aloneExam = aeDao.findOne(FieldFilters.eq("aid", aea.getAid()), FieldFilters.eq("testId", aea.getTestId()));
|
||||
if (aloneExam.getRefType().equals("14")){
|
||||
thirdApi.syncExamScoreToCourseSuite(aloneExam, finalToken);
|
||||
}
|
||||
return "完成结果";
|
||||
}).exceptionally(ex -> {
|
||||
log.error("异步操作中发生错误: " + ex.getMessage(), ex);
|
||||
return "发生错误";
|
||||
}).thenAccept(result -> {
|
||||
log.info("同步考试成绩到课程项目完成:" + result);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -142,9 +182,6 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
||||
if(StringUtils.isNotBlank(aea.getTestId())) {
|
||||
query.addFilter(FieldFilters.eq("testId",aea.getTestId()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(aea.getTestName())) {
|
||||
query.addFilter(FieldFilters.eq("testName",aea.getTestName()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(aea.getAid())) {
|
||||
query.addFilter(FieldFilters.eq("aid",aea.getAid()));
|
||||
}
|
||||
@@ -427,4 +464,86 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
||||
rs.setPageSize(params.getPageSize());
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
|
||||
@Override
|
||||
public void examScoreBatchAdd(HttpServletRequest request, List<SaveExamScoreDto> saveExamScoreDtoList) {
|
||||
List<String> workNumList = saveExamScoreDtoList.stream().map(SaveExamScoreDto::getWorkNum).collect(Collectors.toList());
|
||||
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
HashMap<String, String> userIdAndWorkNumMap = thirdApi.getUserIdByWorkNum(token, workNumList);
|
||||
|
||||
saveExamScoreDtoList.forEach(examScoreDto -> {
|
||||
TransactionStatus status = null; // 事务状态
|
||||
|
||||
try {
|
||||
// 获取事务定义
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
// 设置事务隔离级别
|
||||
def.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_READ_COMMITTED);
|
||||
// 设置事务传播行为
|
||||
def.setPropagationBehavior(DefaultTransactionDefinition.PROPAGATION_REQUIRED);
|
||||
// 获取事务状态
|
||||
status = transactionManager.getTransaction(def);
|
||||
|
||||
AloneExamAnswer aloneExamAnswer = new AloneExamAnswer();
|
||||
BeanUtils.copyProperties(examScoreDto, aloneExamAnswer);
|
||||
|
||||
String userId = userIdAndWorkNumMap.get(examScoreDto.getWorkNum());
|
||||
aloneExamAnswer.setAid(userId);
|
||||
aloneExamAnswer.setName(examScoreDto.getUserName());
|
||||
aloneExamAnswer.setUcode(examScoreDto.getWorkNum());
|
||||
aloneExamAnswer.setStatus(AloneExamAnswer.STATUS_FINISH);
|
||||
// aloneExamAnswer.setUseSecond(examScoreDto.getUseMinute()*60);
|
||||
|
||||
ExamTest examTest = examTestDao.get(examScoreDto.getTestId());
|
||||
aloneExamAnswer.setPassLine(examTest.getPassLine());
|
||||
aloneExamAnswer.setArrange(examTest.getArrange());
|
||||
aloneExamAnswer.setTestDuration(examTest.getTestDuration());
|
||||
|
||||
// 获取考试任务ID
|
||||
AloneExam aloneExam=aeDao.findOne(FieldFilters.eq("aid", userId),FieldFilters.eq("testId", examScoreDto.getTestId()));
|
||||
aloneExamAnswer.setAloneId(aloneExam.getId());
|
||||
// 添加答卷
|
||||
dao.save(aloneExamAnswer);
|
||||
|
||||
// 更新状态,状态是未完成的,这里会有问题
|
||||
int currentTimes = aloneExam.getTimes() != null ? aloneExam.getTimes() : 0;
|
||||
if(examTest.getScoringType()!=null && examTest.getScoringType()==2) {
|
||||
//最后一次的分数为准
|
||||
aeDao.update(UpdateBuilder.from(AloneExam.class)
|
||||
.addUpdateField("status", AloneExam.STATUS_FINISH)
|
||||
.addUpdateField("score", examScoreDto.getScore())
|
||||
.addUpdateField("times", currentTimes+1)
|
||||
.addFilter(FieldFilters.eq("aid", userId))
|
||||
.addFilter(FieldFilters.eq("testId", examScoreDto.getTestId()))
|
||||
.builder());
|
||||
} else {
|
||||
if (aloneExam.getStatus() == AloneExam.STATUS_FINISH) {
|
||||
if (aloneExam.getScore() < examScoreDto.getScore()) {
|
||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
||||
}
|
||||
} else {
|
||||
aeDao.updateMultiFieldById(aloneExam.getId(), UpdateBuilder.create("status", AloneExam.STATUS_FINISH), UpdateBuilder.create("score", examScoreDto.getScore()), UpdateBuilder.create("times", currentTimes+1));
|
||||
}
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
transactionManager.commit(status);
|
||||
} catch (Exception e) {
|
||||
// 如果发生异常,回滚事务
|
||||
if (status != null && !status.isCompleted()) {
|
||||
transactionManager.rollback(status);
|
||||
}
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,4 +122,10 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRel(List<String> ids) {
|
||||
String idsStr = String.join(",", ids);
|
||||
examTestDao.sqlUpdate("update boe_exam_test set ref_status=0 where id in (?1)",idsStr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import com.xboe.api.ThirdApi;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.service.IUserGroupService;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@@ -94,7 +92,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 用于查询课程的学习记录
|
||||
* @param pager
|
||||
@@ -320,7 +317,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
//检查是否已存在
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
if(item!=null) {
|
||||
String studyKey = CacheName.NAME_AUTH + ":" + CacheName.STUDY_KEY + item.getCourseId()+":"+cuser.getAccountId()+":"+item.getContentId();
|
||||
|
||||
@@ -93,8 +93,8 @@ public class StudyExamApi extends ApiBaseController{
|
||||
exam.setEndTime(exam.getLastTime());
|
||||
}
|
||||
log.info( exam.getStudyId() + "_" + exam.getContentId() + ",------------试卷开始提交 " + LocalDateTime.now());
|
||||
String msg = sexamService.save(exam,token);
|
||||
log.info( exam.getStudyId() + "_" + exam.getContentId() + ",------------试卷保存完毕 ,msg = " + msg + " , " + LocalDateTime.now());
|
||||
sexamService.save(exam,token);
|
||||
//log.info( exam.getStudyId() + "_" + exam.getContentId() + ",------------试卷保存完毕 ,msg = " + msg + " , " + LocalDateTime.now());
|
||||
exam.setAnswerJson("");
|
||||
exam.setPaperJson("");
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public class StudyHomeWorkApi extends ApiBaseController{
|
||||
return error("查询课程作业失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/list-study")
|
||||
public JsonResponse<List<StudyHomeWork>> listByStudyIdContentId(String studyId,String contentId){
|
||||
if(StringUtils.isBlank(studyId)) {
|
||||
|
||||
@@ -117,7 +117,7 @@ public class StudyExam extends IdEntity {
|
||||
/*
|
||||
* 开始时间
|
||||
* */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy--MM-dd HH:mm:ss")
|
||||
@Column(name = "start_time")
|
||||
private LocalDateTime startTime;
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@ public interface IStudyExamService {
|
||||
* 保存考试信息
|
||||
* @param exam
|
||||
*/
|
||||
String save(StudyExam exam,String token);
|
||||
void save(StudyExam exam,String token);
|
||||
|
||||
|
||||
StudyExam get(String id);
|
||||
|
||||
@@ -99,4 +99,5 @@ public interface IStudyService {
|
||||
|
||||
List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status);
|
||||
|
||||
List<User> getUserNo(List<String> userIds);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -18,6 +21,7 @@ import com.xboe.school.study.entity.StudyAssess;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.service.IStudyAssessService;
|
||||
|
||||
|
||||
@Service
|
||||
public class StudyAssessServiceImpl implements IStudyAssessService{
|
||||
|
||||
@@ -33,6 +37,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
||||
@Autowired
|
||||
StudyCourseItemDao scItemDao;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(StudyAssess assess,String token) {
|
||||
@@ -67,7 +72,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
||||
assess.setStudyItemId(obj.toString());
|
||||
dao.update(assess);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.entity.Message;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.CourseContentDao;
|
||||
import com.xboe.module.course.dao.CourseExamDao;
|
||||
import com.xboe.module.course.entity.CourseExam;
|
||||
@@ -13,17 +28,6 @@ import com.xboe.school.study.dao.StudyExamDao;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyExam;
|
||||
import com.xboe.school.study.service.IStudyExamService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -50,7 +54,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String save(StudyExam exam,String token) {
|
||||
public void save(StudyExam exam,String token) {
|
||||
String key = exam.getStudyId() + "_" + exam.getContentId();
|
||||
// //判断是否存在redis
|
||||
// if(StringUtils.isNotEmpty(redisTemplate.opsForValue().get(key))){
|
||||
@@ -69,31 +73,29 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
exam.setPassLine(0);
|
||||
}
|
||||
|
||||
int prog=exam.getScore().intValue()>=exam.getPassLine()?100:exam.getScore().intValue();
|
||||
//完成处理,判断是否已存在
|
||||
Object obj=scItemDao.findField("id", FieldFilters.eq("studyId", exam.getStudyId()), FieldFilters.eq("contentId", exam.getContentId()));
|
||||
//获取本次考试提交,学习状态与学习进度
|
||||
int status=exam.getScore()>=exam.getPassLine()?StudyCourseItem.STATUS_FINISH:StudyCourseItem.STATUS_STUDYING;
|
||||
int progress = exam.getScore().intValue() >= exam.getPassLine() ? 100 : 0;
|
||||
//计算时长
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
|
||||
if(obj==null) {
|
||||
StudyCourseItem sci=new StudyCourseItem();
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(exam.getStudyId());
|
||||
sci.setContentId(exam.getContentId());
|
||||
sci.setContentName("考试");
|
||||
sci.setCourseId(exam.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(progress);//直接设置为学习完成
|
||||
sci.setProgress(prog);//直接设置为学习完成
|
||||
sci.setStatus(status);//状态直接更新为已完成
|
||||
sci.setStartTime(exam.getStartTime());
|
||||
sci.setStartTime(ldt);
|
||||
sci.setAid(exam.getStudentId());
|
||||
sci.setAname(exam.getStudentName());
|
||||
sci.setFinishTime(ldt);
|
||||
sci.setFinishTime(LocalDateTime.now());
|
||||
sci.setLastStudyTime(0);//此项用户记录视频内容当前学习的时间点
|
||||
sci.setLastTime(ldt);
|
||||
sci.setScore(exam.getScore());
|
||||
sci.setStudyDuration(exam.getTestDuration());
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST) {
|
||||
sci.setScore(exam.getScore());
|
||||
}
|
||||
scItemDao.save(sci);
|
||||
exam.setStudyItemId(sci.getId());
|
||||
dao.save(exam);
|
||||
@@ -106,40 +108,40 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
||||
|
||||
}else {
|
||||
exam.setStudyItemId(obj.toString());//此项就是学习条目的id
|
||||
Float maxScore = (Float) dao.findField("max(score)", FieldFilters.eq("contentId", exam.getContentId()), FieldFilters.eq("courseId", exam.getCourseId()), FieldFilters.eq("studyId", exam.getStudyId()));
|
||||
dao.save(exam);
|
||||
//最新考试分值
|
||||
if (cexam.getScoringType() == CourseExam.SCORINGTYPE_LAST) {
|
||||
scItemDao.updateMultiFieldById(exam.getStudyItemId(),
|
||||
UpdateBuilder.create("startTime", exam.getStartTime()),
|
||||
UpdateBuilder.create("finishTime", ldt),
|
||||
UpdateBuilder.create("score", exam.getScore()),
|
||||
UpdateBuilder.create("progress", progress),
|
||||
UpdateBuilder.create("status", status),
|
||||
UpdateBuilder.create("studyDuration", exam.getTestDuration())
|
||||
);
|
||||
}
|
||||
|
||||
//最高分
|
||||
if (cexam.getScoringType() == CourseExam.SCORINGTYPE_MAX) {
|
||||
if (exam.getScore() > maxScore) {
|
||||
scItemDao.updateMultiFieldById(exam.getStudyItemId(),
|
||||
UpdateBuilder.create("startTime", exam.getStartTime()),
|
||||
UpdateBuilder.create("finishTime", LocalDateTime.now()),
|
||||
UpdateBuilder.create("score", exam.getScore()),
|
||||
UpdateBuilder.create("progress", progress),
|
||||
UpdateBuilder.create("status", status)
|
||||
);
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST){
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "score",exam.getScore());
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",prog);
|
||||
if(exam.getScore()>=exam.getPassLine()){
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "score",exam.getScore());
|
||||
//scDao.updateFieldById(exam.getStudyId(), "last_score",100.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
//1最高一次,用于最高一次的计算
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_MAX) {
|
||||
Float f=(Float)dao.findField("max(score)", FieldFilters.eq("contentId", exam.getContentId()), FieldFilters.eq("courseId", exam.getCourseId()), FieldFilters.eq("studyId", exam.getStudyId()));
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "score", f);
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "status", f>=exam.getPassLine()?StudyCourseItem.STATUS_FINISH:StudyCourseItem.STATUS_STUDYING);
|
||||
scItemDao.updateFieldById(exam.getStudyItemId(), "progress",f>=exam.getPassLine()?100:f.intValue());
|
||||
|
||||
if(f>=exam.getPassLine()){
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "progress",100);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "finish_time",LocalDateTime.now());
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "status",StudyCourseItem.STATUS_FINISH);
|
||||
scItemDao.updateFieldById(exam.getStudyId(), "score",exam.getScore());
|
||||
//scDao.updateFieldById(exam.getStudyId(), "last_score",100.0f);
|
||||
}
|
||||
|
||||
}
|
||||
int totalContent = courseContentDao.getCount(exam.getCourseId());
|
||||
scDao.finishCheck(exam.getStudyId(),exam.getCourseId(),totalContent,token);
|
||||
scDao.updateFieldById(exam.getStudyId(), "last_score",exam.getScore());
|
||||
//执行完毕 清除redis记录
|
||||
// redisTemplate.delete(key);
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,7 +64,6 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
int totalContent=courseContentDao.count(FieldFilters.eq("courseId", homework.getCourseId()),FieldFilters.eq("deleted",false));
|
||||
scDao.finishCheck(homework.getStudyId(),homework.getCourseId(),totalContent,token);
|
||||
}else {
|
||||
scItemDao.updateFieldById(obj.toString(), "finishTime", LocalDateTime.now());
|
||||
//只是保留一条作业记录,不再保存多条记录了
|
||||
//dao.save(homework);
|
||||
//设置id。然后进行悠
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -97,6 +98,8 @@ public class StudyServiceImpl implements IStudyService{
|
||||
//sci.setProgress(100);//直接设置为学习完成
|
||||
sci.setLastTime(ldt);
|
||||
scItemDao.saveOrUpdate(sci);
|
||||
|
||||
dto.setStudyItemId(sci.getId());
|
||||
if (sci.getId() != null){
|
||||
dto.setStudyItemId(sci.getId());
|
||||
}else {
|
||||
@@ -183,15 +186,17 @@ public class StudyServiceImpl implements IStudyService{
|
||||
query.addFilter(FieldFilters.eq("courseId",courseId));
|
||||
}
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
query.addFilter(FieldFilters.eq("aname", name));
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
}
|
||||
int pageIndex2 = (pageIndex-1)*10;
|
||||
if(status!=null) {
|
||||
if(status==3) {
|
||||
query.addFilter(FieldFilters.eq("status", 2));
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
return scItemDao.findPage(query.builder());
|
||||
}else if(status==2){
|
||||
query.addFilter(FieldFilters.eq("status",9));
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
return scItemDao.findPage(query.builder());
|
||||
}else if (status == 1) {
|
||||
String sql = "select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.content_id,0 as progress,1 as status from boe_study_course bsc " +
|
||||
@@ -294,11 +299,16 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
query.addFilter(FieldFilters.eq("aname", name));
|
||||
}
|
||||
return scItemDao.findList(query.builder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> getUserNo(List<String> userIds) {
|
||||
return userDao.findList(FieldFilters.in("id", userIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProcess(String studyContentId,String studyId, String courseId,Integer total, Integer progress,String token) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.113.100:8848
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.129.51:8848
|
||||
|
||||
## redis
|
||||
spring.redis.database=1
|
||||
spring.redis.host=10.251.88.213
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.port=6379
|
||||
|
||||
@@ -16,7 +16,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
#spring.datasource.url=jdbc:mysql://10.251.129.129:8066/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
#spring.datasource.username=admin
|
||||
#spring.datasource.password=ocYMC>!{8G
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
@@ -53,7 +53,6 @@ xboe.externalinterface.url.system=http://127.0.0.1:9091
|
||||
## ?????????????
|
||||
xboe.old.base.url=https://u.boe.com
|
||||
|
||||
|
||||
## ???????api??
|
||||
xboe.stat.base.url=http://127.0.0.1:9080
|
||||
xboe.server.userbasic.url=https://u.boe.com/userbasic
|
||||
@@ -64,7 +63,7 @@ jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
|
||||
# elasticsearch config
|
||||
xboe.elasticsearch.server.ip=10.251.88.218
|
||||
xboe.elasticsearch.server.ip=10.251.129.21
|
||||
xboe.elasticsearch.server.port=9200
|
||||
xboe.elasticsearch.server.user=
|
||||
xboe.elasticsearch.server.password=
|
||||
|
||||
@@ -56,7 +56,7 @@ logging.config=classpath:log/logback-@profileActive@.xml
|
||||
# config.id.generator.datacenter.num=1
|
||||
|
||||
#boe.domain=https://pretest.zcwytd.com
|
||||
boe.domain=http://127.0.0.1
|
||||
boe.domain=https://u.boe.com
|
||||
#boe.domain=http://localhost:30001
|
||||
orgTree.orgTreeList=${boe.domain}/userbasic/org/list
|
||||
# ????id????????????
|
||||
@@ -72,7 +72,10 @@ infrasApi.dict=${boe.domain}/infrasApi/dict/list
|
||||
#获取非报名课id
|
||||
manageApi.stu.offcourse=${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
||||
manageApi.editExam=${boe.domain}/manageApi/admin/project/editExam
|
||||
manageApi.getExamSycn=${boe.domain}/manageApi/stu/grow/getExamSync
|
||||
#获取离职教师id
|
||||
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
||||
userBasic.getUserIdByWorkNum=${boe.domain}/userbasic/user/getUserIdByWorkNum
|
||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||
userBasic.getUserBasicInfo=${boe.domain}/userbasic/user/getUserBasicInfo
|
||||
coursesuilt.checkBanding=${boe.domain}/manageApi/stu/task/exam/checkBanding
|
||||
coursesuilt.syncExamScoreToCourseSuite=${boe.domain}/manageApi/stu/task/exam/syncExamScoreToCourseSuite
|
||||
@@ -1,6 +1,6 @@
|
||||
## redis
|
||||
spring.redis.database=3
|
||||
spring.redis.host=10.251.88.213
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.port=6379
|
||||
|
||||
@@ -14,7 +14,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.88.216:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.129.126:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=admin
|
||||
spring.datasource.db1.password=boeRds01
|
||||
|
||||
@@ -23,7 +23,7 @@ spring.datasource.db1.password=boeRds01
|
||||
# 主数据库 all 对应的数据库
|
||||
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.username=admin
|
||||
spring.datasource.db2.password=boeRds01
|
||||
|
||||
@@ -48,7 +48,6 @@ xboe.upload.file.http_path=https://u.boe.com/upload
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://127.0.0.1:9090
|
||||
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=10.251.88.214
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
## datasource config
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql:/10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=10.251.88.214
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
@@ -8,7 +8,7 @@ spring.redis.port=6379
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=10.251.88.214
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.113.100:8848
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.181.11:8848
|
||||
|
||||
## datasource config
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
@@ -33,6 +33,7 @@ xboe.upload.file.http_path=http://localhost:9090/cdn/upload
|
||||
|
||||
## 外部接口调用地址 旧系统机构及用户数据接口
|
||||
xboe.externalinterface.url.system=http://localhost:9091
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
|
||||
@@ -7,7 +7,7 @@ spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
@@ -8,7 +9,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 原数据库 old 对应的数据库
|
||||
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.88.216:3306/elearninglms?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.129.126:3306/elearninglms?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=admin
|
||||
spring.datasource.db1.password=boeRds01
|
||||
|
||||
@@ -17,7 +18,7 @@ spring.datasource.db1.password=boeRds01
|
||||
# 新主数据库 all 对应的数据库
|
||||
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.username=admin
|
||||
spring.datasource.db2.password=boeRds01
|
||||
|
||||
|
||||
Reference in New Issue
Block a user