|
@@ -8,16 +8,13 @@ import java.util.List;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import edu.nju.entities.*;
|
|
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;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import edu.nju.entities.Bug;
|
|
|
|
-import edu.nju.entities.Exam;
|
|
|
|
-import edu.nju.entities.Report;
|
|
|
|
-import edu.nju.entities.TestCase;
|
|
|
|
import edu.nju.service.ExtraService;
|
|
import edu.nju.service.ExtraService;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -447,4 +444,47 @@ public class ExtraController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/updateTask", method = RequestMethod.POST)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void updateTask(String id,double writeMins, HttpServletResponse response) {
|
|
|
|
+ try {
|
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
+ if(extraService.updateTask(id, writeMins)) {
|
|
|
|
+ result.put("status", 200);
|
|
|
|
+ }
|
|
|
|
+ else { result.put("status", 500); }
|
|
|
|
+ out.print(result);
|
|
|
|
+ out.flush();
|
|
|
|
+ out.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/getTask")
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void getTask(String id, HttpServletResponse response) {
|
|
|
|
+ try {
|
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
+ Task task=extraService.saveTask(id);
|
|
|
|
+ if(task!=null) {
|
|
|
|
+ result.put("status", 200);
|
|
|
|
+ result.put("result",task);
|
|
|
|
+ }
|
|
|
|
+ else { result.put("status", 500); }
|
|
|
|
+ out.print(result);
|
|
|
|
+ out.flush();
|
|
|
|
+ out.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|