Esempio n. 1
0
 @RequestMapping("/fws/v_mapadd.do")
 public String add(HttpServletRequest request, Fws bean, ModelMap model) {
   if (bean != null && bean.getId() != null && bean.getId().length() > 0) {
     bean = fwsMng.findById(bean.getId());
   } else {
     bean = new Fws();
   }
   model.put("fws", bean);
   return "fws/mapadd";
 }
Esempio n. 2
0
  private WebErrors validateUpdate(Fws bean, HttpServletRequest request) {
    WebErrors errors = WebErrors.create(request);
    String id = bean.getId();

    errors.ifNull(id, "id");
    vldExist(id, errors);
    return errors;
  }
Esempio n. 3
0
  @RequestMapping("/fws/o_delete.do")
  public String delete(Fws bean, 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();
    cmsLogMng.operating(request, "fws.log.delete", content);
    oldbean.setIsDisabled(true);
    KetaUser ketaUser = oldbean.getKetaUser();
    ketaUser.setStatus("disabled");
    ketaUserMng.updateByUpdater(ketaUser);
    Updater updater = new Updater(oldbean);
    bean = fwsMng.updateByUpdater(updater);

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

    return "redirect:v_list.do";
  }
Esempio n. 4
0
 @RequestMapping("/fws/v_edit.do")
 public String edit(String id, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateEdit(id, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   List<Category> categoryList = categoryMng.getChildList(2l, false, null, 584l, null, true);
   model.put("categoryList", categoryList);
   Fws fws = fwsMng.findById(id);
   List categoryIdList = new ArrayList();
   if (fws.getFwsCategory() != null && fws.getFwsCategory().trim().length() > 0) {
     String[] ids = fws.getFwsCategory().split(",");
     if (ids != null && ids.length > 0) {
       for (String idd : ids) {
         categoryIdList.add(Integer.parseInt(idd));
       }
     }
   }
   model.addAttribute("categoryIdList", categoryIdList);
   model.addAttribute("fws", fws);
   return "fws/edit";
 }
Esempio n. 5
0
  /**
   * 审核通过
   *
   * @param bean
   * @param text
   * @param request
   * @param model
   * @return
   */
  @RequestMapping("/fws/o_update_tg.do")
  public String updatetg(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());
    ketaUser.setOrganization(organizationMng.findByName("服务商"));
    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.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());
    Updater updater = new Updater(oldbean);
    bean = fwsMng.updateByUpdater(updater);

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

    return "redirect:v_list.do";
  }
Esempio n. 6
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";
  }