Ejemplo n.º 1
0
  /**
   * 保存更新
   *
   * @param bean
   * @param text
   * @param request
   * @param model
   * @return
   */
  @RequestMapping("/fws/o_update.do")
  public String update(Fws bean, String text, HttpServletRequest request, ModelMap model) {
    WebErrors errors = validateUpdate(bean, request);
    if (errors.hasErrors()) {
      return errors.showErrorPage(model);
    }
    String content = "";
    String s = "";
    Fws oldbean = null;
    oldbean = fwsMng.findById(bean.getId());
    User user = SiteUtils.getUser(request);
    content =
        "操作人:"
            + user.getUsername()
            + ";Id="
            + bean.getId()
            + ";服务商名称:"
            + oldbean.getKetaUser().getRealname()
            + "-to-"
            + bean.getKetaUser().getRealname()
            + ";服务商电话:"
            + oldbean.getKetaUser().getPhone()
            + "-to-"
            + bean.getKetaUser().getPhone()
            + ";";
    cmsLogMng.operating(request, "fws.log.update", content);
    KetaUser ketaUser = oldbean.getKetaUser();
    ketaUser.setPhone(bean.getKetaUser().getPhone());
    ketaUser.setRealname(bean.getKetaUser().getRealname());
    ketaUserMng.updateByUpdater(ketaUser);
    oldbean.setCompanyName(bean.getCompanyName());
    oldbean.setMapX(bean.getMapX());
    oldbean.setMapY(bean.getMapY());
    oldbean.setFwsAddr(bean.getFwsAddr());
    oldbean.setLegalPerson(bean.getLegalPerson());
    oldbean.setContact(bean.getContact());
    oldbean.setPhone(ketaUser.getPhone());
    oldbean.setContactTel(bean.getContactTel());
    oldbean.setOrgCodeCert(bean.getOrgCodeCert());
    oldbean.setFjHzyxs(bean.getFjHzyxs());
    oldbean.setFjBzs(bean.getFjBzs());
    oldbean.setFjKhxkz(bean.getFjKhxkz());
    oldbean.setFjRzkzfm(bean.getFjRzkzfm());
    oldbean.setFjRzsqs(bean.getFjRzsqs());
    oldbean.setFjJmht(bean.getFjJmht());
    oldbean.setFwsType(bean.getFwsType());
    oldbean.setFwsCategory(bean.getFwsCategory());
    Updater updater = new Updater(oldbean);
    bean = fwsMng.updateByUpdater(updater);

    log.info("update brand. id={}.", bean.getId());

    return "redirect:v_list.do";
  }
Ejemplo n.º 2
0
  /**
   * 保存入库
   *
   * @param bean
   * @param siteId
   * @param request
   * @param model
   * @return
   */
  @RequestMapping("/fws/o_save.do")
  public String save(Fws bean, Long siteId, HttpServletRequest request, ModelMap model) {
    Organization organization = organizationMng.findByName("服务商");
    WebErrors errors = validateSave(organization, request);
    if (errors.hasErrors()) {
      return errors.showErrorPage(model);
    }
    Website website = websiteMng.findById(bean.getWebsite().getId());

    String content = "";
    KetaUser ketaUser = bean.getKetaUser();
    ketaUser.setUsername(bean.getKetaUser().getUsername());
    ketaUser.setOrganization(organization);
    HashPassword hashPassword = CmsAuthorizingRealm.encryptPassword(ketaUser.getPainPass());
    ketaUser.setSalt(hashPassword.salt);
    ketaUser.setPassword(hashPassword.password);
    ketaUser.setRealname(bean.getCompanyName());
    ketaUser.setPhone(bean.getKetaUser().getPhone());
    ketaUserMng.save(ketaUser);
    User user = SiteUtils.getUser(request);
    bean.setUser(user);
    bean.setCreateTime(new Date());
    bean.setWebsite(website);
    Account account = new Account();
    account.setMoney(0d);
    bean.setPhone(ketaUser.getPhone());
    account.setUsername(user.getUsername());
    account.setStatus(0);
    bean.setAccount(account);
    bean = fwsMng.save(bean);
    content =
        content
            + "id:"
            + bean.getId()
            + ";新增服务商用户:"
            + bean.getKetaUser().getRealname()
            + ";站点id:"
            + website.getId()
            + "";
    cmsLogMng.operating(request, "fws.log.save", content);
    return "redirect:v_list.do";
  }