Esempio n. 1
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. 2
0
 private void vldExist(Long id, WebErrors errors) {
   if (errors.hasErrors()) {
     return;
   }
   ProductTag entity = productTagMng.findById(id);
   errors.ifNotExist(entity, ProductTag.class, id);
 }
Esempio n. 3
0
 private WebErrors validateDelete(String[] ids, HttpServletRequest request) {
   WebErrors errors = WebErrors.create(request);
   errors.ifEmpty(ids, "ids");
   for (String id : ids) {
     vldExist(id, errors);
   }
   return errors;
 }
Esempio n. 4
0
 private WebErrors validateSave(Organization organization, HttpServletRequest request) {
   WebErrors errors = WebErrors.create(request);
   //		Dls lsfc=fwsMng.findByFctypeId(bean.getFctypeId().getId(), bean.getWebsite().getId());
   if (organization == null || organization.getId() < 1) {
     errors.addError("服务商组织机构不存在");
   }
   return errors;
 }
Esempio n. 5
0
  private WebErrors validatePsqy(Psqy bean, HttpServletRequest request) {
    WebErrors errors = WebErrors.create(request);
    Long id = bean.getId();

    errors.ifNull(id, "id");
    vldPsqyExist(id, errors);
    return errors;
  }
Esempio n. 6
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. 7
0
 @RequestMapping("/fws/v_fwssh.do")
 public String fwssh(String id, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateEdit(id, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   model.addAttribute("fws", fwsMng.findById(id));
   return "fws/fwssh";
 }
Esempio n. 8
0
 @RequestMapping("/tag/o_save.do")
 public String save(ProductTag bean, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateSave(bean, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   bean = productTagMng.save(bean);
   log.info("save ProductTag. id={}", bean.getId());
   return "redirect:v_list.do";
 }
Esempio n. 9
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";
  }
Esempio n. 10
0
 @RequestMapping("/tag/o_delete.do")
 public String delete(Long[] ids, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateDelete(ids, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   ProductTag[] beans = productTagMng.deleteByIds(ids);
   for (ProductTag bean : beans) {
     log.info("delete ProductTag. id={},name={}", bean.getId(), bean.getName());
   }
   return list(request, model);
 }
Esempio n. 11
0
 @RequestMapping("/tag/o_update_tag_names.do")
 public String updateTagName(
     Long[] wids, String[] tagNames, HttpServletRequest request, ModelMap model) {
   WebErrors errors = validateUpdateTagNames(wids, tagNames, request);
   if (errors.hasErrors()) {
     return errors.showErrorPage(model);
   }
   ProductTag[] beans = productTagMng.updateTagName(wids, tagNames);
   for (ProductTag bean : beans) {
     log.info("update ProductTag. id={},name={}", bean.getId(), bean.getName());
   }
   return "redirect:v_list.do";
 }
Esempio n. 12
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";
  }
Esempio n. 13
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. 14
0
 private WebErrors validateUpdateTagNames(
     Long[] wids, String[] tagNames, HttpServletRequest request) {
   WebErrors errors = WebErrors.create(request);
   errors.ifEmpty(wids, "wids");
   errors.ifEmpty(tagNames, "tagNames");
   if (errors.hasErrors()) {
     return errors;
   }
   if (wids.length != tagNames.length) {
     errors.addErrorString("wids length must equals tagNames length");
     return errors;
   }
   for (int i = 0, len = wids.length; i < len; i++) {
     vldExist(wids[i], errors);
     if (errors.hasErrors()) {
       return errors;
     }
   }
   return errors;
 }
Esempio n. 15
0
 private boolean vldExist(String id, WebErrors errors) {
   Fws entity = fwsMng.findById(id);
   return errors.ifNotExist(entity, Fws.class, id);
 }
Esempio n. 16
0
 private boolean vldPsqyExist(Long id, WebErrors errors) {
   Psqy entity = psqyMng.findById(id);
   return errors.ifNotExist(entity, Psqy.class, id);
 }
Esempio n. 17
0
 private WebErrors validateEdit(String id, HttpServletRequest request) {
   WebErrors errors = WebErrors.create(request);
   errors.ifNull(id, "id");
   vldExist(id, errors);
   return errors;
 }
Esempio n. 18
0
 private WebErrors validateSave(ProductTag bean, HttpServletRequest request) {
   WebErrors errors = WebErrors.create(request);
   bean.setWebsite(SiteUtils.getWeb(request));
   return errors;
 }