Exemplo n.º 1
0
  /**
   * @param id 从业人员id
   * @param dwid 单位id
   * @param dwmc 单位名称
   * @return
   */
  @RequestMapping(value = "/createPage", method = RequestMethod.GET)
  public @ResponseBody ModelAndView createPage(String id, String dwid) {
    ModelAndView mv = new ModelAndView("sydw_dl/dwfrfzrllyxxbAdd");
    SessionBean sessionBean = getSessionBean();
    Frfzrllrb entity = new Frfzrllrb();

    if (!StringUtils.isBlank(id)) {
      entity = frfzrllrbService.queryById(id);
    }
    if (sessionBean != null) {
      mv.addObject("pcsdm", sessionBean.getExtendValue("ssPcsCode"));
      mv.addObject("zrqdm", sessionBean.getUserOrgCode());
    }
    entity.setDwid(dwid);
    mv.addObject("entity", entity);
    return mv;
  }
Exemplo n.º 2
0
  /**
   * 保存法人\负责人\联络员信息
   *
   * @param entity
   * @return
   */
  @RequestMapping(value = "/save", method = RequestMethod.POST)
  public @ResponseBody ModelAndView save(Frfzrllrb entity) {
    ModelAndView mv = new ModelAndView("redirect:/forward/" + AppConst.FORWORD);
    Map<String, Object> model = new HashMap<String, Object>();
    SessionBean sessionBean = getSessionBean();

    try {
      if (entity.getId() == null || entity.getId().equals("")) {
        boolean returnBoolean = frfzrllrbService.add(entity, sessionBean);
        if (returnBoolean) {
          model.put(AppConst.STATUS, AppConst.SUCCESS);
          model.put(AppConst.MESSAGES, "新增【法人/负责人/联络员】成功!");
          model.put(AppConst.SAVE_ID, entity.getId()); // 返回主键			
        } else {
          model.put(AppConst.STATUS, AppConst.FAIL);
          model.put(AppConst.MESSAGES, "新增【法人/负责人/联络员】失败,因为一个单位只能有一个法人!");
        }

      } else {
        boolean returnBoolean = frfzrllrbService.update(entity, sessionBean);
        if (returnBoolean) {
          model.put(AppConst.STATUS, AppConst.SUCCESS);
          model.put(AppConst.MESSAGES, "修改【法人/负责人/联络员】成功!");
        } else {
          model.put(AppConst.STATUS, AppConst.FAIL);
          model.put(AppConst.MESSAGES, "修改【法人/负责人/联络员】失败,因为一个单位只能有一个法人!");
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
      logger.error(e.getLocalizedMessage(), e);
      model.put(AppConst.STATUS, AppConst.FAIL);
      model.put(AppConst.MESSAGES, getAddFail());
    }
    mv.addObject(AppConst.MESSAGES, new Gson().toJson(model));
    return mv;
  }