|
@@ -87,6 +87,51 @@ public class ItemController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/saveAnswer")
|
|
|
+ @ResponseBody
|
|
|
+ public void saveAnswer(String item_id, String worker_id,List<String>answers,String attachment_location, HttpServletResponse response){
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ String id = iservice.saveAnswer(item_id, worker_id, answers, attachment_location);
|
|
|
+ if(id.equals("")) {
|
|
|
+ result.put("status", "200");
|
|
|
+ result.put("id", id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ result.put("status", "500");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ out.print(result);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ }catch (IOException e) {
|
|
|
+
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/updateAnswer")
|
|
|
+ @ResponseBody
|
|
|
+ public void saveAnswer(String id, String item_id, String worker_id,List<String>answers,String attachment_location, HttpServletResponse response){
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ if(iservice.updateAnswer(id, item_id, worker_id, answers, attachment_location)){
|
|
|
+ result.put("status", "200");
|
|
|
+ } else {
|
|
|
+ result.put("status", "500");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
+ out.print(result);
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+ }catch (IOException e) {
|
|
|
+
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|