@RequestMapping(value = "/select", method = RequestMethod.POST)
 public String select(String keyWord, Model model, HttpSession session) {
   User u = (User) session.getAttribute("loginUser");
   model.addAttribute("keyWord", keyWord);
   model.addAttribute("datas", caseService.getCaseBeanPagerByKeyWord(u.getId(), keyWord));
   return "case/list";
 }
  @RequestMapping(value = "/add", method = RequestMethod.POST)
  public String add(
      Integer scenId,
      @Valid CaseDTO caseDTO,
      BindingResult br,
      Model model,
      HttpSession httpSession) {
    if (br.hasErrors()) {
      return "case/add";
    }
    ScenarioBean scenaBean = new ScenarioBean();
    scenaBean.setId(scenId);
    CaseBean caseBean = new CaseBean();
    caseBean.setCreateDate(new Date());
    caseBean.setScenarioBean(scenaBean);
    User user = (User) httpSession.getAttribute("loginUser");
    caseBean.setUserId(user.getId());
    caseBean.setCaseName(caseDTO.getCaseName());
    caseBean.setRemark(caseDTO.getRemark());
    caseBean.setStatus(caseDTO.getStatus());
    caseBean.setDeleteMsg(caseDTO.isDeleteMsg());
    caseBean.setMsgSendType(caseDTO.getMsgSendType());

    caseService.addCase(caseBean);
    return "redirect:/case/list";
  }
Ejemplo n.º 3
0
 @RequestMapping("/show")
 public String show(HttpSession session, Model model) {
   List<TaskModel> scenTaskList = new ArrayList<TaskModel>();
   List<TaskModel> caseTaskList = new ArrayList<TaskModel>();
   List<TaskModel> interfaceCaseList = new ArrayList<TaskModel>();
   User u = (User) session.getAttribute("loginUser");
   for (TaskModel t : taskService.getTaskModelListByUid(u.getId())) {
     switch (t.getTaskType()) {
       case WEB_SCENARIO:
         scenTaskList.add(t);
         break;
       case WEB_CASE:
         caseTaskList.add(t);
         break;
       case INTERFACE_CASE:
         interfaceCaseList.add(t);
         break;
       default:;
     }
   }
   model.addAttribute("scenarios", scenarioService.getScenarioBeanList(u.getId()));
   model.addAttribute("scenariotasks", scenTaskList);
   model.addAttribute("casetasks", caseTaskList);
   model.addAttribute("interfacetasks", interfaceCaseList);
   return "tree/tree";
 }
 @RequestMapping(value = "/add", method = RequestMethod.GET)
 public String add(Integer scenId, Model model, HttpSession session) {
   User u = (User) session.getAttribute("loginUser");
   model.addAttribute("msgSendTypes", EnumUtils.enumProp2NameMap(MsgSendType.class, "name"));
   model.addAttribute("sceanList", scenarioService.getScenarioBeanList(u.getId()));
   model.addAttribute("caseDTO", new CaseDTO());
   return "case/add";
 }
 @RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
 public String update(@PathVariable Integer id, Model model, HttpSession session) {
   User u = (User) session.getAttribute("loginUser");
   model.addAttribute("msgSendTypes", EnumUtils.enumProp2NameMap(MsgSendType.class, "name"));
   model.addAttribute(caseService.getCaseBean(id));
   model.addAttribute("scenList", scenarioService.getScenarioBeanList(u.getId()));
   model.addAttribute(new CaseDTO());
   return "case/edit";
 }
 @RequestMapping(value = "/list", method = RequestMethod.GET)
 public String list(Model model, HttpSession session) {
   User u = (User) session.getAttribute("loginUser");
   model.addAttribute("datas", caseService.getCaseBeanPagerByUser(u.getId()));
   return "case/list";
 }