diff --git a/pom.xml b/pom.xml
index 91d74c5156e40ae85f3b8c8bd4ba2b436643ed05..3c72b281f012b69dee97b64229c26011913447db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,11 @@
ikonli-fontawesome5-pack
2.4.0
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.15.0
+
diff --git a/src/main/java/com/hnust/controller/paper/autoPaperController/AutoPaper3Controller.java b/src/main/java/com/hnust/controller/paper/autoPaperController/AutoPaper3Controller.java
index 98c0473b23da6da46e7fddb1d423df0a218c52a9..7043a69f06a60f4c4d5a2cb123f654d4719b3766 100644
--- a/src/main/java/com/hnust/controller/paper/autoPaperController/AutoPaper3Controller.java
+++ b/src/main/java/com/hnust/controller/paper/autoPaperController/AutoPaper3Controller.java
@@ -264,8 +264,19 @@ public class AutoPaper3Controller implements Initializable {
//为对应的ListView设置内容
public void showData(ListViewview,ObservableList list,List addList,CheckBox cb){
+ //—-------------------------------------------------------------------------- 去重操作
addList.forEach(subjectDataRecord -> subjectDataRecord.setChecked(false));
- list.addAll(addList);
+ ArrayList list_id = new ArrayList();
+ list.forEach(value -> {
+ list_id.add(value.getSubjectData().getId());
+ });
+ addList.forEach(subjectDataRecord -> {
+
+ if(!list_id.contains(subjectDataRecord.getSubjectData().getId())){
+ list.addAll(subjectDataRecord);
+ }
+ });
+ //—--------------------------------------------------------------------------
view.setItems(list);
setListViewHeight(view,list);
view.setCellFactory(new Callback, ListCell>() {
diff --git a/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperController.java b/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperController.java
index 4ff0761352089e15fdc16a6b7684f39f463b74f5..4e7a4071466c85061c5cbac633f749814f46b007 100644
--- a/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperController.java
+++ b/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperController.java
@@ -144,6 +144,7 @@ public class GeneratePaperController implements Initializable {
String grade = gradeMajor.substring(0,4);
String major = gradeMajor.substring(4);
boolean m = classApi.getClassMsgByMajor_Grade(grade,major);
+ System.out.println(m);
//存入年级
if(m==true){
// System.out.println("找到了并返回给前端");
diff --git a/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperSecondController.java b/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperSecondController.java
index 00d457ad4c574f13bfef8dbe31168f4f56f93999..ba6ca7241cb2ac17a117155ce685de0d6145c48f 100644
--- a/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperSecondController.java
+++ b/src/main/java/com/hnust/controller/paper/generateController/GeneratePaperSecondController.java
@@ -32,6 +32,7 @@ import retrofit2.Response;
import java.io.IOException;
import java.net.URL;
+import java.sql.SQLOutput;
import java.util.*;
import java.util.stream.Collectors;
@@ -126,6 +127,8 @@ public class GeneratePaperSecondController implements Initializable {
private Map midLabelMap=new HashMap<>();
private Map diffLabelMap=new HashMap<>();
private Map itemMap=new HashMap<>();
+
+
@Override
public void initialize(URL location, ResourceBundle resources) {
scp_paper.setFitToWidth(true);
@@ -211,9 +214,21 @@ public class GeneratePaperSecondController implements Initializable {
}
//为对应的ListView设置内容
- public void showData(ListViewview,ObservableList list,List addList,CheckBox cb){
+ public void
+ showData(ListViewview,ObservableList list,List addList,CheckBox cb){
addList.forEach(subjectDataRecord -> subjectDataRecord.setChecked(false));
- list.addAll(addList);
+//—-------------------------------------------------------------------------- 去重操作
+ ArrayList list_id = new ArrayList();
+ list.forEach(value -> {
+ list_id.add(value.getSubjectData().getId());
+ });
+ addList.forEach(subjectDataRecord -> {
+
+ if(!list_id.contains(subjectDataRecord.getSubjectData().getId())){
+ list.addAll(subjectDataRecord);
+ }
+ });
+//—--------------------------------------------------------------------------
view.setItems(list);
setListViewHeight(view,list);
view.setCellFactory(new Callback, ListCell>() {
@@ -223,6 +238,7 @@ public class GeneratePaperSecondController implements Initializable {
@Override
protected void updateItem(SubjectDataRecord item, boolean empty) {
super.updateItem(item, empty);
+
if(empty==false){
AnchorPane anchorPane=new AnchorPane();
CheckBox checkBox=new CheckBox();
@@ -241,6 +257,8 @@ public class GeneratePaperSecondController implements Initializable {
});
AnchorPane.setTopAnchor(checkBox, 7.0);
AnchorPane.setLeftAnchor(checkBox, 10.0);
+
+ //在这里显示题目
WebView webView=new WebView();
WebEngine webEngine=webView.getEngine();
webEngine.loadContent(item.getSubjectData().getContent());
@@ -250,6 +268,7 @@ public class GeneratePaperSecondController implements Initializable {
AnchorPane.setTopAnchor(vBox, 7.0);
AnchorPane.setLeftAnchor(vBox, 35.0);
AnchorPane.setRightAnchor(vBox, 70.0);
+
Label label3=new Label("分值:");
Label label4=new Label(String.valueOf(item.getScore()));
label3.setStyle("-fx-text-fill: #000");
@@ -301,6 +320,7 @@ public class GeneratePaperSecondController implements Initializable {
}
}
};
+ //在这里对题目进行去重
return cell;
}
});
diff --git a/src/main/java/com/hnust/controller/paper/paperManagement/PaperListController.java b/src/main/java/com/hnust/controller/paper/paperManagement/PaperListController.java
index 7fa7b7ab69bd135ba941b0babc7afbcf8e01855a..7422157dbde6e375997e571c28247000ed3605a1 100644
--- a/src/main/java/com/hnust/controller/paper/paperManagement/PaperListController.java
+++ b/src/main/java/com/hnust/controller/paper/paperManagement/PaperListController.java
@@ -176,22 +176,7 @@ public class PaperListController implements Initializable {
}
}
- Iterator unStarted = unStartedList.iterator();
- while (unStarted.hasNext()) {
- Test lh =unStarted.next();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- long current_time = new Date().getTime();
- String cur_time = sdf.format(current_time);
- String exam_start_time = (String) lh.getBeginTime();
- String exam_end_time = (String) lh.getEndTime();
- if (cur_time.compareTo(exam_start_time) <= 0) { //当前时间<=考试开始时间----待开始
- mydata_unstart.add(lh);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+
//另外定义函数启动页面显示
getUnstarting2();
}
@@ -582,6 +567,84 @@ public class PaperListController implements Initializable {
}
return box;
}
+ /*
+ Author:彭有为
+ */
+ //根据待开始,待批阅,已完成不同的页面来数据最新的数据
+ public void refreshData(){
+ if (cbox111.isSelected()){
+ //清空上一次设置样卷/取消样卷/删除 功能中保留的选中数据,同时将所有的checkbox选中状态取消
+ user_select_data.removeAll(user_select_data);
+ cbox111.setSelected(false);
+ }
+ // 获取待批阅处理的所有试卷列表
+ List paperLists = testPaperService.getNeedCorrectExams(TeaNum.teaNum).getData();
+ List unStartedList = testPaperService.getUnstartedExams(TeaNum.teaNum).getData();
+ dealData(paperLists , unStartedList);
+ // 获取待开始的试卷列表
+
+ //待开始tab栏被选中
+// if(tab0.isSelected()) {
+// tabPane = new JFXTabPane();
+// mydata_unstart = new ArrayList<>();
+// List unStartedList = testPaperService.getUnstartedExams(TeaNum.teaNum).getData();
+// Iterator unStarted = unStartedList.iterator();
+// while (unStarted.hasNext()) {
+// Test lh = unStarted.next();
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// try {
+// long current_time = new Date().getTime();
+// String cur_time = sdf.format(current_time);
+// String exam_start_time = (String) lh.getBeginTime();
+// String exam_end_time = (String) lh.getEndTime();
+// if (cur_time.compareTo(exam_start_time) <= 0) { //当前时间<=考试开始时间----待开始
+// mydata_unstart.add(lh);
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+// System.out.println("待开始tab栏被选中");
+// }
+//
+// ArrayList mydata_finished_temp = new ArrayList<>();
+// ArrayList mydata_need_correct_temp = new ArrayList<>();
+// Iterator it = paperLists.iterator();
+//
+// while (it.hasNext()) {
+// Test lh = it.next();
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// try {
+// long current_time = new Date().getTime();
+// String cur_time = sdf.format(current_time);
+// String exam_start_time = (String) lh.getBeginTime();
+// String exam_end_time = (String) lh.getEndTime();
+// if (cur_time.compareTo(exam_start_time) > 0) { //当前时间>考试结束时间----判断待批阅和已完成
+// if ("1".equals(lh.getStatus())) {
+// mydata_finished_temp.add(lh);
+// } else {
+// mydata_need_correct_temp.add(lh);
+// }
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+//
+// //待批阅tab栏被选中
+// if(tab1.isSelected()){
+// tabPane = new JFXTabPane();
+// mydata_finished = mydata_finished_temp;
+// System.out.println(mydata_finished_temp);
+// System.out.println("待批阅tab栏被选中");
+// }
+// //已完成tab栏被选中
+// if(tab2.isSelected()){
+// tabPane = new JFXTabPane();
+// mydata_need_correct = mydata_need_correct_temp;
+// System.out.println("已完成tab栏被选中");
+// }
+ }
public void change_selectall(){ //当选项卡切换时,取消选中当前选项卡的checkbox选中状态
if (cbox111.isSelected()){
diff --git a/src/main/java/com/hnust/controller/paper/paperManagement/PaperReviewController.java b/src/main/java/com/hnust/controller/paper/paperManagement/PaperReviewController.java
index b05a020335cd8794a544ac29cbeb4632e2b91097..ff3c183a0ea1101fb85b37e56e41fc8b4b709f6a 100644
--- a/src/main/java/com/hnust/controller/paper/paperManagement/PaperReviewController.java
+++ b/src/main/java/com/hnust/controller/paper/paperManagement/PaperReviewController.java
@@ -1,4 +1,7 @@
package com.hnust.controller.paper.paperManagement;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.GetObjectRequest;
import com.hnust.controller.MainController;
import com.hnust.domain.*;
import com.hnust.fx.FXMLController;
@@ -6,6 +9,7 @@ import com.hnust.service.*;
import com.hnust.store.DataStore;
import com.hnust.store.PaperListDataStore;
import com.hnust.domain.JudgeAnswerPartDto;
+import com.hnust.util.FileUpload;
import com.hnust.util.PaperDataModel;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
@@ -26,6 +30,8 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
+
+import java.io.File;
import java.net.URL;
import java.util.*;
@@ -1014,7 +1020,11 @@ public class PaperReviewController implements Initializable {
ImageView imageView = new ImageView();
HBox hBox5 = new HBox();
hBox5.setStyle("-fx-pref-width: 5;");
- Image image = new Image(questionAnswer.getStuAnswer().get(j));
+// Image image = new Image("http://hnustpyw.oss-cn-hangzhou.aliyuncs.com/upload/2006040306/image2"); //现在就是需要改这里 引入oss就行
+// Oss object = new Oss();
+// OSS ossClient = new OSSClientBuilder().build(object.getEndpoint() , object.getAccessKeyId() , object.getAccessKeySecret());
+// ossClient.getObject(new GetObjectRequest(object.getBucket() , object.) questionAnswer.getStuAnswer().get(j));
+ Image image = new Image(questionAnswer.getStuAnswer().get(j)); //现在就是需要改这里 引入oss就行
double w = image.getWidth();
double h = image.getHeight();
double max = Math.max(w, h);
diff --git a/src/main/java/com/hnust/domain/Oss.java b/src/main/java/com/hnust/domain/Oss.java
new file mode 100644
index 0000000000000000000000000000000000000000..a6d6fdebde1a32e6a688d68d3151be4e8a990e2d
--- /dev/null
+++ b/src/main/java/com/hnust/domain/Oss.java
@@ -0,0 +1,20 @@
+package com.hnust.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Oss {
+ @Value("${aliyun.oss.file.endpoint}")
+ private String endpoint ;
+ @Value("${aliyun.oss.file.bucket}")
+ private String bucket ;
+ @Value("${aliyun.oss.file.accessKeyId}")
+ private String accessKeyId ;
+ @Value("${aliyun.oss.file.accessKeySecret}")
+ private String accessKeySecret ;
+}
diff --git a/src/main/java/com/hnust/util/FileUpload.java b/src/main/java/com/hnust/util/FileUpload.java
index e9d95c1fc24cfdd25a5bf1813d33cd97411639ab..6fe6a013f49053871fd3435c6e33d7ac051f736c 100644
--- a/src/main/java/com/hnust/util/FileUpload.java
+++ b/src/main/java/com/hnust/util/FileUpload.java
@@ -1,10 +1,12 @@
package com.hnust.util;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.OSSObject;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 87283820a6d98f5c5d490273f50cd319e17c5d0f..bf94f4cf389519b155649210629f33245d6a5b7d 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -15,7 +15,14 @@ feign:
# readTimeout: 10000 websocket时使用的
loggerLevel: basic
-
+#配置阿里云oss服务信息
+aliyun:
+ oss:
+ file:
+ endpoint: "oss-cn-hangzhou.aliyuncs.com"
+ bucket: "hnustpyw"
+ accessKeyId: "LTAI5tGedGYp9sC9G26dsJJY"
+ accessKeySecret: "R3W751BpLNbiNUVtEnlVhansbvpFn0"
#关闭banner
spring:
main:
diff --git a/src/main/resources/fxml/paper/paperManagement/paperList.fxml b/src/main/resources/fxml/paper/paperManagement/paperList.fxml
index 4ae573ce2be46039c18d2fa3257bf4b39d0baa35..d02f2279bd5d0515189e465ce9651f0235df7af0 100644
--- a/src/main/resources/fxml/paper/paperManagement/paperList.fxml
+++ b/src/main/resources/fxml/paper/paperManagement/paperList.fxml
@@ -50,6 +50,7 @@
+