1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| } }
@RequestMapping(value = "/addTest", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @ResponseBody public WebResponse addTest(HttpServletRequest request, HttpServletResponse response, HttpSession session, String testName, String info, String other) { Object data = null; String statusMsg = ""; Integer statusCode = 200; Map<String, String> paramMap = new HashMap<String, String>(); paramMap.put("testName", testName); paramMap.put("info", info); paramMap.put("other", other); data = paramMap; if (testName == null || "".equals(testName.trim()) || info == null || "".equals(info.trim()) || other == null || "".equals(other.trim())) { statusMsg = " 参数为空错误!!!!"; statusCode = 201; return webResponse.getWebResponse(statusCode, statusMsg, data); } if (testName.length() > 255 || info.length() > 65535) { statusMsg = " 参数长度过长错误!!!"; statusCode = 201; return webResponse.getWebResponse(statusCode, statusMsg, data); } Test test = new Test();
boolean isAdd = true; return this.addOrEditTest(request, response, session, data, test, testName, info, other, isAdd); }
@RequestMapping(value = "/editTest", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @ResponseBody public WebResponse editTest(HttpServletRequest request, HttpServletResponse response, HttpSession session, String testId, @RequestParam(required = false) String testName, @RequestParam(required = false) String info, @RequestParam(required = false) String other) { Object data = null; String statusMsg = ""; Integer statusCode = 200; Map<String, String> paramMap = new HashMap<String, String>(); paramMap.put("testId", testId); paramMap.put("testName", testName); paramMap.put("info", info); paramMap.put("other", other); data = paramMap; if (testId == null || "".equals(testId.trim())) { statusMsg = "未获得主键参数错误!!!"; statusCode = 201; return webResponse.getWebResponse(statusCode, statusMsg, data); } Integer testIdNumeri = testId.matches("^[0-9]*$") ? Integer.parseInt(testId) : 0; if (testIdNumeri == 0) {
|