Ejemplo n.º 1
0
 /**
  * demo登录提交后跳转方法
  *
  * @param userName
  * @param password
  * @param model
  * @return
  * @throws Exception
  */
 @SuppressWarnings("finally")
 @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST)
 public @ResponseBody ResultBean saveOrUpdate(
     AddAgentForm addAgentForm, ModelMap model, HttpSession httpSession) {
   ResultBean resultBean = new ResultBean();
   try {
     String userId = LoginUtils.getAuthenticatedUserCode(httpSession);
     userService.saveOrUpdate(addAgentForm, userId);
     resultBean.setMessage("操作成功!");
     resultBean.setStatus("success");
   } catch (BizException bizEx) {
     resultBean.setMessage(bizEx.getMessage());
     resultBean.setStatus("failure");
   } catch (Exception e) {
     resultBean.setMessage("操作异常!");
     resultBean.setStatus("failure");
     e.printStackTrace();
   } finally {
     return resultBean;
   }
 }
Ejemplo n.º 2
0
 /**
  * @Description: 帐号删除
  *
  * @author [email protected]
  * @date 2015年10月22日 下午1:35:59
  * @param ids
  * @param model
  * @param httpSession
  * @return
  * @throws Exception
  */
 @SuppressWarnings("finally")
 @RequestMapping(value = "/deleteAgentByIds", method = RequestMethod.POST)
 public @ResponseBody ResultBean deleteAgent(
     @RequestParam(value = "ids", required = false) String[] ids,
     ModelMap model,
     HttpSession httpSession)
     throws Exception {
   ResultBean resultBean = new ResultBean();
   try {
     String userId = LoginUtils.getAuthenticatedUserCode(httpSession);
     userService.deleteAccountByIds(ids, userId);
     resultBean.setStatus("success");
     resultBean.setMessage("删除成功!");
   } catch (BizException bizEx) {
     resultBean.setStatus("failure");
     resultBean.setMessage(bizEx.getMessage());
   } catch (Exception e) {
     resultBean.setStatus("failure");
     resultBean.setMessage(e.getMessage());
   } finally {
     return resultBean;
   }
 }