// 修改志愿 @RequestMapping(value = "/updateMyApply") public ModelAndView updateMyApply(HttpServletRequest request, HttpServletResponse response) { // String choiceType = (String) request.getParameter("choose"); String myGuidFirst = (String) request.getParameter("myGuid").trim(); String myGuidSecond = (String) request.getParameter("myGuid1").trim(); String type = (String) request.getParameter("type"); ModelAndView mv = new ModelAndView(); mv.setViewName("forward:/jobinfo/apply-record.html"); MyApply myapplyFirst = new MyApply(); MyApply myapplySecond = new MyApply(); HttpSession session = request.getSession(); String currentOpenId = (String) session.getAttribute("currentOpenId"); // currentOpenId = "oxSyKwTtvEyDDoBnxLsfpWnK7kCY"; List<MyApply> listMyApply = myApplyService.selectMyApplyByOpenId(currentOpenId); if (type.equals("FC")) { myapplyFirst.setMYGUID(myGuidFirst); myapplyFirst.setType("SC"); myApplyService.updateMyApply(myapplyFirst); // 判断第二志愿存不存在 if (listMyApply.size() == 2) { myapplySecond.setMYGUID(myGuidSecond); myapplySecond.setType("FC"); myApplyService.updateMyApply(myapplySecond); } } if (type.equals("SC")) { myapplyFirst.setMYGUID(myGuidFirst); myapplyFirst.setType("FC"); myApplyService.updateMyApply(myapplyFirst); // 判断第二志愿存不存在 if (listMyApply.size() == 2) { myapplySecond.setMYGUID(myGuidSecond); myapplySecond.setType("SC"); myApplyService.updateMyApply(myapplySecond); } } return mv; }
@RequestMapping(value = "volunter") @ResponseBody public Map<String, Object> selectVolunteer( HttpServletRequest request, @RequestBody Map<String, Object> params) { Map<String, Object> map = new HashMap<String, Object>(); map.put("success", true); String choiceType = (String) params.get("choice"); String jobGuid = (String) params.get("jobGuid"); String jrGuid = (String) params.get("jrGuid"); HttpSession session = request.getSession(); String currentOpenId = (String) session.getAttribute("currentOpenId"); // currentOpenId = "oxSyKwTtvEyDDoBnxLsfpWnK7kCY"; List<MyApply> listMyApply = myApplyService.selectMyApplyByOpenId(currentOpenId); if (currentOpenId != null && currentOpenId != "") { MyApply nMyApply = new MyApply(); nMyApply.setJobguid(jobGuid); nMyApply.setOpenid(currentOpenId); nMyApply.setType(choiceType); nMyApply.setJrGuid(jrGuid); if (listMyApply == null || listMyApply.size() == 0) { myApplyService.insertMyApply(nMyApply); } else { MyApply ma = listMyApply.get(0); String type = ma.getType(); if (type.equals(choiceType) && type.equals("FC")) { ma.setType("SC"); myApplyService.updateMyApply(ma); } if (type.equals(choiceType) && type.equals("SC")) { ma.setType("FC"); myApplyService.updateMyApply(ma); } myApplyService.insertMyApply(nMyApply); } } return map; }