|
@@ -2,6 +2,7 @@ package edu.nju.service;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
+import edu.nju.entities.*;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -11,10 +12,6 @@ import edu.nju.dao.ReportDao;
|
|
|
import edu.nju.dao.BugDao;
|
|
|
import edu.nju.dao.ExamDao;
|
|
|
import edu.nju.dao.TestCaseDao;
|
|
|
-import edu.nju.entities.Bug;
|
|
|
-import edu.nju.entities.Exam;
|
|
|
-import edu.nju.entities.Report;
|
|
|
-import edu.nju.entities.TestCase;
|
|
|
import edu.nju.util.ExcelToJson;
|
|
|
|
|
|
@Service
|
|
@@ -133,4 +130,46 @@ public class ExtraService {
|
|
|
public Exam getExam(String id) {
|
|
|
return examDao.findById(id);
|
|
|
}
|
|
|
+
|
|
|
+ public String saveJob(String jobJson){
|
|
|
+ JSONObject jsonObject=new JSONObject(jobJson);
|
|
|
+ String description=jsonObject.getString("description");
|
|
|
+ String name=jsonObject.getString("name");
|
|
|
+ String create_time_millis=Long.toString(System.currentTimeMillis());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ saveItem(jsonObject.getJSONArray("itemList"),"111");
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveItem(JSONArray itemArray,String job_id){
|
|
|
+ for(int i=0;i<itemArray.length();i++){
|
|
|
+ JSONObject itemObject=itemArray.getJSONObject(i);
|
|
|
+ String description=itemObject.getString("description");
|
|
|
+ Set<String> img_urls=new HashSet<>();
|
|
|
+ JSONArray imgUrlArray=itemObject.getJSONArray("img_urls");
|
|
|
+ for (int j=0;j<imgUrlArray.length();j++){
|
|
|
+ img_urls.add(imgUrlArray.getString(i));
|
|
|
+ }
|
|
|
+ boolean isRequired=Boolean.parseBoolean(itemObject.getString("isRequired"));
|
|
|
+ boolean isMultiple=Boolean.parseBoolean(itemObject.getString("isMultiple"));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|