mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-07 01:46:47 +08:00
Compare commits
190 Commits
yx-104-082
...
yx1107-bug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acc62c85e0 | ||
|
|
ec00f55606 | ||
|
|
fc94e4aedd | ||
|
|
ae75aedff9 | ||
|
|
5b691c5bb8 | ||
|
|
b0f01c6300 | ||
|
|
e51d4dd8cb | ||
|
|
ea1cda25bd | ||
|
|
3d3e660e68 | ||
|
|
b509b783a1 | ||
|
|
bbda82b8f5 | ||
|
|
fec28f5baf | ||
|
|
469145d25c | ||
|
|
25d8594a2b | ||
|
|
3001c25590 | ||
|
|
95b63155cd | ||
|
|
85517dcd57 | ||
|
|
0e897b5f14 | ||
|
|
39e336d044 | ||
|
|
9da0eae4c0 | ||
|
|
74a36d72a1 | ||
|
|
4ef1b5b1e9 | ||
|
|
33df8b0831 | ||
|
|
b61923233a | ||
|
|
effb45c6d0 | ||
|
|
95aa5f7abe | ||
|
|
3af3c2eedf | ||
|
|
516225f52e | ||
|
|
e3c060b8d9 | ||
|
|
72783fb1ac | ||
|
|
f5f8fcee98 | ||
|
|
003d227ba3 | ||
|
|
e6bd808a3d | ||
|
|
b87eb65b3e | ||
|
|
28af48581e | ||
|
|
57e04f46c0 | ||
|
|
6a04082245 | ||
|
|
81a1a88eab | ||
|
|
1dfdc9277d | ||
|
|
7c840d2bfc | ||
|
|
48e2adad7f | ||
|
|
e04735ee44 | ||
|
|
c2de2a433b | ||
|
|
cb0e784d5e | ||
|
|
e6feea6dbf | ||
|
|
012f987de0 | ||
|
|
3cbef3e3f7 | ||
|
|
2e2edbbf57 | ||
|
|
beba553faa | ||
|
|
403e72ec5f | ||
|
|
9136f338da | ||
|
|
120a4f45fc | ||
|
|
2c967cef0a | ||
|
|
29a17efd44 | ||
|
|
f8257a1806 | ||
|
|
2986344fd5 | ||
|
|
056d15e5fa | ||
|
|
d2043da062 | ||
|
|
af6c232d49 | ||
|
|
18bb8a434a | ||
|
|
aa32e9136c | ||
|
|
903a1369f5 | ||
|
|
0fcd4568ec | ||
|
|
45fce7927d | ||
|
|
22ebe90c08 | ||
|
|
5070be0620 | ||
|
|
0dc58db106 | ||
|
|
749a6b69e7 | ||
|
|
6dadd80372 | ||
|
|
04a4f528bf | ||
|
|
4fa0215373 | ||
|
|
f7cd9f8469 | ||
|
|
163425cad2 | ||
|
|
3735c38001 | ||
|
|
1021f0bd43 | ||
|
|
1fd0c32f97 | ||
|
|
0d0b45f017 | ||
|
|
2ae3d99f21 | ||
|
|
89573debef | ||
|
|
457597eabc | ||
|
|
24ae3c0ec6 | ||
|
|
fffa12344a | ||
|
|
52a58a6c6f | ||
|
|
a4b034752d | ||
|
|
23e63062e9 | ||
|
|
06415d58ac | ||
|
|
3fc8ce614d | ||
|
|
bebe36d39e | ||
|
|
d4af5ba8d5 | ||
|
|
d42d1b2e83 | ||
|
|
616594af9e | ||
|
|
4ff47085b8 | ||
|
|
b7e8c43b5f | ||
|
|
2440b6ca50 | ||
|
|
9591e60ac4 | ||
|
|
363dba845f | ||
|
|
6220f212d2 | ||
|
|
5ed277e918 | ||
|
|
e52d9b682b | ||
|
|
cf64f0406f | ||
|
|
df3b0b95c1 | ||
|
|
f5ff666c07 | ||
|
|
731e62c89f | ||
|
|
7fe53c026e | ||
|
|
6492e3b0dd | ||
|
|
30aab6eab4 | ||
|
|
61754d3852 | ||
|
|
a26ee1c707 | ||
|
|
1f0060c4dc | ||
|
|
6b0050286c | ||
|
|
2b07029aca | ||
|
|
d2d7fab96c | ||
|
|
be3bae969c | ||
|
|
8e1b7519ef | ||
|
|
bddb11caf8 | ||
|
|
436eedd570 | ||
|
|
345e28fdee | ||
|
|
312c85d92c | ||
|
|
a590cd19b1 | ||
|
|
58c5ab499a | ||
|
|
a38cfc553f | ||
|
|
56199f1480 | ||
|
|
6d5fd5364d | ||
|
|
99792ccab6 | ||
|
|
78b36b6da0 | ||
|
|
f6a7bb77c0 | ||
|
|
dfb0825cfd | ||
|
|
ba8ef92700 | ||
|
|
56d064e533 | ||
|
|
654da73faf | ||
|
|
627e87509f | ||
|
|
2911ef8d46 | ||
|
|
b86ce744a7 | ||
|
|
c096c44a91 | ||
|
|
db84181523 | ||
|
|
b568285fed | ||
|
|
e38be093f4 | ||
|
|
f0fe015561 | ||
|
|
91bcec00ef | ||
|
|
27b863a6a4 | ||
|
|
7a210ec701 | ||
|
|
484a7650dd | ||
|
|
6c616a1163 | ||
|
|
939325d5bd | ||
|
|
bcb453b2f4 | ||
|
|
4eddbc8e8f | ||
|
|
50bdd59a26 | ||
|
|
b85eb97bc1 | ||
|
|
28b58a73cf | ||
|
|
b9adf4c45f | ||
|
|
389dff8fbe | ||
|
|
49aab74463 | ||
|
|
9f30910d04 | ||
|
|
6658b8c04b | ||
|
|
19df4224a9 | ||
|
|
95ddc9f5d5 | ||
|
|
f3b6bb6fee | ||
|
|
a9be34631a | ||
|
|
7e3a3a5838 | ||
|
|
64965f5ec6 | ||
|
|
a407ca2dad | ||
|
|
f79a159e22 | ||
|
|
b9c4503aaa | ||
|
|
860fb3f27c | ||
|
|
294949f4e5 | ||
|
|
16f1c2337b | ||
|
|
9b8487b0ca | ||
|
|
bf476a23a0 | ||
|
|
92a4e509ef | ||
|
|
0f0edaf2cd | ||
|
|
e508551043 | ||
|
|
68d00e8c51 | ||
|
|
41a542ea23 | ||
|
|
fc98025a3a | ||
|
|
8dffbfda04 | ||
|
|
5387a90f3a | ||
|
|
5116c1ebc5 | ||
|
|
29ca9d61f9 | ||
|
|
f901a2897f | ||
|
|
e2c697f860 | ||
|
|
c6a785bb4f | ||
|
|
8567fa9ecc | ||
|
|
359b66e48a | ||
|
|
8125a6bd77 | ||
|
|
9b37e8a73d | ||
|
|
2fa3378e94 | ||
|
|
0b7784779f | ||
|
|
e03118275d | ||
|
|
1b1cb17861 | ||
|
|
a35c1faa49 |
@@ -20,7 +20,7 @@ import com.xboe.common.utils.StringUtil;
|
||||
public class ElasticsearchConfig {
|
||||
|
||||
@Value("${xboe.elasticsearch.server.ip}")
|
||||
private String esIp="127.0.0.1";
|
||||
private String esIp="10.251.88.214";
|
||||
|
||||
@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>
|
||||
@@ -84,7 +84,6 @@
|
||||
<artifactId>xboe-module-es</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>it.sauronsoftware</groupId>
|
||||
<artifactId>jave</artifactId>
|
||||
@@ -93,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>
|
||||
@@ -110,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>
|
||||
@@ -130,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>
|
||||
@@ -185,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>
|
||||
@@ -214,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>
|
||||
@@ -236,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>
|
||||
@@ -272,8 +271,8 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -296,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,12 +12,14 @@ 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) {
|
||||
|
||||
@@ -12,13 +12,15 @@ import com.xboe.module.dict.entity.DictDto;
|
||||
import com.xboe.module.exam.entity.ExamTest;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -66,6 +68,10 @@ public class ThirdApi {
|
||||
|
||||
@Value("${manageApi.editExam}")
|
||||
private String editExam;
|
||||
|
||||
@Value("${userBasic.getUserBasicInfo}")
|
||||
private String getUserBasicInfo;
|
||||
|
||||
//获取例外人员的id
|
||||
public List<String> getUserId(){
|
||||
String responseBody = Optional.ofNullable(HttpRequest.get(infarasApiUrl+"?pid=316&type=1").execute() //prod 316
|
||||
@@ -234,5 +240,66 @@ public class ThirdApi {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取案例浏览记录
|
||||
*/
|
||||
public UserDynamicResult getAllUserdynamicListOfCaseRead(UserdynamicParam userdynamicParam, String token) {
|
||||
String s = buildFormData(userdynamicParam);
|
||||
String resp = Optional.ofNullable(HttpRequest
|
||||
.post(userdynamicListUrl)
|
||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||
.body(s)
|
||||
.header("XBOE-Access-Token", token)
|
||||
.execute().body()).orElseThrow(() -> new RuntimeException("token校验失败"));
|
||||
|
||||
DynamicBean dynamicBean = JSONUtil.toBean(resp, DynamicBean.class);
|
||||
UserDynamicResult userdynamicResult = dynamicBean.getResult();
|
||||
return userdynamicResult;
|
||||
}
|
||||
|
||||
private String buildFormData(UserdynamicParam param) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try {
|
||||
builder.append("pageIndex=").append(URLEncoder.encode(param.getPageIndex().toString(), "UTF-8"));
|
||||
|
||||
builder.append("&pageSize=").append(URLEncoder.encode(param.getPageSize().toString(), "UTF-8"));
|
||||
builder.append("&contentType=").append(URLEncoder.encode(param.getContentType().toString(), "UTF-8"));
|
||||
builder.append("&aid=").append(URLEncoder.encode(param.getAid().toString(), "UTF-8"));
|
||||
builder.append("&eventKey=").append(URLEncoder.encode("ReadCase", "UTF-8"));
|
||||
if (param.getHidden() != null) {
|
||||
builder.append("&hidden=").append(URLEncoder.encode(param.getHidden(), "UTF-8"));
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
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,23 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBasicInfo {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名。
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 工号。
|
||||
*/
|
||||
private String workNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserBasicInfoResult {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<UserBasicInfo> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public UserBasicInfoResult success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取用户基本信息失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -133,4 +133,26 @@ public interface CacheName {
|
||||
* 字典缓存key
|
||||
* */
|
||||
String KEY_DICT="dict";
|
||||
|
||||
String STUDY_KEY = "StudyKey:";
|
||||
|
||||
/**
|
||||
* 季度观看量排行key
|
||||
* */
|
||||
String CASE_RANK_VIEWS_QUARTER="case:rank:views:quarter";
|
||||
|
||||
/**
|
||||
* 总观看排行key
|
||||
* */
|
||||
String CASE_RANK_VIEWS_ALL="case:rank:views:all";
|
||||
|
||||
/**
|
||||
* 季度点赞排行key
|
||||
* */
|
||||
String CASE_RANK_PRAISE_QUARTER ="case:rank:praise:quarter";
|
||||
|
||||
/**
|
||||
* 总点赞排行key
|
||||
* */
|
||||
String CASE_RANK_PRAISE_ALL="case:rank:praise:all";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xboe.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import static com.xboe.constants.CacheName.*;
|
||||
|
||||
/**
|
||||
* 案例排行榜类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum CasesRankEnum {
|
||||
|
||||
QUARTER_VIEWS(1,"季度观看量排行",CASE_RANK_VIEWS_QUARTER),
|
||||
ALL_VIEWS(2,"总观看排行",CASE_RANK_VIEWS_ALL),
|
||||
QUARTER_PRAISES(3,"季度点赞排行",CASE_RANK_PRAISE_QUARTER),
|
||||
ALL_PRAISES(4,"总点赞排行",CASE_RANK_PRAISE_ALL),
|
||||
;
|
||||
|
||||
private Integer type;
|
||||
private String name;
|
||||
private String cacheKey;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,18 +11,14 @@ import com.xboe.module.boecase.dao.CasesMajorTypeDao;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.service.ICasesRecommendPushRecordService;
|
||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||
import com.xboe.module.boecase.vo.*;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
|
||||
import com.xboe.system.user.dao.UserDao;
|
||||
import com.xboe.system.user.entity.User;
|
||||
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.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
@@ -39,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -127,25 +124,12 @@ public class CasesApi extends ApiBaseController {
|
||||
@PostMapping("/queryListV2")
|
||||
public JsonResponse<PageList<Cases>> queryCaseBreV2(@Validated @RequestBody CasePageVo req) {
|
||||
String type = req.getType();
|
||||
PageList<Cases> subViews1;
|
||||
PageList<Cases> subViews2;
|
||||
PageList<Cases> views = null;
|
||||
req.setUserId(getCurrent().getAccountId());
|
||||
if (StringUtils.isNotEmpty(type)) {
|
||||
if ("recommend".equals(type)) {
|
||||
views = casesService.queryRecommendPageCasesV2(req);
|
||||
} else {
|
||||
views = casesService.queryPageCasesV2(req);
|
||||
}
|
||||
PageList<Cases> views = null;
|
||||
if (type.equals("recommend")) {
|
||||
views = casesService.queryRecommendPageCasesV2(req);
|
||||
} else {
|
||||
PageDto pageDto = new PageDto();
|
||||
pageDto.setPageIndex(req.getPageIndex());
|
||||
pageDto.setPageSize(req.getPageSize());
|
||||
req.setPageSize(1000000);
|
||||
req.setPageIndex(1);
|
||||
subViews1 = casesService.queryRecommendPageCasesV2(req);
|
||||
subViews2 = casesService.queryPageCasesV2(req);
|
||||
views = merge(subViews1, subViews2, pageDto);
|
||||
views = casesService.queryPageCasesV2(req);
|
||||
}
|
||||
|
||||
if (views != null) {
|
||||
@@ -175,24 +159,6 @@ public class CasesApi extends ApiBaseController {
|
||||
return success(views);
|
||||
}
|
||||
|
||||
public static PageList<Cases> merge(PageList<Cases> pageList1, PageList<Cases> pageList2, PageDto pageDto) {
|
||||
List<Cases> mergedCaseList = new ArrayList<>();
|
||||
mergedCaseList.addAll(pageList1.getList());
|
||||
mergedCaseList.addAll(pageList2.getList());
|
||||
List<Cases> pageCaseList = mergedCaseList.stream()
|
||||
.skip((long) (pageDto.getPageIndex() - 1) * pageDto.getPageSize())
|
||||
.limit(pageDto.getPageSize())
|
||||
.collect(Collectors.toList());
|
||||
int totalCount = pageList1.getCount() + pageList2.getCount();
|
||||
int pageSize = pageDto.getPageSize();
|
||||
|
||||
PageList<Cases> mergePageList = new PageList<>();
|
||||
mergePageList.setList(pageCaseList);
|
||||
mergePageList.setCount(totalCount);
|
||||
mergePageList.setPageSize(pageSize);
|
||||
return mergePageList;
|
||||
}
|
||||
|
||||
@PostMapping("/caseYears")
|
||||
public JsonResponse<List<String>> caseYears() {
|
||||
List<String> result = casesService.getCaseYears();
|
||||
@@ -646,7 +612,8 @@ public class CasesApi extends ApiBaseController {
|
||||
if (ids.isEmpty()) {
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
List<Cases> cases = casesService.ids(ids);
|
||||
String accountId = getCurrent().getAccountId();
|
||||
List<Cases> cases = casesService.ids(ids,accountId);
|
||||
return success(cases);
|
||||
}
|
||||
|
||||
@@ -654,7 +621,7 @@ public class CasesApi extends ApiBaseController {
|
||||
* 设置/取消优秀案例
|
||||
*/
|
||||
@PostMapping("/excellent")
|
||||
public JsonResponse<Boolean> excellent(String id, Boolean excellent) {
|
||||
public JsonResponse<Boolean> excellent(String id, Boolean excellent,String excellentReason) {
|
||||
if (StringUtil.isBlank(id)) {
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
@@ -662,12 +629,145 @@ public class CasesApi extends ApiBaseController {
|
||||
excellent = false;//默认设置取消
|
||||
}
|
||||
try {
|
||||
casesService.excellent(id, excellent);
|
||||
casesService.excellent(id, excellent,excellentReason);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
return error("设置或者取消失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 不同专业分类下排行榜刷新
|
||||
* 注意!!!定时统计任务是在本月月初执行的,而上榜时间是在上个月最后一天23:59:59
|
||||
*/
|
||||
@PostMapping("/refreshViewsRankOfMajor")
|
||||
public JsonResponse<Boolean> refreshViewsRankOfMajor() {
|
||||
casesService.refreshViewsRankOfMajor();
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/refreshLastQuarterStatistics")
|
||||
public JsonResponse<Boolean> refreshLastQuarterStatistics() {
|
||||
casesService.refreshLastQuarterStatistics();
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 热度榜(当前季度、总榜) 按观看量排行
|
||||
* @param pageSize
|
||||
* @param rankType 1:当前季度,2:总榜
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryPopularity")
|
||||
public JsonResponse<List<CaseRankingVo>> queryPopularity(@RequestParam(required = false) Integer pageSize,@RequestParam Integer rankType) {
|
||||
List<CaseRankingVo> caseRankingVoList =casesService.queryRank(pageSize,rankType);
|
||||
return success(caseRankingVoList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 好评榜 (当前季度、总榜) 按点赞量排行
|
||||
* @param pageSize
|
||||
* @param rankType
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryHighOpinion")
|
||||
public JsonResponse<List<CaseRankingVo>> queryHighOpinion(@RequestParam(required = false) Integer pageSize,@RequestParam Integer rankType) {
|
||||
List<CaseRankingVo> caseRankingVoList =casesService.queryRank(pageSize,rankType);
|
||||
return success(caseRankingVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不同专业月热度榜 按观看量排行
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryPopularityOfMajor")
|
||||
public JsonResponse<List<Cases>> queryPopularityOfMajor(@RequestParam(required = false) Integer pageSize,
|
||||
@RequestParam String majorId,
|
||||
@RequestParam LocalDateTime rankMonth) {
|
||||
String accountId = getCurrent().getAccountId();
|
||||
List<Cases> caseRankingVoList =casesService.queryPopularityOfMajor(pageSize,majorId,rankMonth,accountId);
|
||||
return success(caseRankingVoList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有上榜的的(专业ID-时间), 用于下拉框.优化可将majorName一并查询,返回为List<List<Entity>> todo by anyone
|
||||
*/
|
||||
@GetMapping("/queryAllTimePopularityOfMajor")
|
||||
public JsonResponse<Map<String, List<String>>> queryAllTimePopularityOfMajor() {
|
||||
Map<String, List<String>> time = casesService.queryAllTimePopularityOfMajor();
|
||||
return success(time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询推荐案例榜单
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryRecommendRank")
|
||||
public JsonResponse<List<CasesQueryRecommendRankVo>> queryRecommendRank(@RequestParam(required = false,defaultValue = "3") Integer pageSize) {
|
||||
List<CasesQueryRecommendRankVo> list = casesService.queryRecommendRank(pageSize);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 案例上榜
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@PostMapping("/riseIntoRank")
|
||||
public JsonResponse<Boolean> riseIntoRank(@RequestParam Long caseId) {
|
||||
casesService.riseIntoRank(caseId,getCurrent());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 案例下榜
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@PostMapping("/cancelRiseIntoRank")
|
||||
public JsonResponse<Boolean> cancelRiseIntoRank(@RequestParam Long caseId) {
|
||||
casesService.cancelRiseIntoRank(caseId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐案例调整排名
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@PostMapping("/adjustRank")
|
||||
public JsonResponse<Boolean> adjustRank(@RequestParam List<Long> caseIds) {
|
||||
casesService.adjustRank(caseIds);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询收藏
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@GetMapping("/queryFavoriteCaseOfIndex")
|
||||
public JsonResponse<PageList<FavoriteCaseOfIndexVo>> queryFavoriteCaseOfIndex(@RequestParam(required = false,defaultValue = "1") Integer pageIndex,
|
||||
@RequestParam(required = false,defaultValue = "5") Integer pageSize) {
|
||||
String accountId = this.getCurrent().getAccountId();
|
||||
PageList<FavoriteCaseOfIndexVo> casesList = casesService.queryFavoriteCaseOfIndex(pageIndex,pageSize,accountId);
|
||||
return success(casesList);
|
||||
}
|
||||
|
||||
@GetMapping("/browsingHistory")
|
||||
public JsonResponse<PageList<CasesBrowsingHistoryVo>> browsingHistory(@RequestParam(required = false,defaultValue = "1") Integer pageIndex,
|
||||
@RequestParam(required = false,defaultValue = "5") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
String accountId = this.getCurrent().getAccountId();
|
||||
PageList<CasesBrowsingHistoryVo> casesList = casesService.browsingHistory(pageIndex,pageSize,accountId,request);
|
||||
return success(casesList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package com.xboe.module.boecase.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.boecase.dto.CaseVo;
|
||||
import com.xboe.module.boecase.vo.CaseRankingVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xboe.enums.CasesRankEnum.*;
|
||||
|
||||
@Repository
|
||||
@Slf4j
|
||||
public class CasesDao extends BaseDao<Cases> {
|
||||
|
||||
/**
|
||||
@@ -35,4 +41,106 @@ public class CasesDao extends BaseDao<Cases> {
|
||||
public Cases getByTitle(String title) {
|
||||
return this.getGenericDao().findOne(Cases.class, FieldFilters.eq("title", title));
|
||||
}
|
||||
|
||||
public HashMap<String, Object> findExcellentCount(List<String> authorIdList) {
|
||||
String sql =
|
||||
"SELECT author_id,COUNT(1) AS excellentCount\n" +
|
||||
"FROM boe_cases \n" +
|
||||
"WHERE excellent = 1 AND author_id IN (?1) AND deleted=0 \n" +
|
||||
"GROUP BY author_id";
|
||||
List<Object[]> list = this.sqlFindList(sql, authorIdList);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
list.forEach(objects -> {
|
||||
String authorId = objects[0].toString();
|
||||
int excellentCount = Integer.parseInt(objects[1].toString());
|
||||
map.put(authorId, excellentCount);
|
||||
});
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private List<CaseRankingVo> handleCaseRank(List<Object[]> listFields) {
|
||||
List<CaseRankingVo> list = new ArrayList<>();
|
||||
for (Object[] o : listFields) {
|
||||
CaseRankingVo dto = new CaseRankingVo();
|
||||
dto.setCaseId(String.valueOf(o[0]));
|
||||
dto.setCaseTitle((String) o[1]);
|
||||
list.add(dto);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<CaseRankingVo> findPopularityOfAll(Integer pageSize) {
|
||||
|
||||
String sql =
|
||||
"SELECT id,title\n" +
|
||||
"FROM boe_cases \n" +
|
||||
"WHERE deleted=0\n" +
|
||||
"ORDER BY views DESC,sys_create_time DESC\n" +
|
||||
"LIMIT ?1";
|
||||
|
||||
List<Object[]> listFields = this.sqlFindList(sql, pageSize);
|
||||
List<CaseRankingVo> caseRankingVoList = handleCaseRank(listFields);
|
||||
return caseRankingVoList;
|
||||
}
|
||||
|
||||
public List<CaseRankingVo> findPopularityOfQuarter(Integer pageSize) {
|
||||
String sql =
|
||||
"SELECT id,title\n" +
|
||||
"FROM boe_cases \n" +
|
||||
"WHERE deleted=0\n" +
|
||||
"ORDER BY (views-last_quarter_views) DESC,sys_create_time DESC \n" +
|
||||
"LIMIT ?1";
|
||||
|
||||
List<Object[]> listFields = this.sqlFindList(sql, pageSize);
|
||||
|
||||
List<CaseRankingVo> caseRankingVoList = handleCaseRank(listFields);
|
||||
return caseRankingVoList;
|
||||
}
|
||||
|
||||
public List<CaseRankingVo> findHighOpinionOfAll(Integer pageSize) {
|
||||
String sql =
|
||||
"SELECT id,title\n" +
|
||||
"FROM boe_cases \n" +
|
||||
"WHERE deleted=0\n" +
|
||||
"ORDER BY praises DESC,sys_create_time DESC \n" +
|
||||
"LIMIT ?1";
|
||||
List<Object[]> listFields = this.sqlFindList(sql, pageSize);
|
||||
List<CaseRankingVo> caseRankingVoList = handleCaseRank(listFields);
|
||||
return caseRankingVoList;
|
||||
}
|
||||
|
||||
|
||||
public List<CaseRankingVo> findHighOpinionOfQuarter(Integer pageSize) {
|
||||
String sql =
|
||||
"SELECT id,title\n" +
|
||||
"FROM boe_cases \n" +
|
||||
"WHERE deleted=0\n" +
|
||||
"ORDER BY (praises-last_quarter_praises) DESC,sys_create_time DESC \n" +
|
||||
"LIMIT ?1";
|
||||
|
||||
List<Object[]> listFields = this.sqlFindList(sql, pageSize);
|
||||
List<CaseRankingVo> caseRankingVoList = handleCaseRank(listFields);
|
||||
return caseRankingVoList;
|
||||
}
|
||||
|
||||
public List<CaseRankingVo> findRank(Integer pageSize, Integer rankType) {
|
||||
List<CaseRankingVo> popularityOfQuarter = Collections.emptyList();
|
||||
if (rankType == QUARTER_VIEWS.getType()){
|
||||
popularityOfQuarter = findPopularityOfQuarter(pageSize);
|
||||
}
|
||||
if (rankType == ALL_VIEWS.getType()){
|
||||
popularityOfQuarter = findPopularityOfAll(pageSize);
|
||||
}
|
||||
if (rankType == QUARTER_PRAISES.getType()){
|
||||
popularityOfQuarter = findHighOpinionOfQuarter(pageSize);
|
||||
}
|
||||
if (rankType == ALL_PRAISES.getType()){
|
||||
popularityOfQuarter = findHighOpinionOfAll(pageSize);
|
||||
}
|
||||
return popularityOfQuarter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.xboe.module.boecase.dao;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.boecase.entity.CasesRank;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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" +
|
||||
"WHERE bcvr.case_id = ?1 AND bcvr.deleted=0 AND bdmt.deleted=0\n" +
|
||||
"ORDER BY bcvr.rise_rank_time DESC;";
|
||||
|
||||
List<Object[]> list = this.sqlFindList(sql, caseId);
|
||||
|
||||
List<CasesRank> resultList = new ArrayList<>();
|
||||
for (Object[] o : list) {
|
||||
CasesRank casesRank = new CasesRank();
|
||||
casesRank.setMajorName(o[0].toString());
|
||||
casesRank.setRiseRankTime(((Timestamp) o[1]).toLocalDateTime());
|
||||
casesRank.setRank(Integer.valueOf(o[2].toString()));
|
||||
casesRank.setMajorId(o[3].toString());
|
||||
resultList.add(casesRank);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> findViewTopCount(List<String> authorIdList) {
|
||||
String sql=
|
||||
"SELECT author_id,COUNT(1) as viewTopCount\n" +
|
||||
"FROM boe_cases bc JOIN boe_cases_rank bcvr ON bcvr.case_id = bc.id\n" +
|
||||
"WHERE bc.author_id IN (?1) \n" +
|
||||
" AND bcvr.deleted = 0 \n" +
|
||||
" AND bc.deleted = 0\n" +
|
||||
"GROUP BY bc.author_id;";
|
||||
List<Object[]> list = this.sqlFindList(sql, authorIdList);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
list.forEach(objects -> {
|
||||
String authorId = objects[0].toString();
|
||||
Integer viewTopCount = Integer.parseInt(objects[1].toString());
|
||||
map.put(authorId, viewTopCount);
|
||||
});
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public List<HashMap<String, Object>> findPopularityOfMajor(Integer pageSize, LocalDateTime startTime, LocalDateTime endTime, String majorId) {
|
||||
|
||||
String sql =
|
||||
"SELECT bcr.case_id,bcr.rank\n" +
|
||||
"FROM boe_cases_rank bcr\n" +
|
||||
"JOIN boe_cases bc on bcr.case_id = bc.id\n" +
|
||||
"WHERE bcr.deleted=0 AND bc.deleted=0 AND bcr.rise_rank_time BETWEEN ?1 and ?2 AND major_id=?3\n" +
|
||||
"ORDER BY rank\n" +
|
||||
"LIMIT ?4";
|
||||
|
||||
List<Object[]> listFields = this.sqlFindList(sql, startTime, endTime,majorId,pageSize);
|
||||
|
||||
List<HashMap<String, Object>> collect = listFields.stream().map(item -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("caseId", item[0].toString());
|
||||
map.put("rank", item[1].toString());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
@@ -21,50 +21,79 @@ import java.util.List;
|
||||
*/
|
||||
@Repository
|
||||
public interface CasesRecordDao extends JpaRepository<Cases, String>, JpaSpecificationExecutor<Cases> {
|
||||
@Query(nativeQuery = true, value = "select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id" +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword2 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword3 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
|
||||
" and if(:#{#condition.yearsEmpty},1=1, YEAR(b.sys_create_time) in (:#{#condition.years}))" +
|
||||
" and if(:#{#condition.caseIdsEmpty}, 1=1, b.id in (:#{#condition.caseIds}))" +
|
||||
" and ("+
|
||||
" if(:#{#condition.allOrgEmpty}, 1=1, 1=2)" +
|
||||
" or if(:#{#condition.org1Empty}, 1=2, b.org_domain_parent in (:#{#condition.org1}))" +
|
||||
" or if(:#{#condition.org2Empty}, 1=2, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=2, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC) as c group by c.id",
|
||||
countQuery = "select count(*) FROM (select c.* from ( select b.*" +
|
||||
" from boe_cases_recommend_push_record a left JOIN boe_cases b on a.case_id = b.id " +
|
||||
" where b.deleted=0 and a.push_status = 3 and a.deleted=0 and a.push_user_id= :#{#condition.userId}" +
|
||||
" and if(IFNULL(:#{#condition.keyWord},'')!='',b.title like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.author_name like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword1 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword2 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword3 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword4 like CONCAT('%',:#{#condition.keyWord},'%')" +
|
||||
" or b.keyword5 like CONCAT('%',:#{#condition.keyWord},'%'),1=1)" +
|
||||
" and if(:#{#condition.yearsEmpty},1=1, YEAR(b.sys_create_time) in (:#{#condition.years}))" +
|
||||
" and if(:#{#condition.caseIdsEmpty}, 1=1, b.id in (:#{#condition.caseIds}))" +
|
||||
" and ("+
|
||||
" if(:#{#condition.allOrgEmpty}, 1=1, 1=2)" +
|
||||
" or if(:#{#condition.org1Empty}, 1=1, b.org_domain_parent in (:#{#condition.org1}))" +
|
||||
" or if(:#{#condition.org2Empty}, 1=1, b.org_domain_parent2 in (:#{#condition.org2}))" +
|
||||
" or if(:#{#condition.org3Empty}, 1=1, b.org_domain_parent3 in (:#{#condition.org3}))" +
|
||||
")" +
|
||||
" and if(:#{#condition.isSysType1Empty} , 1=1, b.sys_type1 = :#{#condition.sysType1} )"+
|
||||
" and if(:#{#condition.isSysType2Empty} , 1=1, b.sys_type2 = :#{#condition.sysType2} )"+
|
||||
" and if(:#{#condition.isSysType3Empty} , 1=1, b.sys_type3 = :#{#condition.sysType3} )"+
|
||||
" order by a.sys_create_time DESC, a.read_flag ASC ) as c group by c.id) as d")
|
||||
@Query(nativeQuery = true, value =
|
||||
" SELECT c.* FROM ( " +
|
||||
" SELECT b.*,a.sys_create_time as recommendPushTime" +
|
||||
" FROM boe_cases_recommend_push_record a " +
|
||||
" LEFT JOIN boe_cases b ON a.case_id = b.id " +
|
||||
" WHERE b.deleted = 0 " +
|
||||
" AND a.push_status = 3 " +
|
||||
" AND a.deleted = 0 " +
|
||||
" AND a.push_user_id = :#{#condition.userId} " +
|
||||
" AND IF(IFNULL(:#{#condition.keyWord}, '') != '', " +
|
||||
" b.title LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.author_name LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword1 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword2 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword3 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword4 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword5 LIKE CONCAT('%', :#{#condition.keyWord}, '%'), " +
|
||||
" 1 = 1) " +
|
||||
" AND IF(:#{#condition.yearsEmpty}, 1 = 1, YEAR(b.sys_create_time) IN (:#{#condition.years})) " +
|
||||
" AND IF(:#{#condition.caseIdsEmpty}, 1 = 1, b.id IN (:#{#condition.caseIds})) " +
|
||||
" AND ( " +
|
||||
" IF(:#{#condition.allOrgEmpty}, 1 = 1, 1 = 2) " +
|
||||
" OR IF(:#{#condition.org1Empty}, 1 = 2, b.org_domain_parent IN (:#{#condition.org1})) " +
|
||||
" OR IF(:#{#condition.org2Empty}, 1 = 2, b.org_domain_parent2 IN (:#{#condition.org2})) " +
|
||||
" OR IF(:#{#condition.org3Empty}, 1 = 2, b.org_domain_parent3 IN (:#{#condition.org3})) " +
|
||||
" ) " +
|
||||
" AND IF(:#{#condition.isSysType1Empty}, 1 = 1, b.sys_type1 = :#{#condition.sysType1}) " +
|
||||
" AND IF(:#{#condition.isSysType2Empty}, 1 = 1, b.sys_type2 = :#{#condition.sysType2}) " +
|
||||
" AND IF(:#{#condition.isSysType3Empty}, 1 = 1, b.sys_type3 = :#{#condition.sysType3}) " +
|
||||
" ) AS c GROUP BY c.id " +
|
||||
" ORDER BY " +
|
||||
" IF(:#{#condition.orderField}='views' and :#{#condition.orderAsc}=true,c.views, null) asc," +
|
||||
" IF(:#{#condition.orderField}='views' and :#{#condition.orderAsc}=false,c.views, null) desc," +
|
||||
" IF(:#{#condition.orderField}='sysCreateTime' and :#{#condition.orderAsc}=true ,c.sys_create_time,null) asc," +
|
||||
" IF(:#{#condition.orderField}='sysCreateTime' and :#{#condition.orderAsc}=false , c.sys_create_time,null) desc," +
|
||||
" IF(:#{#condition.orderField}='recommendPushTime', c.recommendPushTime,null) desc",
|
||||
countQuery =
|
||||
" SELECT count(*) FROM ( " +
|
||||
" SELECT b.*,a.sys_create_time as recommendPushTime" +
|
||||
" FROM boe_cases_recommend_push_record a " +
|
||||
" LEFT JOIN boe_cases b ON a.case_id = b.id " +
|
||||
" WHERE b.deleted = 0 " +
|
||||
" AND a.push_status = 3 " +
|
||||
" AND a.deleted = 0 " +
|
||||
" AND a.push_user_id = :#{#condition.userId} " +
|
||||
" AND IF(IFNULL(:#{#condition.keyWord}, '') != '', " +
|
||||
" b.title LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.author_name LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword1 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword2 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword3 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword4 LIKE CONCAT('%', :#{#condition.keyWord}, '%') " +
|
||||
" OR b.keyword5 LIKE CONCAT('%', :#{#condition.keyWord}, '%'), " +
|
||||
" 1 = 1) " +
|
||||
" AND IF(:#{#condition.yearsEmpty}, 1 = 1, YEAR(b.sys_create_time) IN (:#{#condition.years})) " +
|
||||
" AND IF(:#{#condition.caseIdsEmpty}, 1 = 1, b.id IN (:#{#condition.caseIds})) " +
|
||||
" AND ( " +
|
||||
" IF(:#{#condition.allOrgEmpty}, 1 = 1, 1 = 2) " +
|
||||
" OR IF(:#{#condition.org1Empty}, 1 = 2, b.org_domain_parent IN (:#{#condition.org1})) " +
|
||||
" OR IF(:#{#condition.org2Empty}, 1 = 2, b.org_domain_parent2 IN (:#{#condition.org2})) " +
|
||||
" OR IF(:#{#condition.org3Empty}, 1 = 2, b.org_domain_parent3 IN (:#{#condition.org3})) " +
|
||||
" ) " +
|
||||
" AND IF(:#{#condition.isSysType1Empty}, 1 = 1, b.sys_type1 = :#{#condition.sysType1}) " +
|
||||
" AND IF(:#{#condition.isSysType2Empty}, 1 = 1, b.sys_type2 = :#{#condition.sysType2}) " +
|
||||
" AND IF(:#{#condition.isSysType3Empty}, 1 = 1, b.sys_type3 = :#{#condition.sysType3}) " +
|
||||
" ) AS c GROUP BY c.id " +
|
||||
" ORDER BY " +
|
||||
" IF(:#{#condition.orderField}='views' and :#{#condition.orderAsc}=true,c.views, null) asc," +
|
||||
" IF(:#{#condition.orderField}='views' and :#{#condition.orderAsc}=false,c.views, null) desc," +
|
||||
" IF(:#{#condition.orderField}='sysCreateTime' and :#{#condition.orderAsc}=true ,c.sys_create_time,null) asc," +
|
||||
" IF(:#{#condition.orderField}='sysCreateTime' and :#{#condition.orderAsc}=false , c.sys_create_time,null) desc," +
|
||||
" IF(:#{#condition.orderField}='recommendPushTime', c.recommendPushTime,null) desc"
|
||||
)
|
||||
Page<Cases> queryList(Pageable pageable, @Param("condition") CasePageVo casePage);
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xboe.module.boecase.entity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import com.xboe.module.boecase.vo.CaseViewRankingItemVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -248,16 +249,7 @@ public class Cases extends BaseEntity {
|
||||
@Column(name = "case_value")
|
||||
private String caseValue;
|
||||
|
||||
// 种类字段1
|
||||
// 暂不上线
|
||||
// @Column(name = "sys_type1")
|
||||
// private String sysType1;
|
||||
//种类字段2
|
||||
// @Column(name = "sys_type2")
|
||||
// private String sysType2;
|
||||
//种类字段3
|
||||
// @Column(name = "sys_type3")
|
||||
// private String sysType3;
|
||||
|
||||
|
||||
/**
|
||||
* 最佳案例标识
|
||||
@@ -272,6 +264,48 @@ public class Cases extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime excellentTime;
|
||||
|
||||
/**
|
||||
* 最佳时间
|
||||
* */
|
||||
@Column(name = "excellent_reason")
|
||||
private String excellentReason;
|
||||
|
||||
/**
|
||||
* 上月浏览量
|
||||
*/
|
||||
@Column(name = "last_month_views")
|
||||
private Integer lastMonthViews;
|
||||
|
||||
/**
|
||||
* 上季度浏览量
|
||||
*/
|
||||
@Column(name = "last_quarter_views")
|
||||
private Integer lastQuarterViews;
|
||||
|
||||
/**
|
||||
* 上季度点赞量
|
||||
*/
|
||||
@Column(name = "last_quarter_praises")
|
||||
private Integer lastQuarterPraises;
|
||||
|
||||
/**
|
||||
* 推荐榜排序
|
||||
* */
|
||||
@Column(name = "recommend_rank")
|
||||
private Integer recommendRank;
|
||||
|
||||
/**
|
||||
* 推送用户名称
|
||||
*/
|
||||
@Column(name = "recommend_rank_push_user_name")
|
||||
private String recommendRankPushUserName;
|
||||
|
||||
/**
|
||||
* 推送时间
|
||||
*/
|
||||
@Column(name = "recommend_rank_push_time")
|
||||
private LocalDateTime recommendRankPushTime;
|
||||
|
||||
/**
|
||||
* type 种类
|
||||
* 区分 案例/推荐案例
|
||||
@@ -279,11 +313,6 @@ public class Cases extends BaseEntity {
|
||||
@Transient
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
||||
|
||||
@Transient
|
||||
private List<String> majorIds;
|
||||
|
||||
@@ -296,6 +325,15 @@ public class Cases extends BaseEntity {
|
||||
@Transient
|
||||
private String refId;
|
||||
|
||||
@Transient
|
||||
private String excellentTag;
|
||||
|
||||
@Transient
|
||||
private List<CaseViewRankingItemVo> viewRankTags;
|
||||
|
||||
@Transient
|
||||
private List<String> authorTags;
|
||||
|
||||
public String getRefId() {
|
||||
return refId;
|
||||
}
|
||||
@@ -380,7 +418,7 @@ public class Cases extends BaseEntity {
|
||||
this.title=title;
|
||||
}
|
||||
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites,Boolean deleted
|
||||
,String sysCreateBy,String sysCreateAid){
|
||||
,String sysCreateBy,String sysCreateAid){
|
||||
this.title=title;
|
||||
super.setId(id);
|
||||
this.authorId=authorId;
|
||||
@@ -398,7 +436,6 @@ public class Cases extends BaseEntity {
|
||||
this.favorites=favorites;
|
||||
super.setDeleted(deleted);
|
||||
}
|
||||
|
||||
public Cases(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
@@ -415,4 +452,29 @@ public class Cases extends BaseEntity {
|
||||
this.authorName = authorName;
|
||||
this.confidentialityLevel = confidentialityLevel;
|
||||
}
|
||||
|
||||
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites,Boolean deleted
|
||||
,String sysCreateBy,String sysCreateAid,String keyword1,String keyword2,String keyword3,String keyword4,String keyword5){
|
||||
this.title=title;
|
||||
super.setId(id);
|
||||
this.authorId=authorId;
|
||||
this.authorName=authorName;
|
||||
super.setSysCreateTime(sysCreateTime);
|
||||
super.setSysCreateAid(sysCreateAid);
|
||||
super.setSysCreateBy(sysCreateBy);
|
||||
this.summary=summary;
|
||||
this.coverUrl=coverUrl;
|
||||
this.breCommend=breCommend;
|
||||
this.views=views;
|
||||
this.comments=comments;
|
||||
this.praises=praises;
|
||||
this.shares=shares;
|
||||
this.favorites=favorites;
|
||||
this.keyword1=keyword1;
|
||||
this.keyword2=keyword2;
|
||||
this.keyword3=keyword3;
|
||||
this.keyword4=keyword4;
|
||||
this.keyword5=keyword5;
|
||||
super.setDeleted(deleted);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xboe.module.boecase.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 案例推荐表
|
||||
* @TableName boe_cases_rank
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Entity
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = SysConstant.TABLE_PRE+"cases_rank")
|
||||
public class CasesRank extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 案例ID
|
||||
*/
|
||||
@Column(name = "case_id")
|
||||
private Long caseId;
|
||||
|
||||
/**
|
||||
* 专业ID
|
||||
*/
|
||||
@Column(name = "major_id")
|
||||
private String majorId;
|
||||
|
||||
/**
|
||||
* 排名
|
||||
*/
|
||||
@Column(name = "rank")
|
||||
private Integer rank;
|
||||
|
||||
/**
|
||||
* 浏览量每月增量
|
||||
*/
|
||||
@Column(name = "monthly_increment")
|
||||
private Integer monthlyIncrement;
|
||||
|
||||
|
||||
@Column(name = "rise_rank_time")
|
||||
private LocalDateTime riseRankTime;
|
||||
|
||||
@Transient
|
||||
private String majorName;
|
||||
|
||||
public CasesRank(String majorId, LocalDateTime riseRankTime) {
|
||||
this.majorId = majorId;
|
||||
this.riseRankTime = riseRankTime;
|
||||
}
|
||||
}
|
||||
@@ -54,8 +54,15 @@ public class CasesRecommend extends BaseEntity {
|
||||
public CasesRecommend() {
|
||||
}
|
||||
|
||||
|
||||
public CasesRecommend(String id, String recommendOrgName) {
|
||||
this.setId(id);
|
||||
this.recommendOrgName = recommendOrgName;
|
||||
}
|
||||
|
||||
public CasesRecommend(String id, String recommendOrgName,LocalDateTime recommendTime) {
|
||||
this.setId(id);
|
||||
this.recommendOrgName = recommendOrgName;
|
||||
this.recommendTime = recommendTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package com.xboe.module.boecase.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.module.boecase.vo.CasesBrowsingHistoryVo;
|
||||
import com.xboe.module.boecase.vo.CaseRankingVo;
|
||||
import com.xboe.module.boecase.vo.CasesQueryRecommendRankVo;
|
||||
import com.xboe.module.boecase.vo.FavoriteCaseOfIndexVo;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.school.vo.CasesVo;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.transaction.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ICasesService{
|
||||
/**
|
||||
* 案例分页搜索,是否被推荐
|
||||
@@ -91,7 +99,7 @@ public interface ICasesService{
|
||||
/**
|
||||
* 用于二次查询
|
||||
* */
|
||||
List<Cases> ids(List<String> ids);
|
||||
List<Cases> ids(List<String> ids, String accountId);
|
||||
|
||||
/**
|
||||
*二期 首页的推荐案例
|
||||
@@ -101,7 +109,7 @@ public interface ICasesService{
|
||||
/**
|
||||
* 设置或者取消优秀案例
|
||||
* */
|
||||
void excellent(String id,Boolean excellent);
|
||||
void excellent(String id, Boolean excellent, String excellentReason);
|
||||
|
||||
|
||||
PageList<Cases> queryRecommendPageCasesV2(CasePageVo req);
|
||||
@@ -110,5 +118,27 @@ public interface ICasesService{
|
||||
|
||||
List<String> getCaseYears();
|
||||
|
||||
@Transactional
|
||||
void refreshViewsRankOfMajor();
|
||||
|
||||
void refreshLastQuarterStatistics();
|
||||
|
||||
List<CasesQueryRecommendRankVo> queryRecommendRank(Integer pageSize);
|
||||
|
||||
void riseIntoRank(Long caseId, CurrentUser currentUser);
|
||||
|
||||
void cancelRiseIntoRank(Long caseId);
|
||||
|
||||
void adjustRank(List<Long> caseIdList);
|
||||
|
||||
List<CaseRankingVo> queryRank(Integer pageSize, Integer rankType);
|
||||
|
||||
List<Cases> queryPopularityOfMajor(Integer pageSize, String 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,14 @@ package com.xboe.module.boecase.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.UserDynamic;
|
||||
import com.xboe.api.vo.UserDynamicResult;
|
||||
import com.xboe.api.vo.UserdynamicParam;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.OrderDirection;
|
||||
import com.xboe.common.PageList;
|
||||
@@ -11,29 +17,41 @@ import com.xboe.common.utils.IDGenerator;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.orm.*;
|
||||
import com.xboe.enums.CasesRankEnum;
|
||||
import com.xboe.module.boecase.dao.*;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.entity.CasesRecommend;
|
||||
import com.xboe.module.boecase.entity.CasesRecommendPushRecord;
|
||||
import com.xboe.module.boecase.entity.*;
|
||||
import com.xboe.module.boecase.service.ICasesService;
|
||||
import com.xboe.module.boecase.vo.*;
|
||||
import com.xboe.module.dict.dao.SysDictionaryDao;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.interaction.entity.Favorites;
|
||||
import com.xboe.orm.CustomFieldInFilter;
|
||||
import com.xboe.school.vo.CasesVo;
|
||||
import com.xboe.standard.enums.BoedxResourceType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Array;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
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;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -61,6 +79,15 @@ public class CasesServiceImpl implements ICasesService {
|
||||
@Autowired
|
||||
private CasesRecommendDao casesRecommendDao;
|
||||
|
||||
@Resource
|
||||
private CasesRankDao casesRankDao;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
/**
|
||||
* 案例分页查询,用于门户的查询
|
||||
*/
|
||||
@@ -178,12 +205,6 @@ public class CasesServiceImpl implements ICasesService {
|
||||
@Override
|
||||
public PageList<Cases> queryPageCasesV2(CasePageVo caseVo) {
|
||||
|
||||
String type = caseVo.getType();
|
||||
if (!StrUtil.equals(type,"excellent")) {
|
||||
caseVo.setOrderField("");
|
||||
caseVo.setOrderAsc(null);
|
||||
}
|
||||
|
||||
String keyword = caseVo.getKeyWord();
|
||||
QueryBuilder query = QueryBuilder.from(Cases.class);
|
||||
PageList<Cases> page = null;
|
||||
@@ -296,18 +317,16 @@ public class CasesServiceImpl implements ICasesService {
|
||||
filters.add(FieldFilters.eq("excellent", caseVo.getExcellent()));
|
||||
}
|
||||
OrderCondition order = null;
|
||||
if (StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if (caseVo.getOrderAsc() == null || caseVo.getOrderAsc()) {
|
||||
if (StringUtils.isNotBlank(caseVo.getOrderField()) && caseVo.getOrderAsc() != null && ("sysCreateTime".equals(caseVo.getOrderField()) || "views".equals(caseVo.getOrderField()))) {
|
||||
if (caseVo.getOrderAsc()) {
|
||||
order = OrderCondition.asc(caseVo.getOrderField());
|
||||
} else {
|
||||
order = OrderCondition.desc(caseVo.getOrderField());
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(type,"new")) {
|
||||
} else {
|
||||
order = OrderCondition.desc("sysCreateTime");
|
||||
} else if (StrUtil.equals(type,"hot")) {
|
||||
order = OrderCondition.desc("views");
|
||||
}
|
||||
|
||||
if(Objects.nonNull(order)) {
|
||||
query.addOrder(order);
|
||||
}
|
||||
@@ -315,53 +334,18 @@ public class CasesServiceImpl implements ICasesService {
|
||||
query.setPageIndex(caseVo.getPageIndex());
|
||||
query.setPageSize(caseVo.getPageSize());
|
||||
page = casesDao.findPage(query.builder());
|
||||
List<Cases> list = page.getList();
|
||||
list.forEach(it->{
|
||||
List<Cases> casesList = page.getList();
|
||||
casesList.forEach(it->{
|
||||
it.setBreCommend(0);
|
||||
});
|
||||
if (CollUtil.isNotEmpty(list) && StrUtil.isNotBlank(caseVo.getUserId())) {
|
||||
List<String> caseIds = list.stream().map(Cases::getId).collect(Collectors.toList());
|
||||
QueryBuilder recommendCasesQuery = QueryBuilder.from(CasesRecommendPushRecord.class);
|
||||
recommendCasesQuery.addField("new CasesRecommendPushRecord(id,recommendId,caseId)");
|
||||
List<IFieldFilter> subFilters = new ArrayList<>();
|
||||
subFilters.add(FieldFilters.eq("pushUserId", caseVo.getUserId()));
|
||||
subFilters.add(FieldFilters.in("caseId", caseIds));
|
||||
subFilters.add(FieldFilters.eq("pushStatus", 3));
|
||||
subFilters.add(FieldFilters.eq("deleted", Boolean.FALSE));
|
||||
|
||||
QueryBuilder queryBuilder = recommendCasesQuery.addFilters(subFilters)
|
||||
.addOrder("sysCreateTime", OrderDirection.DESC)
|
||||
.addGroupBy("caseId");
|
||||
List<CasesRecommendPushRecord> pushRecords = casesRecommendPushRecordDao.findList(queryBuilder.builder());
|
||||
if (CollUtil.isNotEmpty(pushRecords)) {
|
||||
List<String> rIds = pushRecords.stream().map(CasesRecommendPushRecord::getRecommendId).distinct().collect(Collectors.toList());
|
||||
QueryBuilder builder = QueryBuilder.from(CasesRecommend.class);
|
||||
builder.addField("new CasesRecommend(id,recommendOrgName)");
|
||||
List<IFieldFilter> recommendFilters = new ArrayList<>();
|
||||
recommendFilters.add(FieldFilters.eq("deleted", Boolean.FALSE));
|
||||
recommendFilters.add(FieldFilters.in("id", rIds));
|
||||
builder.addFilters(recommendFilters);
|
||||
List<CasesRecommend> recommands = casesRecommendDao.findList(builder.builder());
|
||||
if (CollUtil.isNotEmpty(recommands)) {
|
||||
Map<String, String> collect = recommands.stream().collect(Collectors.toMap(k -> k.getId(), v -> v.getRecommendOrgName()));
|
||||
list.forEach(it -> {
|
||||
CasesRecommendPushRecord one = CollUtil.findOne(pushRecords, (a) -> StrUtil.equals(a.getCaseId(), it.getId()));
|
||||
if (Objects.nonNull(one)) {
|
||||
String recommendOrgName = collect.get(one.getRecommendId());
|
||||
it.setBreCommend(1);
|
||||
it.setRecommendOrgName(recommendOrgName);
|
||||
} else {
|
||||
it.setBreCommend(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
casesList = caseListCommonHandle(casesList, caseVo.getUserId());
|
||||
page.setList(casesList);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageList<Cases> queryRecommendPageCasesV2(CasePageVo caseVo) {
|
||||
|
||||
@@ -408,37 +392,90 @@ public class CasesServiceImpl implements ICasesService {
|
||||
caseVo.setOrg2(level2);
|
||||
caseVo.setOrg3(level3);
|
||||
|
||||
Set<String> validOrderFields = new HashSet<>();
|
||||
validOrderFields.add("sysCreateTime");
|
||||
validOrderFields.add("views");
|
||||
validOrderFields.add("recommendPushTime");
|
||||
if (StringUtils.isBlank(caseVo.getOrderField()) || caseVo.getOrderAsc() == null || !validOrderFields.contains(caseVo.getOrderField())) {
|
||||
caseVo.setOrderField("recommendPushTime");
|
||||
caseVo.setOrderAsc(false);
|
||||
}
|
||||
|
||||
Page<Cases> cases = casesRecordDao.queryList(pageRequest,caseVo);
|
||||
PageList<Cases> pageList = new PageList<>();
|
||||
pageList.setCount((int) cases.getTotalElements());
|
||||
pageList.setPageSize(cases.getSize());
|
||||
List<Cases> content = cases.getContent();
|
||||
List<String> caseIds = content.stream().map(Cases::getId).collect(Collectors.toList());
|
||||
String userId = caseVo.getUserId();
|
||||
if (CollUtil.isNotEmpty(caseIds)) {
|
||||
QueryBuilder recommendCasesQuery = QueryBuilder.from(CasesRecommendPushRecord.class);
|
||||
recommendCasesQuery.addField("new CasesRecommendPushRecord(id,recommendId,caseId)");
|
||||
List<IFieldFilter> subFilters = new ArrayList<>();
|
||||
subFilters.add(FieldFilters.eq("pushUserId", userId));
|
||||
subFilters.add(FieldFilters.in("caseId", caseIds));
|
||||
subFilters.add(FieldFilters.eq("pushStatus", 3));
|
||||
subFilters.add(FieldFilters.eq("deleted", Boolean.FALSE));
|
||||
|
||||
QueryBuilder queryBuilder = recommendCasesQuery.addFilters(subFilters)
|
||||
caseListCommonHandle(content, caseVo.getUserId());
|
||||
|
||||
pageList.setList(content);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
private List<Cases> caseListCommonHandle(List<Cases> casesList, String accountId) {
|
||||
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());
|
||||
QueryBuilder queryBuilder = QueryBuilder.from(CasesRecommendPushRecord.class)
|
||||
.addField("new CasesRecommendPushRecord(id,recommendId,caseId)")
|
||||
.addFilters(Arrays.asList(
|
||||
FieldFilters.eq("pushUserId", accountId),
|
||||
FieldFilters.in("caseId", caseIdList),
|
||||
FieldFilters.eq("pushStatus", 3),
|
||||
FieldFilters.eq("deleted", Boolean.FALSE)
|
||||
))
|
||||
.addOrder("sysCreateTime", OrderDirection.DESC)
|
||||
.addGroupBy("caseId");
|
||||
|
||||
List<CasesRecommendPushRecord> pushRecords = casesRecommendPushRecordDao.findList(queryBuilder.builder());
|
||||
|
||||
if (CollUtil.isNotEmpty(pushRecords)) {
|
||||
List<String> rIds = pushRecords.stream().map(CasesRecommendPushRecord::getRecommendId).distinct().collect(Collectors.toList());
|
||||
QueryBuilder builder = QueryBuilder.from(CasesRecommend.class);
|
||||
List<IFieldFilter> recommendFilters = new ArrayList<>();
|
||||
recommendFilters.add(FieldFilters.eq("deleted", Boolean.FALSE));
|
||||
recommendFilters.add(FieldFilters.in("id", rIds));
|
||||
builder.addFilters(recommendFilters);
|
||||
QueryBuilder builder = QueryBuilder.from(CasesRecommend.class)
|
||||
.addField("new CasesRecommend(id,recommendOrgName,recommendTime)")
|
||||
.addFilters(Arrays.asList(
|
||||
FieldFilters.eq("deleted", Boolean.FALSE),
|
||||
FieldFilters.in("id", rIds)
|
||||
));
|
||||
|
||||
List<CasesRecommend> recommands = casesRecommendDao.findList(builder.builder());
|
||||
if (CollUtil.isNotEmpty(recommands)) {
|
||||
Map<String, CasesRecommend> collect = recommands.stream().collect(Collectors.toMap(k -> k.getId(), item->item));
|
||||
content.forEach(it -> {
|
||||
Map<String, CasesRecommend> collect = recommands.stream().collect(Collectors.toMap(k -> k.getId(), item -> item));
|
||||
casesList.forEach(it -> {
|
||||
CasesRecommendPushRecord one = CollUtil.findOne(pushRecords, (a) -> StrUtil.equals(a.getCaseId(), it.getId()));
|
||||
if (Objects.nonNull(one)) {
|
||||
CasesRecommend recommend = collect.get(one.getRecommendId());
|
||||
@@ -446,13 +483,76 @@ public class CasesServiceImpl implements ICasesService {
|
||||
it.setRefId(one.getId());
|
||||
it.setRecommendOrgName(recommend.getRecommendOrgName());
|
||||
it.setSysCreateTime(recommend.getRecommendTime());
|
||||
} else {
|
||||
it.setBreCommend(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
pageList.setList(content);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加案例标签、作者标签(最佳案例N篇、上榜浏览量TOP榜单N次)、案例标签(xx分类浏览量TOP、最佳案例)
|
||||
*/
|
||||
private void addAuthorTagAndCaseNewTag(List<Cases> caseList) {
|
||||
if (CollUtil.isEmpty(caseList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> authorIdList = caseList.stream().map(Cases::getAuthorId).distinct().collect(Collectors.toList());
|
||||
HashMap<String, Object> excellentCountMap = casesDao.findExcellentCount(authorIdList);
|
||||
HashMap<String, Object> viewTopCountMap = casesRankDao.findViewTopCount(authorIdList);
|
||||
|
||||
|
||||
caseList.forEach(e -> {
|
||||
// 获取浏览量上榜记录
|
||||
List<CasesRank> viewsRankRecords = casesRankDao.findViewsRankRecordByCaseId(e.getId());
|
||||
if (CollUtil.isNotEmpty(viewsRankRecords)) {
|
||||
// 拼接生成浏览量排行榜的标签
|
||||
List<CaseViewRankingItemVo> viewRankTags = viewsRankRecords.stream().map(casesRank -> {
|
||||
String pattern = casesRank.getRiseRankTime().getMonthValue() < 10 ? "yy年M月" : "yy年MM月";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
String time = casesRank.getRiseRankTime().format(formatter);
|
||||
|
||||
// 2023年6月 经营管理类 浏览量 TOP1
|
||||
String viewRankTag = time + casesRank.getMajorName() + "类浏览量TOP" + (casesRank.getRank() + 1);
|
||||
|
||||
CaseViewRankingItemVo caseViewRankingItemVo = new CaseViewRankingItemVo();
|
||||
caseViewRankingItemVo.setMajorId(String.valueOf(casesRank.getMajorId()));
|
||||
caseViewRankingItemVo.setMajorName(casesRank.getMajorName());
|
||||
caseViewRankingItemVo.setTagName(viewRankTag);
|
||||
caseViewRankingItemVo.setRiseRankTime(casesRank.getRiseRankTime());
|
||||
|
||||
return caseViewRankingItemVo;
|
||||
}).collect(Collectors.toList());
|
||||
e.setViewRankTags(viewRankTags);
|
||||
|
||||
}
|
||||
|
||||
// 拼接生成年度最佳标签
|
||||
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年"))+"度最佳");
|
||||
}
|
||||
}
|
||||
|
||||
List<String> authorTags = new ArrayList<>();
|
||||
|
||||
if (excellentCountMap.get(e.getAuthorId())!=null){
|
||||
String authorTagOfExcellent = excellentCountMap.get(e.getAuthorId()) + "篇最佳案例";
|
||||
authorTags.add(authorTagOfExcellent);
|
||||
}
|
||||
|
||||
if (viewTopCountMap.get(e.getAuthorId())!=null){
|
||||
String authorTagOfView = "上榜浏览量TOP榜单" + viewTopCountMap.get(e.getAuthorId()) + "次";
|
||||
authorTags.add(authorTagOfView);
|
||||
}
|
||||
|
||||
e.setAuthorTags(authorTags);
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -945,11 +1045,12 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cases> ids(List<String> ids) {
|
||||
public List<Cases> ids(List<String> ids, String accountId) {
|
||||
QueryBuilder builder = QueryBuilder.from(Cases.class);
|
||||
builder.addFilter(FieldFilters.in("id", ids));
|
||||
builder.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend,views,comments,praises,shares,favorites,deleted,sysCreateBy,sysCreateAid)");
|
||||
builder.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend,views,comments,praises,shares,favorites,deleted,sysCreateBy,sysCreateAid,keyword1,keyword2,keyword3,keyword4,keyword5)");
|
||||
List<Cases> cases = casesDao.findList(builder.builder());
|
||||
cases = caseListCommonHandle(cases, accountId);
|
||||
return cases;
|
||||
}
|
||||
|
||||
@@ -1078,15 +1179,385 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excellent(String id, Boolean excellent) {
|
||||
public void excellent(String id, Boolean excellent, String excellentReason) {
|
||||
//取消时,把时间清空
|
||||
if (excellent) {
|
||||
casesDao.updateMultiFieldById(id, UpdateBuilder.create("excellent", excellent), UpdateBuilder.create("excellentTime", LocalDateTime.now()));
|
||||
casesDao.updateMultiFieldById(id, UpdateBuilder.create("excellent", excellent), UpdateBuilder.create("excellentTime", LocalDateTime.now()), UpdateBuilder.create("excellentReason", excellentReason));
|
||||
} else {
|
||||
casesDao.updateMultiFieldById(id, UpdateBuilder.create("excellent", excellent), UpdateBuilder.create("excellentTime", null));
|
||||
casesDao.updateMultiFieldById(id, UpdateBuilder.create("excellent", excellent), UpdateBuilder.create("excellentTime", null), UpdateBuilder.create("excellentReason", null));
|
||||
}
|
||||
}
|
||||
|
||||
@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
|
||||
LocalDateTime lastDayOfLastMonth = LocalDateTime.now().minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()).toLocalDate().atTime(23, 59, 59); // 设置为当天的几乎结束时刻
|
||||
|
||||
int count = casesRankDao.sqlCount("SELECT count(1) FROM boe_cases_rank WHERE deleted=0 AND rise_rank_time = ?1" , lastDayOfLastMonth);
|
||||
if (count > 0){
|
||||
log.info("已生成上个月排行榜数据,本次不执行");
|
||||
throw new RuntimeException("已生成上个月排行榜数据,请将上月排行榜数据删除");
|
||||
}
|
||||
|
||||
//获取案例当月排名
|
||||
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";
|
||||
|
||||
List<Object> caseListOfObject = casesDao.sqlFindList(sql);
|
||||
|
||||
// 转为casesRank
|
||||
List<CasesRank> casesRankList = caseListOfObject.stream()
|
||||
.map(o -> {
|
||||
CasesRank casesRank = new CasesRank();
|
||||
casesRank.setCaseId(Long.valueOf(Array.get(o, 0).toString()));
|
||||
casesRank.setMajorId(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));
|
||||
|
||||
// 生成当前月不同分类的最新的浏览量排名
|
||||
ArrayList<CasesRank> lastMonthRank = new ArrayList<>();
|
||||
casesRankMap.forEach((majorId, caseList) -> {
|
||||
List<CasesRank> sortedCaseList = caseList.stream()
|
||||
.sorted(Comparator.comparingInt(CasesRank::getMonthlyIncrement).reversed()).limit(10)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
IntStream.range(0, sortedCaseList.size())
|
||||
.forEach(i -> sortedCaseList.get(i).setRank(i));
|
||||
lastMonthRank.addAll(sortedCaseList);
|
||||
});
|
||||
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseRankingVo> queryRank(Integer pageSize, Integer rankType) {
|
||||
if (pageSize == null) {
|
||||
pageSize = 3;
|
||||
}
|
||||
String cacheKey = "";
|
||||
// 获取缓存key
|
||||
for (CasesRankEnum enumValue : CasesRankEnum.values()) {
|
||||
if (rankType == enumValue.getType()) {
|
||||
// 格式如:case:rank:praise:all3
|
||||
cacheKey = enumValue.getCacheKey()+pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> caseListOfJson = stringRedisTemplate.opsForList().range(cacheKey, 0, -1);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(caseListOfJson)) {
|
||||
// 缓存中存在数据
|
||||
List<CaseRankingVo> casesList = caseListOfJson.stream().map(item -> JSONUtil.toBean(item, CaseRankingVo.class)).collect(Collectors.toList());
|
||||
return casesList;
|
||||
}
|
||||
|
||||
List<CaseRankingVo> casesList = casesDao.findRank(pageSize,rankType);
|
||||
|
||||
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);
|
||||
return casesList;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Cases> queryPopularityOfMajor(Integer pageSize, String majorId, LocalDateTime month, String accountId) {
|
||||
if (pageSize == null) {
|
||||
pageSize = 10;
|
||||
}
|
||||
|
||||
LocalDateTime startTime = month.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0);
|
||||
LocalDateTime endTime = YearMonth.from(month).atEndOfMonth().atTime(23, 59, 59);
|
||||
|
||||
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());
|
||||
|
||||
|
||||
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) {
|
||||
Integer order1 = collect.get(c1.getId());
|
||||
Integer order2 = collect.get(c2.getId());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<CasesQueryRecommendRankVo> queryRecommendRank(Integer pageSize) {
|
||||
QueryBuilder queryBuilder = QueryBuilder.from(Cases.class);
|
||||
queryBuilder.setPageSize(pageSize);
|
||||
queryBuilder.addFilter(FieldFilters.eq("deleted",false));
|
||||
queryBuilder.addFilter(FieldFilters.isNotNull("recommend_rank"));
|
||||
queryBuilder.addOrder(OrderCondition.asc("recommend_rank"));
|
||||
|
||||
List<Cases> recommendRank = casesDao.findList(queryBuilder.builder());
|
||||
|
||||
List<CasesQueryRecommendRankVo> collect = recommendRank.stream().map(e -> {
|
||||
CasesQueryRecommendRankVo casesQueryRecommendRankVo = new CasesQueryRecommendRankVo();
|
||||
casesQueryRecommendRankVo.setCaseId(e.getId());
|
||||
casesQueryRecommendRankVo.setCaseTitle(e.getTitle());
|
||||
casesQueryRecommendRankVo.setCaseAuthor(e.getAuthorName());
|
||||
casesQueryRecommendRankVo.setRecommendRankPushUserName(e.getRecommendRankPushUserName());
|
||||
casesQueryRecommendRankVo.setRecommendRankPusTime(e.getRecommendRankPushTime());
|
||||
return casesQueryRecommendRankVo;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void riseIntoRank(Long caseId, CurrentUser currentUser) {
|
||||
Cases caseOfNewRise = casesDao.findOne(FieldFilters.eq("id", String.valueOf(caseId)),FieldFilters.isNull("recommend_rank"),FieldFilters.eq("deleted",false));
|
||||
if (caseOfNewRise == null) {
|
||||
log.error("案例不存在或已经在榜,不可上榜", caseId);
|
||||
return;
|
||||
}
|
||||
|
||||
int count = casesDao.sqlCount("select count(1) from boe_cases where deleted=0 and recommend_rank is not null order by recommend_rank asc limit 10");
|
||||
|
||||
if (count == 10){
|
||||
log.error("已满10条,无法添加");
|
||||
throw new RuntimeException("已满10条,无法添加");
|
||||
}
|
||||
|
||||
caseOfNewRise.setRecommendRank(count);
|
||||
caseOfNewRise.setRecommendRankPushUserName(currentUser.getLoginName());
|
||||
caseOfNewRise.setRecommendRankPushTime(LocalDateTime.now());
|
||||
|
||||
casesDao.update(caseOfNewRise);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelRiseIntoRank(Long caseId) {
|
||||
Cases caseOfCancelRise = casesDao.findOne(FieldFilters.eq("id", String.valueOf(caseId)),FieldFilters.isNotNull("recommend_rank"),FieldFilters.eq("deleted",false));
|
||||
if (caseOfCancelRise == null) {
|
||||
log.error("案例不存在或已经在榜,不可下榜", caseId);
|
||||
return;
|
||||
}
|
||||
QueryBuilder queryBuilder = QueryBuilder.from(Cases.class);
|
||||
queryBuilder.setPageSize(10);
|
||||
queryBuilder.addFilter(FieldFilters.eq("deleted",false));
|
||||
queryBuilder.addOrder(OrderCondition.asc("recommend_rank"));
|
||||
queryBuilder.addFilter(FieldFilters.gt("recommend_rank",caseOfCancelRise.getRecommendRank()));
|
||||
List<Cases> recommendRank = casesDao.findList(queryBuilder.builder());
|
||||
|
||||
if (CollectionUtils.isEmpty(recommendRank)){
|
||||
// 更新排序
|
||||
for (int i = 0; i < recommendRank.size(); i++){
|
||||
Integer currentSort = recommendRank.get(i).getRecommendRank();
|
||||
recommendRank.get(i).setRecommendRank(currentSort - 1);
|
||||
casesDao.update(recommendRank.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
// 取消排序
|
||||
caseOfCancelRise.setRecommendRank(null);
|
||||
caseOfCancelRise.setRecommendRankPushTime(null);
|
||||
caseOfCancelRise.setRecommendRankPushUserName(null);
|
||||
casesDao.update(caseOfCancelRise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustRank(List<Long> caseIdList) {
|
||||
QueryBuilder queryBuilder = QueryBuilder.from(Cases.class);
|
||||
queryBuilder.setPageSize(10);
|
||||
queryBuilder.addFilter(FieldFilters.eq("deleted",false));
|
||||
queryBuilder.addFilter(FieldFilters.isNotNull("recommend_rank"));
|
||||
queryBuilder.addOrder(OrderCondition.asc("recommend_rank"));
|
||||
List<Cases> recommendRank = casesDao.findList(queryBuilder.builder());
|
||||
|
||||
// 遍历排序后的案例列表,并根据 caseIdList 设置或重置 recommendRank
|
||||
recommendRank.forEach(caseItem -> {
|
||||
int index = caseIdList.indexOf(Long.valueOf(caseItem.getId()));
|
||||
// 如果 ID 存在于 caseIdList 中,则设置推荐等级为该 ID 的索引位置,否则设置为 null
|
||||
if (index != -1) {
|
||||
caseItem.setRecommendRank(index);
|
||||
} else {
|
||||
caseItem.setRecommendRank(null);
|
||||
caseItem.setRecommendRankPushTime(null);
|
||||
caseItem.setRecommendRankPushUserName(null);
|
||||
}
|
||||
});
|
||||
|
||||
// 保存对案例排序的更改
|
||||
recommendRank.forEach(casesDao::update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<FavoriteCaseOfIndexVo> queryFavoriteCaseOfIndex(Integer pageIndex, Integer pageSize, String accountId) {
|
||||
String from = Favorites.class.getSimpleName()+" f,"+ Cases.class.getSimpleName()+" c";
|
||||
QueryBuilder builder = QueryBuilder.from(from);
|
||||
builder.addFields("f.id","f.sysCreateTime","c");
|
||||
|
||||
builder.addFilter(FieldFilters.eqField("f.objId","c.id"));
|
||||
builder.addFilter(FieldFilters.eq("f.objType", BoedxResourceType.Case.value()));
|
||||
builder.addFilter(FieldFilters.eq("f.sysCreateAid",accountId));
|
||||
builder.addFilter(FieldFilters.eq("c.deleted", false));
|
||||
builder.addOrder(OrderCondition.desc("f.sysCreateTime"));
|
||||
|
||||
builder.setPageIndex(pageIndex);
|
||||
builder.setPageSize(pageSize);
|
||||
|
||||
PageList<Object[]> pageFields=null;
|
||||
try {
|
||||
pageFields = casesDao.findPageFields(builder.builder());
|
||||
} catch (Exception e) {
|
||||
log.error("收藏案例查询错误",e);
|
||||
}
|
||||
|
||||
List<Object[]> list = pageFields.getList();
|
||||
|
||||
// 提取出 Cases 对象,添加标签
|
||||
List<Cases> casesList = list.stream().map(o -> {
|
||||
Cases cases = (Cases) o[2];
|
||||
FavoriteCaseOfIndexVo favoriteCaseOfIndexVo = new FavoriteCaseOfIndexVo();
|
||||
BeanUtils.copyProperties(cases, favoriteCaseOfIndexVo);
|
||||
favoriteCaseOfIndexVo.setFavoriteId(o[0].toString());
|
||||
favoriteCaseOfIndexVo.setFavoriteTime(LocalDateTime.parse(o[1].toString()));
|
||||
return favoriteCaseOfIndexVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
casesList = caseListCommonHandle(casesList, accountId);
|
||||
|
||||
List<FavoriteCaseOfIndexVo> collect = casesList.stream().map(cases -> (FavoriteCaseOfIndexVo) cases).collect(Collectors.toList());
|
||||
|
||||
PageList<FavoriteCaseOfIndexVo> favoriteCaseOfIndexVoPageList = new PageList<>();
|
||||
favoriteCaseOfIndexVoPageList.setList(collect);
|
||||
favoriteCaseOfIndexVoPageList.setPageSize(pageSize);
|
||||
favoriteCaseOfIndexVoPageList.setCount(pageFields.getCount());
|
||||
|
||||
return favoriteCaseOfIndexVoPageList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<CasesBrowsingHistoryVo> browsingHistory(Integer pageIndex, Integer pageSize, String accountId, HttpServletRequest request) {
|
||||
UserdynamicParam userdynamicParam = new UserdynamicParam();
|
||||
userdynamicParam.setPageIndex(pageIndex);
|
||||
userdynamicParam.setPageSize(pageSize);
|
||||
userdynamicParam.setContentType(3);
|
||||
userdynamicParam.setAid(Long.valueOf(accountId));
|
||||
userdynamicParam.setHidden("");
|
||||
|
||||
String token = request.getHeader("Xboe-Access-Token");
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
token = request.getHeader("token");
|
||||
}
|
||||
// 获取案例浏览记录
|
||||
UserDynamicResult userDynamicResult = thirdApi.getAllUserdynamicListOfCaseRead(userdynamicParam, token);
|
||||
|
||||
List<UserDynamic> allUserdynamicList = userDynamicResult.getList();
|
||||
List<String> collect = allUserdynamicList.stream().map(UserDynamic::getContentId).distinct().collect(Collectors.toList());
|
||||
// 查询案例信息
|
||||
List<Cases> caseList = this.ids(collect, accountId);
|
||||
Map<String, Cases> map = caseList.stream().collect(Collectors.toMap(Cases::getId, cases -> cases));
|
||||
|
||||
// 组合案例信息与浏览记录
|
||||
List<CasesBrowsingHistoryVo> batchHistoryVoList = allUserdynamicList.stream().map(userDynamic -> {
|
||||
CasesBrowsingHistoryVo browsingHistoryVo = new CasesBrowsingHistoryVo();
|
||||
browsingHistoryVo.setBrowsingHistoryId(userDynamic.getId());
|
||||
browsingHistoryVo.setContentInfo(userDynamic.getContentInfo());
|
||||
browsingHistoryVo.setEventTime(userDynamic.getEventTime());
|
||||
browsingHistoryVo.setContentId(userDynamic.getContentId());
|
||||
if (map.containsKey(userDynamic.getContentId())){
|
||||
// 重名属性,如ID,copy会出现覆盖。
|
||||
BeanUtils.copyProperties(map.get(userDynamic.getContentId()),browsingHistoryVo);
|
||||
}
|
||||
return browsingHistoryVo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
PageList<CasesBrowsingHistoryVo> pageList = new PageList<>();
|
||||
pageList.setList(batchHistoryVoList);
|
||||
pageList.setCount(userDynamicResult.getCount());
|
||||
pageList.setPageSize(userDynamicResult.getPageSize());
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> queryAllTimePopularityOfMajor() {
|
||||
QueryBuilder builder = QueryBuilder.from(CasesRank.class);
|
||||
builder.addField("new CasesRank(majorId,riseRankTime)");
|
||||
builder.addFilter(FieldFilters.eq("deleted",false));
|
||||
builder.addGroupBy("majorId");
|
||||
builder.addGroupBy("riseRankTime");
|
||||
List<CasesRank> list = casesRankDao.findList(builder.builder());
|
||||
// 定义日期时间的格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yy-MM");
|
||||
|
||||
Map<String, List<String>> collect = list.stream().collect(Collectors.groupingBy
|
||||
(CasesRank::getMajorId, Collectors.mapping(casesRank -> casesRank.getRiseRankTime().format(formatter), Collectors.toList())));
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CaseRankingVo {
|
||||
/**
|
||||
* 案例id
|
||||
*/
|
||||
private String caseId;
|
||||
|
||||
/**
|
||||
* 案例标题
|
||||
*/
|
||||
private String caseTitle;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CaseViewRankingItemVo {
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private String majorId;
|
||||
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
private String majorName;
|
||||
|
||||
/**
|
||||
* 上榜时间,目前默认为一月中的最后一天的23:59:59
|
||||
*/
|
||||
private LocalDateTime riseRankTime;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
private String tagName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CasesBrowsingHistoryVo extends Cases{
|
||||
|
||||
/**
|
||||
* 浏览记录id
|
||||
* */
|
||||
private String browsingHistoryId;
|
||||
|
||||
/**
|
||||
* 案例标题
|
||||
* */
|
||||
private String contentInfo;
|
||||
|
||||
/**
|
||||
* 事件时间,查看案例时,有定时接口触发,名为send,eventTime为该时间
|
||||
* */
|
||||
private LocalDateTime eventTime;
|
||||
|
||||
/**
|
||||
* 案例ID
|
||||
* */
|
||||
private String contentId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
public class CasesQueryRecommendRankVo {
|
||||
|
||||
/**
|
||||
* 案例id
|
||||
*/
|
||||
private String caseId;
|
||||
|
||||
/**
|
||||
* 案例标题
|
||||
*/
|
||||
private String caseTitle;
|
||||
|
||||
/**
|
||||
* 案例作者
|
||||
*/
|
||||
private String caseAuthor;
|
||||
|
||||
/**
|
||||
* 推送用户名称
|
||||
*/
|
||||
private String recommendRankPushUserName;
|
||||
|
||||
/**
|
||||
* 推送时间
|
||||
*/
|
||||
private LocalDateTime recommendRankPusTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xboe.module.boecase.entity.Cases;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class FavoriteCaseOfIndexVo extends Cases{
|
||||
|
||||
/**
|
||||
* 收藏id
|
||||
*/
|
||||
private String favoriteId;
|
||||
|
||||
/**
|
||||
* 收藏时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime favoriteTime;
|
||||
|
||||
}
|
||||
@@ -4,13 +4,10 @@ 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.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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
@@ -77,7 +74,22 @@ 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
|
||||
|
||||
@@ -1,57 +1,50 @@
|
||||
package com.xboe.module.course.api;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.AuditList;
|
||||
import com.xboe.api.vo.AuditListParam;
|
||||
import com.xboe.api.vo.UserDynamic;
|
||||
import com.xboe.api.vo.UserdynamicParam;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.core.JsonResponseStatus;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||
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.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.Course;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseCrowd;
|
||||
import com.xboe.module.course.entity.CourseSection;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
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.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -67,19 +60,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;
|
||||
|
||||
@@ -89,6 +82,15 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
|
||||
@Autowired
|
||||
IStudyHomeWorkService shomeworkService;
|
||||
|
||||
@Autowired
|
||||
IStudyService studyService;
|
||||
|
||||
@Autowired
|
||||
StudyCourseDao studyCourseDao;
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
@@ -108,9 +110,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){
|
||||
@@ -136,7 +138,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return success(rankingDtos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询列表,数量,类型,最新,最热
|
||||
* @param num
|
||||
@@ -162,7 +164,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
dto.setDevice(device);
|
||||
try {
|
||||
|
||||
|
||||
List<Course> list=courseService.findList(num, dto);
|
||||
return success(list);
|
||||
}catch(Exception e) {
|
||||
@@ -170,10 +172,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);
|
||||
@@ -195,9 +197,9 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success(coursePageList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +210,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
*/
|
||||
@PostMapping("/pagelist")
|
||||
public JsonResponse<PageList<Course>> findPage(Pagination pager,CourseQueryDto dto){
|
||||
|
||||
|
||||
//只是查询已发布的
|
||||
|
||||
dto.setPublish(true);
|
||||
@@ -229,11 +231,11 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return success(coursePageList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取详细信息
|
||||
* @param id
|
||||
@@ -244,19 +246,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);
|
||||
@@ -276,7 +278,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
if (!Objects.isNull(studyCourse)){
|
||||
pass = true;
|
||||
}
|
||||
if (Objects.isNull(studyCourse) && !courseCrowdList.isEmpty()) {
|
||||
if (Objects.isNull(studyCourse) && !courseCrowdList.isEmpty() && !StringUtils.isEmpty(audiences)) {
|
||||
List<String> audienceList = Arrays.asList(audiences.split(",")); // 此用户所在受众组
|
||||
log.error("---------------参数------------ audienceList = " + audienceList);
|
||||
for (CourseCrowd c : courseCrowdList) {
|
||||
@@ -299,7 +301,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) {
|
||||
@@ -319,7 +321,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
rs.put("isCrowd",pass);
|
||||
@@ -328,7 +330,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);
|
||||
@@ -347,7 +349,80 @@ 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 {
|
||||
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);
|
||||
|
||||
try {//筛选出的人员
|
||||
List<StudyCourseItem> list = studyService.getList(courseId, contentId, name, status);
|
||||
if(list.isEmpty()){
|
||||
return success("暂无数据");
|
||||
}
|
||||
for (StudyCourseItem s : list) {
|
||||
List<StudyHomeWork> studyHomeWorks = shomeworkService.getByStudyIdAndContentId(s.getStudyId(), contentId).stream().filter(e-> !Objects.equals(e.getFilePath(), "")).filter(e->e.getFilePath()!=null).collect(Collectors.toList());
|
||||
if(studyHomeWorks.isEmpty()){
|
||||
return success("暂无数据");
|
||||
}
|
||||
studyHomeWorks.forEach(e->{
|
||||
userBasicInfoList.forEach(u->{
|
||||
if(u.getUserId().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());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("导出异常"+e.getMessage());
|
||||
}
|
||||
long totalFileSize = map.values().stream()
|
||||
.mapToLong(path -> new File(path).length())
|
||||
.sum();
|
||||
// 检查文件总大小是否超过 2GB
|
||||
if (totalFileSize > 2L * 1024 * 1024 * 1024) {
|
||||
return success("您要下载的作业过大,请分批下载或联系管理员!");
|
||||
}
|
||||
// 创建压缩文件
|
||||
String zipFilePath = "/home/www/elearning/upload/saveZip/" + courseName+"【作业】" + ".zip";
|
||||
createZipFile(map, zipFilePath);
|
||||
return success(zipFilePath);
|
||||
}
|
||||
private static void createZipFile(Map<String, String> map, String zipFilePath) throws IOException {
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
|
||||
File file = new File(value);
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
ZipEntry zipEntry = new ZipEntry(key);
|
||||
zos.putNextEntry(zipEntry);
|
||||
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) > 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
zos.closeEntry();
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@GetMapping("/detail-study")
|
||||
public JsonResponse<List<CourseStudyVo>> detailStudy(String courseId, String aid){
|
||||
if(StringUtil.isBlank(courseId)){
|
||||
@@ -392,7 +467,7 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
cv.setStatus(9);
|
||||
}
|
||||
}
|
||||
//音视频
|
||||
//音视频
|
||||
}else{
|
||||
cv.setStatus(study.getStatus());
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -28,6 +29,7 @@ import com.xboe.module.course.service.ICourseFileService;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/xboe/m/course/cware")
|
||||
@Slf4j
|
||||
public class CourseWareApi extends ApiBaseController {
|
||||
|
||||
private String cookieName = "PLAYSIGN_TIME";
|
||||
@@ -97,24 +99,24 @@ public class CourseWareApi extends ApiBaseController {
|
||||
return badRequest("非法请求");
|
||||
// return;
|
||||
}
|
||||
|
||||
|
||||
String httpReferer = request.getHeader("referer");
|
||||
if (StringUtils.isBlank(httpReferer)) {
|
||||
return badRequest("非法请求");
|
||||
// return "非法请求";
|
||||
}
|
||||
|
||||
|
||||
boolean has=false;
|
||||
for(String txt :allowUrlSet) {
|
||||
if(httpReferer.indexOf(txt)>-1) {
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!has) {
|
||||
return badRequest("页面不存在");
|
||||
//return "非法请求";
|
||||
}
|
||||
for(String txt :allowUrlSet) {
|
||||
if(httpReferer.indexOf(txt)>-1) {
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!has) {
|
||||
return badRequest("页面不存在");
|
||||
//return "非法请求";
|
||||
}
|
||||
|
||||
//读取cookies中的时间
|
||||
String cookieTime = getSignTimeCookie(request);
|
||||
@@ -131,16 +133,22 @@ public class CourseWareApi extends ApiBaseController {
|
||||
// 第一个/前端是时间
|
||||
int index = signStr.indexOf("/");
|
||||
if (index <= 0) {
|
||||
log.info("解密后的字符串:"+signStr);
|
||||
log.info("解密后的字符串的时间拼接:"+index);
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
|
||||
String time = signStr.substring(0, signStr.indexOf("/"));// 时间字符中,long
|
||||
String cfid = signStr.substring(index+1);// 文件路径
|
||||
|
||||
if (!time.equals(cookieTime)) {
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
// if (!time.equals(cookieTime)) {
|
||||
// log.info("请求头时间和解析后的时间对比:"+"解析时间:"+time+" 请求头时间:"+cookieTime);
|
||||
// log.info("解密后的字符串的时间拼接:"+signStr);
|
||||
// return badRequest("验证错误");
|
||||
// }
|
||||
if(StringUtils.isBlank(cfid) || cfid.length()<10) {
|
||||
log.info("查看时间文件路径:"+cfid);
|
||||
log.info("解密后的字符串的时间拼接:"+signStr);
|
||||
return badRequest("验证错误");
|
||||
}
|
||||
|
||||
|
||||
@@ -83,8 +83,13 @@ public class CourseContent extends BaseEntity {
|
||||
* */
|
||||
@Column(name = "duration")
|
||||
private Integer duration;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 视频播放进度
|
||||
* */
|
||||
@Column(name = "progress_video")
|
||||
private Float progressVideo;
|
||||
|
||||
/**用于学习时的状态显示,非存储字段*/
|
||||
@Transient
|
||||
private Integer status;
|
||||
|
||||
@@ -82,4 +82,9 @@ public interface ICourseContentService{
|
||||
* @return
|
||||
*/
|
||||
CourseAssess getAssess(String ccid);
|
||||
|
||||
void updateProcessVideo(String contentId, String courseId, Float processVideo);
|
||||
|
||||
Object getPaperContentOfOnline(String courseExamId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
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.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 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.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.dao.*;
|
||||
import com.xboe.module.course.dto.CourseContentDto;
|
||||
import com.xboe.module.course.dto.SortItem;
|
||||
import com.xboe.module.course.entity.CourseAssess;
|
||||
@@ -23,8 +19,21 @@ 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 {
|
||||
|
||||
@@ -42,7 +51,13 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
|
||||
@Resource
|
||||
private CourseHomeWorkDao homeworkDao;
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseExamDao courseExamDao;
|
||||
|
||||
@Resource
|
||||
private ExamPaperDao examPaperDao;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -76,6 +91,9 @@ 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) {
|
||||
@@ -141,6 +159,17 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
return assess;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProcessVideo(String id, String courseId, Float progressVideo) {
|
||||
// 处理 processVideo 为 null 的情况
|
||||
if (progressVideo == null) {
|
||||
progressVideo = 0.00f;
|
||||
}
|
||||
String sql = "UPDATE boe_course_content SET progress_video = "+ progressVideo+" WHERE id = "+ id+" AND course_id = "+ courseId+" ";
|
||||
ccDao.sqlUpdate(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateName(String id, String name) {
|
||||
@@ -175,4 +204,68 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -354,18 +354,18 @@ public class AloneExamApi extends ApiBaseController {
|
||||
if(StringUtils.isBlank(paperJson)) {
|
||||
return badRequest("此考试无试卷内容,考试已经过期或试卷已被删除");
|
||||
}
|
||||
try {
|
||||
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
paperJson=objectMapper.writeValueAsString(qlist);
|
||||
} catch (XaskException e) {
|
||||
log.error("生成试卷错误",e);
|
||||
return error("生成考试试卷错误",e.getMessage(),map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("生成试卷,解析生成json错误",e);
|
||||
return error("生成考试试卷解析错误",e.getMessage(),map);
|
||||
}
|
||||
}
|
||||
try {
|
||||
List<TestQuestionVo> qlist=this.randomQuestion(examTest, paperJson);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
paperJson=objectMapper.writeValueAsString(qlist);
|
||||
} catch (XaskException e) {
|
||||
log.error("生成试卷错误",e);
|
||||
return error("生成考试试卷错误",e.getMessage(),map);
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("生成试卷,解析生成json错误",e);
|
||||
return error("生成考试试卷解析错误",e.getMessage(),map);
|
||||
}
|
||||
map.put("paper", paperJson);
|
||||
long end=System.currentTimeMillis();
|
||||
log.info("开始考试用时="+(end-start)+" ms");
|
||||
|
||||
@@ -166,118 +166,258 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
return badRequest("请上传正确的试题文件");
|
||||
}
|
||||
//获取表头
|
||||
Row row = sheetAt.getRow(1);
|
||||
Row row ;
|
||||
//从第二行开始获取数据
|
||||
List<ExamQuestion> examQuestions1 = new ArrayList<>();
|
||||
QuestionDto questionDto = new QuestionDto();
|
||||
if(sheetAt.getRow(1).getCell(0).getStringCellValue().equals("标题(*)") && !sheetAt.getRow(1).getCell(0).getStringCellValue().equals("")){
|
||||
row = sheetAt.getRow(1);
|
||||
for (int i = 2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||
//获取每一行
|
||||
|
||||
for (int i=2;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||
//获取每一行
|
||||
|
||||
Row row1 = sheetAt.getRow(i);
|
||||
if(row1==null || row1.getCell(0)==null){
|
||||
break;
|
||||
}
|
||||
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
||||
break;
|
||||
}
|
||||
ExamQuestion examQuestion = new ExamQuestion();
|
||||
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
||||
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
||||
examQuestion.setType(1);
|
||||
}
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
examQuestion.setKnowledge(row1.getCell(2).getStringCellValue());
|
||||
if(row1.getCell(3).getStringCellValue().equals("中")){
|
||||
examQuestion.setDifficulty(2f);
|
||||
}
|
||||
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);
|
||||
Row row1 = sheetAt.getRow(i);
|
||||
if(row1==null || row1.getCell(0)==null){
|
||||
break;
|
||||
}
|
||||
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
||||
break;
|
||||
}
|
||||
ExamQuestion examQuestion = new ExamQuestion();
|
||||
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
||||
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
||||
examQuestion.setType(1);
|
||||
}
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
if(row1.getCell(2).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);
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
// examQuestion.setDefaultScore(Float.valueOf(cell.getStringCellValue()));
|
||||
|
||||
//单选
|
||||
if (!cell.getStringCellValue().contains(",")){
|
||||
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());
|
||||
//单选
|
||||
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);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=7;j<=13;j++) {
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=6;j<=12;j++) {
|
||||
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
if(row1.getCell(j)!=null) {
|
||||
ExamOption examOption = new ExamOption();
|
||||
// 截取表头
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(6).getStringCellValue().contains(substring)) {
|
||||
String substring = row.getCell(j).getStringCellValue().substring(3, 4);
|
||||
if (row1.getCell(5).getStringCellValue().contains(substring)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
} else {
|
||||
examOption.setIsAnswer(false);
|
||||
}
|
||||
if (examOption.getIsAnswer()) {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(4).getStringCellValue()));
|
||||
}
|
||||
examOption.setIsAnswer(true);
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).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.setOptions(row.getCell(j).getStringCellValue());
|
||||
examOption.setOptions(row.getCell(j).getStringCellValue());
|
||||
|
||||
Cell cell2 = row1.getCell(j);
|
||||
cell2.setCellType(CellType.STRING);
|
||||
examOption.setContent(cell2.getStringCellValue());
|
||||
Cell cell2 = row1.getCell(j);
|
||||
cell2.setCellType(CellType.STRING);
|
||||
examOption.setContent(cell2.getStringCellValue());
|
||||
|
||||
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
||||
examOptions.add(examOption);
|
||||
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
}
|
||||
//多选 多选的默认分存的是最大分
|
||||
else{
|
||||
String stringCellValue = row1.getCell(4).getStringCellValue();
|
||||
String[] strings = stringCellValue.split(",");
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
}
|
||||
//多选 多选的默认分存的是最大分
|
||||
else{
|
||||
String stringCellValue = row1.getCell(4).getStringCellValue();
|
||||
String[] strings = stringCellValue.split(",");
|
||||
// String[] strings = new String[stringCellValue.length()];
|
||||
String max=strings[0];
|
||||
for (int j=0;j<strings.length;j++) {
|
||||
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
||||
max=strings[j];
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(5, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(6).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
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-7]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
String max=strings[0];
|
||||
for (int j=0;j<strings.length;j++) {
|
||||
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
||||
max=strings[j];
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=6;j<=12;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]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
row = sheetAt.getRow(2);
|
||||
for (int i = 3;i<sheetAt.getPhysicalNumberOfRows();i++) {
|
||||
//获取每一行
|
||||
|
||||
Row row1 = sheetAt.getRow(i);
|
||||
if(row1==null || row1.getCell(0)==null){
|
||||
break;
|
||||
}
|
||||
if(StringUtil.isBlank(row1.getCell(0).getStringCellValue())){
|
||||
break;
|
||||
}
|
||||
ExamQuestion examQuestion = new ExamQuestion();
|
||||
examQuestion.setTitle(row1.getCell(0).getStringCellValue());
|
||||
if(row1.getCell(1).getStringCellValue().equals("单选题")){
|
||||
examQuestion.setType(1);
|
||||
}
|
||||
if(row1.getCell(1).getStringCellValue().equals("多选题")){
|
||||
examQuestion.setType(2);
|
||||
}
|
||||
log.debug("row1.getCell(2) = " + row1.getCell(2));
|
||||
if (row1.getCell(2)==null ||row1.getCell(2).getStringCellValue() == null || row1.getCell(2).getStringCellValue().equals("")){
|
||||
examQuestion.setDifficulty(null);
|
||||
}else{
|
||||
if( row1.getCell(2).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);
|
||||
}
|
||||
}
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
Cell cell = row1.getCell(3);
|
||||
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);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
for (int j=6;j<=12;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)) {
|
||||
|
||||
examOption.setIsAnswer(true);
|
||||
if (row1.getCell(3).getStringCellValue().isEmpty()){
|
||||
examOption.setScore(null);
|
||||
}else {
|
||||
examOption.setScore(Float.valueOf(row1.getCell(3).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.setOptions(row.getCell(j).getStringCellValue());
|
||||
|
||||
Cell cell2 = row1.getCell(j);
|
||||
cell2.setCellType(CellType.STRING);
|
||||
examOption.setContent(cell2.getStringCellValue());
|
||||
|
||||
if (examOption != null && StringUtil.isNotBlank(examOption.getContent())) {
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
}
|
||||
//多选 多选的默认分存的是最大分
|
||||
else{
|
||||
String stringCellValue = row1.getCell(4).getStringCellValue();
|
||||
String[] strings = stringCellValue.split(",");
|
||||
// String[] strings = new String[stringCellValue.length()];
|
||||
String max=strings[0];
|
||||
for (int j=0;j<strings.length;j++) {
|
||||
if(Float.valueOf(max)<Float.valueOf(strings[j])){
|
||||
max=strings[j];
|
||||
}
|
||||
}
|
||||
examQuestion.setDefaultScore(Float.valueOf(max));
|
||||
Cell cell1 = row1.getCell(4, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion.setAnalysis(cell1.getStringCellValue());
|
||||
examQuestion.setAnswer(row1.getCell(5).getStringCellValue());
|
||||
List<ExamOption> examOptions = new ArrayList<>();
|
||||
//A
|
||||
for (int j=6;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]));
|
||||
if(examOption!=null && StringUtil.isNotBlank(examOption.getContent())){
|
||||
examOptions.add(examOption);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
examQuestion.setOptionList(examOptions);
|
||||
examQuestions1.add(examQuestion);
|
||||
}
|
||||
}
|
||||
}
|
||||
//判断题 只存在试题表中
|
||||
@@ -300,27 +440,30 @@ public class ExamQuestionApi extends ApiBaseController {
|
||||
ExamQuestion examQuestion1 = new ExamQuestion();
|
||||
examQuestion1.setTitle(row2.getCell(0).getStringCellValue());
|
||||
examQuestion1.setType(3);
|
||||
examQuestion1.setKnowledge(row2.getCell(1).getStringCellValue());
|
||||
if(row2.getCell(2).getStringCellValue().equals("中")){
|
||||
System.out.println("1+++++++"+row2.getCell(1));
|
||||
if(row2.getCell(1).getStringCellValue().equals("中")){
|
||||
examQuestion1.setDifficulty(2f);
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("难")){
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("难")){
|
||||
examQuestion1.setDifficulty(3f);
|
||||
}
|
||||
if(row2.getCell(2).getStringCellValue().equals("易")){
|
||||
} else if(row2.getCell(1).getStringCellValue().equals("易")){
|
||||
examQuestion1.setDifficulty(1f);
|
||||
}else if(row2.getCell(1).getStringCellValue().equals("")){
|
||||
examQuestion1.setDifficulty(null);
|
||||
}
|
||||
Cell cell1 = row2.getCell(3);
|
||||
Cell cell1 = row2.getCell(2);
|
||||
cell1.setCellType(CellType.STRING);
|
||||
examQuestion1.setDefaultScore(Float.valueOf(cell1.getStringCellValue()));
|
||||
|
||||
if(row2.getCell(4)!=null) {
|
||||
examQuestion1.setAnalysis(row2.getCell(4).getStringCellValue());
|
||||
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());
|
||||
}else {
|
||||
examQuestion1.setAnalysis("");
|
||||
}
|
||||
|
||||
String cvalue=row2.getCell(5).getStringCellValue();
|
||||
String cvalue=row2.getCell(4).getStringCellValue();
|
||||
examQuestion1.setAnswer(cvalue.equals("正确")? "true":"false");
|
||||
if(examQuestion1!=null){
|
||||
examQuestions2.add(examQuestion1);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 考试名称
|
||||
* */
|
||||
@Column(name = "test_name",nullable = false,length = 50)
|
||||
@Column(name = "test_name",length = 50)
|
||||
private String testName;
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 考试时长 分钟
|
||||
* */
|
||||
@Column(name = "test_duration",nullable = false)
|
||||
@Column(name = "test_duration")
|
||||
private Integer testDuration;
|
||||
/**
|
||||
* 显示解析
|
||||
@@ -107,13 +107,13 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 考试的类型
|
||||
* */
|
||||
@Column(name = "test_type",nullable = false)
|
||||
@Column(name = "test_type")
|
||||
private Integer testType;
|
||||
|
||||
/**
|
||||
* 发布状态 ,是否已发布
|
||||
*/
|
||||
@Column(name = "published",length = 1,nullable = false)
|
||||
@Column(name = "published",length = 1)
|
||||
private Boolean published;
|
||||
/**
|
||||
* 发布时间
|
||||
@@ -154,7 +154,7 @@ public class ExamTest extends BaseEntity {
|
||||
/**
|
||||
* 范围,1表独立使用,2表课程内部
|
||||
* */
|
||||
@Column(name = "range_type",nullable = false)
|
||||
@Column(name = "range_type")
|
||||
private Integer rangeType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
|
||||
@Override
|
||||
public Boolean has(String paperId) {
|
||||
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId));
|
||||
ExamTest et=examTestDao.findOne(FieldFilters.eq("paperId", paperId),FieldFilters.eq("deleted", false));
|
||||
//String etId= (String)examTestDao.findField("id", FieldFilters.eq("paperId", paperId));
|
||||
if(et==null){
|
||||
return true;
|
||||
|
||||
@@ -12,6 +12,7 @@ public class FavoriteCaseDto {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime time;
|
||||
/**
|
||||
|
||||
@@ -3,14 +3,13 @@ package com.xboe.school.study.api;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.common.util.concurrent.RateLimiter;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.*;
|
||||
import com.xboe.constants.CacheName;
|
||||
import com.xboe.module.course.vo.TeacherVo;
|
||||
import com.xboe.module.usergroup.entity.UserGroupItem;
|
||||
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;
|
||||
@@ -178,7 +177,7 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
if (!Objects.isNull(studyCourse)){
|
||||
pass = true;
|
||||
}
|
||||
if (Objects.isNull(studyCourse) && !courseCrowdList.isEmpty()) {
|
||||
if (Objects.isNull(studyCourse) && !courseCrowdList.isEmpty() && !StringUtils.isEmpty(audiences)) {
|
||||
List<String> audienceList = Arrays.asList(audiences.split(",")); // 此用户所在受众组
|
||||
log.error("---------------参数------------ audienceList = " + audienceList);
|
||||
for (CourseCrowd c : courseCrowdList) {
|
||||
@@ -324,17 +323,32 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
//检查是否已存在
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
studyService.updateProcess(item.getId(), sci.getStudyId(), sci.getCourseId(), sci.getContentTotal(), sci.getProgress(),token);
|
||||
String studyKey = CacheName.NAME_AUTH + ":" + CacheName.STUDY_KEY + item.getCourseId()+":"+cuser.getAccountId()+":"+item.getContentId();
|
||||
String studyKey2 = CacheName.NAME_AUTH + ":" + CacheName.STUDY_KEY + sci.getCourseId()+":"+cuser.getAccountId()+":"+sci.getContentId();
|
||||
redisTemplate.opsForValue().set(studyKey,
|
||||
String.valueOf(item.getProgress()), 2, TimeUnit.HOURS);
|
||||
String progressStr = redisTemplate.opsForValue().get(studyKey2);
|
||||
if (progressStr != null && !progressStr.isEmpty()) {
|
||||
// 尝试将 Redis 中的字符串转换为整数
|
||||
int redisProgress = Integer.parseInt(progressStr);
|
||||
// 假设 item.getProgress() 返回的是 int 类型
|
||||
int sciProgress = sci.getProgress();
|
||||
|
||||
if (redisProgress < sciProgress && redisProgress < 100) {
|
||||
// 执行一些操作
|
||||
// if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
// }
|
||||
studyService.updateProcess(item.getId(), sci.getStudyId(), sci.getCourseId(), sci.getContentTotal(), sci.getProgress(),token);
|
||||
}
|
||||
}
|
||||
//追加学习时长
|
||||
studyService.appendStudyDuration(sci.getStudyId(),item.getId(),sci.getContentId(),sci.getDuration());
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(sci.getStudyId() ,sci.getCourseId(), token);
|
||||
log.info("在线课学习记录"+allUserList);
|
||||
return success(item.getId());
|
||||
//如果记录存在,但是进度不100无成情况,就更新进度,一期不会有这种情况
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isBlank(sci.getCourseId())){
|
||||
return error("无课程信息");
|
||||
}
|
||||
@@ -529,7 +543,7 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/study-video-time")
|
||||
public JsonResponse<Boolean> study(String studyId,String itemId,Integer videoTime){
|
||||
public JsonResponse<Boolean> study(String itemId,Integer videoTime,String contentId , String courseId,Float progressVideo){
|
||||
|
||||
if(StringUtils.isBlank(itemId)){
|
||||
return error("参数错误");
|
||||
@@ -539,7 +553,10 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
}
|
||||
//检查是否已存在
|
||||
try {
|
||||
studyService.updateLastTime(itemId,videoTime,getCurrent().getAccountId());
|
||||
studyService.updateLastTime(itemId,videoTime, getCurrent().getAccountId());
|
||||
if (contentId != null && courseId != null && progressVideo != null){
|
||||
contentService.updateProcessVideo(contentId, courseId, progressVideo);
|
||||
}
|
||||
return success(true);
|
||||
}catch(Exception e) {
|
||||
log.error("记录最后学习时间错误",e);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.school.study.dao.StudyCourseDao;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,6 +33,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@RestController
|
||||
@RequestMapping(value="/xboe/school/study/exam")
|
||||
public class StudyExamApi extends ApiBaseController{
|
||||
@Autowired
|
||||
StudyCourseDao scDao;
|
||||
|
||||
@Autowired
|
||||
IStudyExamService sexamService;
|
||||
|
||||
@@ -2,10 +2,14 @@ package com.xboe.school.study.dao;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.constants.CacheName;
|
||||
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.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
@@ -26,6 +30,9 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
|
||||
@Autowired
|
||||
StudyCourseItemDao scItemDao;
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
|
||||
@Resource
|
||||
private ThirdApi thirdApi;
|
||||
@@ -36,6 +43,11 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
* @param total
|
||||
*/
|
||||
public void finishCheck(String studyId,String courseId,Integer total,String token){
|
||||
|
||||
if(StringUtils.isNotEmpty(redisTemplate.opsForValue().get(studyId + "_" + courseId + "_" + total))){
|
||||
return ;
|
||||
}
|
||||
|
||||
log.info("------1.完成情况检查---------------studyId = " + studyId + " , courseId = " + courseId + " , total = " + total );
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
//已完成的内容
|
||||
@@ -50,7 +62,9 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
}
|
||||
log.info("------3.完成情况检查---------------studyId = " + studyId + " , courseId = " + courseId + " , total = " + total );
|
||||
//以下注意,float类型,是否等于100对应
|
||||
float percent=n*100/total;
|
||||
float percent=n*100/total;
|
||||
|
||||
|
||||
if(n>=total) {
|
||||
//自主报名的课程,代表学习完成
|
||||
super.updateMultiFieldById(studyId,
|
||||
@@ -58,11 +72,13 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
UpdateBuilder.create("lastTime",now),
|
||||
UpdateBuilder.create("finishTime",now),
|
||||
UpdateBuilder.create("status",StudyCourse.STATUS_FINISH));
|
||||
redisTemplate.opsForValue().set(studyId + "_" + courseId + "_" + total, "100", 24, TimeUnit.HOURS);
|
||||
}else {
|
||||
super.updateMultiFieldById(studyId,
|
||||
UpdateBuilder.create("progress",percent),
|
||||
UpdateBuilder.create("lastTime",LocalDateTime.now()),
|
||||
UpdateBuilder.create("status",StudyCourse.STATUS_STUDYING));
|
||||
// redisTemplate.opsForValue().set(studyId, String.valueOf(percent), 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyId ,courseId, token);
|
||||
@@ -116,4 +132,8 @@ public class StudyCourseDao extends BaseDao<StudyCourse> {
|
||||
|
||||
this.update(update.builder());
|
||||
}
|
||||
|
||||
public StudyCourse findByCourseIdAndAid(String aid, String courseId) {
|
||||
return this.findOne(FieldFilters.eq("aid",aid),FieldFilters.eq("courseId",courseId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xboe.school.study.service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.xboe.school.study.entity.StudyHomeWork;
|
||||
@@ -29,4 +30,6 @@ public interface IStudyHomeWorkService {
|
||||
* @return
|
||||
*/
|
||||
List<StudyHomeWork> getByStudyIdAndContentId(String studyId,String contentId);
|
||||
|
||||
List<StudyHomeWork>getByStudnetNameAndContentId(List<String> studentName, String contentId);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.xboe.common.PageList;
|
||||
import com.xboe.school.study.dto.StudyContentDto;
|
||||
import com.xboe.school.study.entity.StudyCourseItem;
|
||||
import com.xboe.school.study.entity.StudyTime;
|
||||
import com.xboe.system.user.entity.User;
|
||||
|
||||
/**
|
||||
* 学习情况处理,比较综合一个处理类
|
||||
@@ -95,4 +96,7 @@ public interface IStudyService {
|
||||
* @return
|
||||
*/
|
||||
PageList<StudyCourseItem> findItemPage(int pageIndex, int pageSize, String contentId, String courseId, String name, Integer status);
|
||||
|
||||
List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status);
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StudyAssessServiceImpl implements IStudyAssessService{
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(assess.getStudyId());
|
||||
sci.setContentId(assess.getContentId());
|
||||
//sci.setContentName(homework.getContentName());
|
||||
sci.setContentName("评估");
|
||||
sci.setCourseId(assess.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(100);//直接设置为学习完成
|
||||
|
||||
@@ -265,6 +265,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
}
|
||||
@Override
|
||||
public void deleteSignUp(String id,String courseId,String aid) {
|
||||
log.info("参数id:"+id+"参数课程id:"+courseId+"参数用户id:"+aid);
|
||||
//删除课程学习记录主表
|
||||
studyCourseDao.deleteById(id);
|
||||
//删除学习课程的评估测试结果
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
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;
|
||||
@@ -28,6 +13,17 @@ 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
|
||||
@@ -73,29 +69,31 @@ 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(homework.getContentName());
|
||||
sci.setContentName("考试");
|
||||
sci.setCourseId(exam.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(prog);//直接设置为学习完成
|
||||
sci.setProgress(progress);//直接设置为学习完成
|
||||
sci.setStatus(status);//状态直接更新为已完成
|
||||
sci.setStartTime(ldt);
|
||||
sci.setStartTime(exam.getStartTime());
|
||||
sci.setAid(exam.getStudentId());
|
||||
sci.setAname(exam.getStudentName());
|
||||
sci.setFinishTime(LocalDateTime.now());
|
||||
sci.setFinishTime(ldt);
|
||||
sci.setLastStudyTime(0);//此项用户记录视频内容当前学习的时间点
|
||||
sci.setLastTime(ldt);
|
||||
if(cexam.getScoringType()==CourseExam.SCORINGTYPE_LAST) {
|
||||
sci.setScore(exam.getScore());
|
||||
}
|
||||
sci.setScore(exam.getScore());
|
||||
sci.setStudyDuration(exam.getTestDuration());
|
||||
scItemDao.save(sci);
|
||||
exam.setStudyItemId(sci.getId());
|
||||
dao.save(exam);
|
||||
@@ -108,35 +106,34 @@ 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.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);
|
||||
//最新考试分值
|
||||
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)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//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());
|
||||
|
||||
@@ -46,7 +46,7 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
LocalDateTime ldt=LocalDateTime.now();
|
||||
sci.setStudyId(homework.getStudyId());
|
||||
sci.setContentId(homework.getContentId());
|
||||
//sci.setContentName(homework.getContentName());
|
||||
sci.setContentName(homework.getHwName());
|
||||
sci.setCourseId(homework.getCourseId());
|
||||
//sci.setCsectionId(homework.getCsectionId());
|
||||
sci.setProgress(100);//直接设置为学习完成
|
||||
@@ -64,10 +64,11 @@ 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。然后进行悠
|
||||
homework.setId(obj.toString());
|
||||
homework.setId(homework.getStudyItemId());
|
||||
dao.update(homework);
|
||||
}
|
||||
}
|
||||
@@ -89,4 +90,9 @@ public class StudyHomeWorkServiceImpl implements IStudyHomeWorkService{
|
||||
return dao.findList(FieldFilters.eq("studyId", studyId),FieldFilters.eq("contentId", contentId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StudyHomeWork> getByStudnetNameAndContentId(List<String> studentName, String contentId) {
|
||||
return dao.findList(FieldFilters.in("student_name", studentName),FieldFilters.eq("contentId", contentId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xboe.school.study.service.impl;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -8,12 +7,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.xboe.module.article.entity.Article;
|
||||
import com.xboe.module.interaction.entity.Shares;
|
||||
import com.xboe.school.study.entity.StudyCourse;
|
||||
import com.xboe.system.user.entity.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -98,8 +97,12 @@ 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 {
|
||||
log.info("学习记录插入失败"+sci.getId());
|
||||
throw new IllegalArgumentException("学习记录插入失败");
|
||||
}
|
||||
//检查是否全部学习完成
|
||||
scDao.finishCheck(dto.getStudyId(),dto.getCourseId(),dto.getContentTotal(),token);
|
||||
|
||||
@@ -182,7 +185,7 @@ public class StudyServiceImpl implements IStudyService{
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
query.addFilter(FieldFilters.eq("aname", name));
|
||||
}
|
||||
int pageIndex2 = pageIndex-1;
|
||||
int pageIndex2 = (pageIndex-1)*10;
|
||||
if(status!=null) {
|
||||
if(status==3) {
|
||||
query.addFilter(FieldFilters.eq("status", 2));
|
||||
@@ -193,16 +196,16 @@ public class StudyServiceImpl implements IStudyService{
|
||||
}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 " +
|
||||
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
||||
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
|
||||
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
|
||||
" select item.study_id from boe_study_course_item item " +
|
||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
|
||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
|
||||
" ) group by bsc.id limit "+ pageIndex2+","+ pageSize+";";
|
||||
|
||||
String sql2 = "select count(*) as total from (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 " +
|
||||
" left join boe_study_course_item item on bsc.course_id = item.course_id and bsc.id = item.study_id" +
|
||||
" where bsc.course_id = '"+courseId+"' and bsc.id not in(" +
|
||||
" where bsc.course_id = '"+courseId+"' and bsc.aname like '%"+name+"%' and bsc.id not in(" +
|
||||
" select item.study_id from boe_study_course_item item " +
|
||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by item.study_id" +
|
||||
" where item.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' and item.aname like '%"+name+"%' group by item.study_id" +
|
||||
" ) group by bsc.id) as total";
|
||||
log.info("资源完成情况未开始sql"+sql);
|
||||
List<Object[]> list = scDao.sqlFindList(sql);
|
||||
@@ -224,46 +227,22 @@ public class StudyServiceImpl implements IStudyService{
|
||||
return pageList;
|
||||
}
|
||||
}
|
||||
// String sql = "select * from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
|
||||
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
|
||||
// " UNION ALL " +
|
||||
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
|
||||
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
|
||||
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
|
||||
// " select bsc.id from boe_study_course bsc " +
|
||||
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
|
||||
// " )group by bsc.id) a group by a.id limit "+ pageIndex+","+ pageSize+";";
|
||||
|
||||
// String sql2 = "select count(*) from (select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,item.progress,item.status from boe_study_course bsc left join " +
|
||||
// "boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
// "where bsc.`status` in (2,9) and bsc.course_id = '"+ courseId+"' group by bsc.id " +
|
||||
// " UNION ALL " +
|
||||
// " select bsc.id,bsc.course_id,bsc.course_name,bsc.aname,0 as progress,1 as status from boe_study_course bsc " +
|
||||
// " LEFT JOIN boe_study_course_item item on item.course_id = bsc.course_id " +
|
||||
// " where bsc.course_id = '"+courseId+"' and bsc.id not in (" +
|
||||
// " select bsc.id from boe_study_course bsc " +
|
||||
// " left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
// " where bsc.course_id = '" + courseId + "' and item.content_id = '"+ contentId+"' group by bsc.id" +
|
||||
// " )group by bsc.id) a group by a.id";
|
||||
|
||||
String sql = "select a.id, a.course_id, a.course_name, a.aname, " +
|
||||
"IFNULL(b.finish_time, '0') as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
|
||||
"left join " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
|
||||
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
|
||||
"on a.course_id = b.course_id and a.id = b.id " +
|
||||
"group by a.id limit "+ pageIndex2+","+ pageSize+";";
|
||||
String sql2 = "select count(*) as total from (select a.id, a.course_id, a.course_name, a.aname, " +
|
||||
"IFNULL(b.finish_time, 0) as finish_time, IFNULL(b.progress, 0) as progress, IFNULL(b.status, 1) as status " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "') a " +
|
||||
"from (select id, course_id, course_name, aname, 0, 1 from boe_study_course where course_id = '" + courseId + "' and aname like '%"+name+"%') a " +
|
||||
"left join " +
|
||||
"(select bsc.id, bsc.course_id, bsc.course_name, bsc.aname, item.finish_time, item.progress, item.status " +
|
||||
"from boe_study_course bsc left join boe_study_course_item item on item.course_id = bsc.course_id and item.study_id = bsc.id " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' group by bsc.id) b " +
|
||||
"where bsc.course_id = '" + courseId + "' and item.content_id = '" + contentId + "' and item.aname like '%"+name+"%' group by bsc.id) b " +
|
||||
"on a.course_id = b.course_id and a.id = b.id " +
|
||||
"group by a.id) as total";
|
||||
log.info("资源完成情况全部sql"+sql);
|
||||
@@ -292,6 +271,34 @@ public class StudyServiceImpl implements IStudyService{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StudyCourseItem> getList(String courseId, String contentId, String name, Integer status) {
|
||||
|
||||
QueryBuilder query=QueryBuilder.from(StudyCourseItem.class);
|
||||
|
||||
OrderCondition oc=OrderCondition.desc("id");
|
||||
query.addOrder(oc);
|
||||
if(StringUtils.isNotBlank(contentId)) {
|
||||
query.addFilter(FieldFilters.eq("contentId",contentId));
|
||||
}
|
||||
if(StringUtils.isNotBlank(courseId)) {
|
||||
query.addFilter(FieldFilters.eq("courseId",courseId));
|
||||
}
|
||||
|
||||
if(status!=null) {
|
||||
if(status==1) {
|
||||
query.addFilter(FieldFilters.eq("progress", 0));
|
||||
}else {
|
||||
query.addFilter(FieldFilters.eq("progress",100));
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(name)) {
|
||||
query.addFilter(FieldFilters.like("aname", name));
|
||||
}
|
||||
return scItemDao.findList(query.builder());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProcess(String studyContentId,String studyId, String courseId,Integer total, Integer progress,String token) {
|
||||
|
||||
@@ -61,7 +61,10 @@ public class StudySignupServiceImpl implements IStudySignupService{
|
||||
@Override
|
||||
public void selfSignup(StudySignup signup) {
|
||||
signup.setSignType(StudySignup.SIGNTYPE_SELF);
|
||||
this.addSignup(signup);
|
||||
StudyCourse sc=studyCourseDao.findByCourseIdAndAid(signup.getAid(), signup.getCourseId());
|
||||
if (sc == null){
|
||||
this.addSignup(signup);
|
||||
}
|
||||
//更新课程学习人数
|
||||
courseDao.updateMultiFieldById(signup.getCourseId(),UpdateBuilder.create("studys", "studys+1",FieldUpdateType.EXPRESSION));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/10/static
|
||||
|
||||
@@ -23,7 +23,7 @@ logging.level.org.hibernate.SQL=ERROR
|
||||
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.129.51:8848
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.113.100:8848
|
||||
|
||||
## redis
|
||||
spring.redis.database=1
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.host=10.251.88.213
|
||||
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.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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
|
||||
|
||||
@@ -34,7 +34,7 @@ logging.level.org.hibernate.SQL=ERROR
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
logging.config=classpath:log/logback-@profileActive@.xml
|
||||
|
||||
## ???????????static????????nginx????
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
@@ -53,6 +53,7 @@ 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
|
||||
@@ -63,7 +64,7 @@ jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
|
||||
# elasticsearch config
|
||||
xboe.elasticsearch.server.ip=10.251.129.21
|
||||
xboe.elasticsearch.server.ip=10.251.88.218
|
||||
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=https://u.boe.com
|
||||
boe.domain=http://127.0.0.1
|
||||
#boe.domain=http://localhost:30001
|
||||
orgTree.orgTreeList=${boe.domain}/userbasic/org/list
|
||||
# ????id????????????
|
||||
@@ -74,4 +74,5 @@ manageApi.stu.offcourse=${boe.domain}/manageApi/stu/offcourse/getOffCourseId
|
||||
manageApi.editExam=${boe.domain}/manageApi/admin/project/editExam
|
||||
#获取离职教师id
|
||||
userBasic.getTeacherIds=${boe.domain}/userbasic/user/getTeacherInfo
|
||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||
coursesuilt.getStudyStatus=${boe.domain}/manageApi/stu/project/completeStatus
|
||||
userBasic.getUserBasicInfo=${boe.domain}/userbasic/user/getUserBasicInfo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## redis
|
||||
spring.redis.database=3
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.host=10.251.88.213
|
||||
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.129.126:3306/boe_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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.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.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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.username=admin
|
||||
spring.datasource.db2.password=boeRds01
|
||||
|
||||
@@ -48,6 +48,7 @@ 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=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.host=10.251.88.214
|
||||
spring.redis.password=qwert!W588
|
||||
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://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
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
|
||||
|
||||
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=127.0.0.1
|
||||
spring.redis.host=10.251.88.214
|
||||
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://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216: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=127.0.0.1
|
||||
spring.redis.host=10.251.88.214
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
# cloud nacos config
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.181.11:8848
|
||||
spring.cloud.nacos.discovery.server-addr=10.251.113.100:8848
|
||||
|
||||
## datasource config
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://10.251.88.216:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
@@ -33,7 +33,6 @@ 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.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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
|
||||
|
||||
|
||||
@@ -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.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
@@ -9,7 +8,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.129.126:3306/elearninglms?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://10.251.88.216:3306/elearninglms?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=admin
|
||||
spring.datasource.db1.password=boeRds01
|
||||
|
||||
@@ -18,7 +17,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.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
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.username=admin
|
||||
spring.datasource.db2.password=boeRds01
|
||||
|
||||
|
||||
Reference in New Issue
Block a user