|
@@ -9,9 +9,9 @@ import java.util.*;
|
|
|
|
|
|
import edu.nju.dao.*;
|
|
import edu.nju.dao.*;
|
|
import edu.nju.entities.*;
|
|
import edu.nju.entities.*;
|
|
-import edu.nju.model.BugRecurrent;
|
|
|
|
-import edu.nju.model.BugSeverity;
|
|
|
|
|
|
+import edu.nju.model.*;
|
|
import edu.nju.util.*;
|
|
import edu.nju.util.*;
|
|
|
|
+import org.apache.commons.lang3.EnumUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -276,6 +276,47 @@ public class ExtraService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public PageExamVO findPageAndExam(long examId, long caseId){
|
|
|
|
+ PageExamVO pageExamVO=new PageExamVO(examId,caseId);
|
|
|
|
+ Exam examCase=getExam(String.valueOf(caseId));
|
|
|
|
+ pageExamVO.setPageContent(examCase.getJson());
|
|
|
|
+ String json=examCase.getPaper_type();
|
|
|
|
+ int caseTypeId=getPaperType(json);
|
|
|
|
+ pageExamVO.setCaseTypeId(caseTypeId);
|
|
|
|
+ Task task=taskDao.findById(String.valueOf(examId));
|
|
|
|
+ Date startTime=null;
|
|
|
|
+ Date endTime=null;
|
|
|
|
+ if(task!=null){
|
|
|
|
+ startTime=new Date(task.getStart_time());
|
|
|
|
+ endTime=new Date(task.getEnd_time());
|
|
|
|
+ }
|
|
|
|
+ ExamVO examVO=new ExamVO(examId,caseId,0,caseTypeId,startTime,endTime);
|
|
|
|
+ pageExamVO.setExamVO(examVO);
|
|
|
|
+ return pageExamVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private int getPaperType(String json){
|
|
|
|
+ //json=json.substring(1,json.length()-1);
|
|
|
|
+ JSONObject jsonObject = new JSONObject(json);
|
|
|
|
+ JSONArray jsonArray=jsonObject.getJSONArray("subTitles");
|
|
|
|
+ int caseTypeId=1;//这里只对WEB和APP进行了判断
|
|
|
|
+ for(int i=0;i<jsonArray.length();i++) {
|
|
|
|
+ JSONObject item = jsonArray.getJSONObject(i);
|
|
|
|
+ String label=item.getString("name");
|
|
|
|
+ if(label.equals("操作系统")){
|
|
|
|
+ JSONArray brandList=item.getJSONArray("value");
|
|
|
|
+ String brand=String.valueOf(brandList.get(0));
|
|
|
|
+ if(EnumUtils.isValidEnum(WebBrand.class, brand)){
|
|
|
|
+ caseTypeId=0;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return caseTypeId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|