/** 显示一级栏目列表 */
 public String execute(HkRequest req, HkResponse resp) throws Exception {
   req.setAttribute("active_1", 1);
   long companyId = req.getLong("companyId");
   List<CmpNav> list =
       this.cmpNavProcessor.getCmpNavListByCompanyIdAndNlevel(companyId, CmpNav.NLEVEL_1, true);
   int i = 1;
   for (CmpNav o : list) {
     if (o.getOrderflg() <= 0) {
       o.setOrderflg(i);
       this.cmpNavService.updateCmpNavOrderflg(o.getOid(), i);
     }
     i++;
   }
   for (CmpNav o : list) {
     if (o.isDirectory()) {
       if (this.cmpNavService.countCmpNavByCompanyIdAndParentIdAndNlevel(
               companyId, o.getOid(), CmpNav.NLEVEL_2)
           > 0) {
         o.setHasChild(true);
       }
     }
   }
   req.setAttribute("list", list);
   return this.getWebPath("admin/cmpnav/list.jsp");
 }
 /**
  * 修改栏目
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception 2010-5-10
  */
 public String update(HkRequest req, HkResponse resp) {
   req.setAttribute("active_1", 1);
   long oid = req.getLongAndSetAttr("oid");
   CmpNav cmpNav = this.cmpNavService.getCmpNav(oid);
   req.setAttribute("cmpNav", cmpNav);
   int ch = req.getInt("ch");
   long companyId = req.getLong("companyId");
   if (ch == 0) {
     if (cmpNav.getKindId() > 0) {
       CmpStudyKind cmpStudyKind =
           this.cmpStudyKindService.getCmpStudyKind(companyId, cmpNav.getKindId());
       req.setAttribute("cmpStudyKind", cmpStudyKind);
     }
     List<CmpFuncRef> funcreflist = this.cmpFuncService.getCmpFuncRefListByCompanyId(companyId);
     req.setAttribute("funcreflist", funcreflist);
     return this.getWebPath("admin/cmpnav/update.jsp");
   }
   String name = req.getHtmlRow("name");
   int reffunc = req.getInt("reffunc");
   byte showflg = req.getByte("showflg");
   cmpNav.setName(name);
   cmpNav.setReffunc(reffunc);
   cmpNav.setShowflg(showflg);
   cmpNav.setApplyformflg(req.getByte("applyformflg"));
   cmpNav.setFileShowflg(req.getByte("fileShowflg"));
   cmpNav.setFileShowLink(req.getString("fileShowLink"));
   cmpNav.setTitle(req.getHtmlRow("title"));
   cmpNav.setIntro(req.getHtml("intro"));
   cmpNav.setBgflg(req.getByte("bgflg"));
   int code = cmpNav.validate();
   if (code != Err.SUCCESS) {
     return this.onError(req, code, "updateerror", null);
   }
   if (reffunc == CmpNav.REFFUNC_BBS || reffunc == CmpNav.REFFUNC_PRODUCT) {
     CmpNav o =
         this.cmpNavService.getCmpNavByCompanyIdAndReffunc(req.getLong("companyId"), reffunc);
     if (o != null && o.getOid() != cmpNav.getOid()) {
       if (reffunc == CmpNav.REFFUNC_BBS) {
         return this.onError(req, Err.CMPNAV_REFFUNC_BBS_EXIST, "updateerror", null);
       }
       return this.onError(req, Err.CMPNAV_REFFUNC_PRODUCT_EXIST, "updateerror", null);
     }
   }
   File bgFile = null;
   if (cmpNav.isBgSet()) {
     bgFile = req.getFile("bgf");
   }
   code = this.cmpNavProcessor.updateCmpNav(cmpNav, req.getFile("f"), bgFile);
   if (code != Err.SUCCESS) {
     if (code == Err.IMG_OUTOFSIZE_ERROR_FOR_SIZE) {
       return this.onError(
           req, Err.IMG_OUTOFSIZE_ERROR_FOR_SIZE, new Object[] {"200k"}, "updateerror", null);
     }
     return this.onError(req, code, "updateerror", null);
   }
   this.setOpFuncSuccessMsg(req);
   return this.onSuccess2(req, "updateok", null);
 }
 /**
  * 显示二级栏目列表
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception 2010-5-11
  */
 public String list2(HkRequest req, HkResponse resp) throws Exception {
   req.setAttribute("active_1", 1);
   long companyId = req.getLong("companyId");
   long parentId = req.getLongAndSetAttr("parentId");
   CmpNav cmpNav = this.cmpNavService.getCmpNav(parentId);
   req.setAttribute("cmpNav", cmpNav);
   if (cmpNav.isArticleList()) {
     SimplePage page = req.getSimplePage(20);
     List<CmpArticle> list =
         this.cmpArticleService.getCmpArticleListByCompanyIdAndCmpNavOid(
             companyId, parentId, null, page.getBegin(), page.getSize() + 1);
     this.processListForPage(page, list);
     req.setAttribute("list", list);
   } else if (cmpNav.isDirectory()) {
     List<CmpNav> list =
         this.cmpNavProcessor.getCmpNavListByCompanyIdAndParentId(companyId, parentId, true);
     int i = 1;
     for (CmpNav o : list) {
       if (o.getOrderflg() <= 0) {
         o.setOrderflg(i);
         this.cmpNavService.updateCmpNavOrderflg(o.getOid(), i);
       }
       i++;
     }
     req.setAttribute("list", list);
   }
   return this.getWebPath("admin/cmpnav/list2.jsp");
 }
 /**
  * 添加栏目
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception 2010-5-10
  */
 public String create(HkRequest req, HkResponse resp) {
   req.setAttribute("active_1", 1);
   long companyId = req.getLong("companyId");
   int ch = req.getInt("ch");
   if (ch == 0) {
     List<CmpFuncRef> funcreflist = this.cmpFuncService.getCmpFuncRefListByCompanyId(companyId);
     req.setAttribute("funcreflist", funcreflist);
     return this.getWebPath("admin/cmpnav/create.jsp");
   }
   String name = req.getHtmlRow("name");
   int reffunc = req.getInt("reffunc");
   byte showflg = req.getByte("showflg");
   CmpNav cmpNav = new CmpNav();
   cmpNav.setCompanyId(companyId);
   cmpNav.setName(name);
   cmpNav.setNlevel(CmpNav.NLEVEL_1);
   cmpNav.setReffunc(reffunc);
   cmpNav.setShowflg(showflg);
   cmpNav.setApplyformflg(req.getByte("applyformflg"));
   cmpNav.setFileShowflg(req.getByte("fileShowflg"));
   cmpNav.setFileShowLink(req.getString("fileShowLink"));
   cmpNav.setTitle(req.getHtmlRow("title"));
   cmpNav.setIntro(req.getHtml("intro"));
   cmpNav.setBgflg(req.getByte("bgflg"));
   int code = cmpNav.validate();
   if (code != Err.SUCCESS) {
     return this.onError(req, code, "createerror", null);
   }
   if (reffunc == CmpNav.REFFUNC_BBS || reffunc == CmpNav.REFFUNC_PRODUCT) {
     CmpNav o = this.cmpNavService.getCmpNavByCompanyIdAndReffunc(companyId, reffunc);
     if (o != null) {
       if (reffunc == CmpNav.REFFUNC_BBS) {
         return this.onError(req, Err.CMPNAV_REFFUNC_BBS_EXIST, "createerror", null);
       }
       return this.onError(req, Err.CMPNAV_REFFUNC_PRODUCT_EXIST, "createerror", null);
     }
   }
   if (cmpNav.getFileShowLink() != null
       && cmpNav.getFileShowLink().toLowerCase().startsWith("http://")) {
     cmpNav.setFileShowLink(cmpNav.getFileShowLink().substring(7));
   }
   File f = req.getFile("f");
   File bgFile = null;
   if (cmpNav.isBgSet()) {
     bgFile = req.getFile("bgf");
   }
   code = this.cmpNavProcessor.createCmpNav(cmpNav, f, bgFile);
   if (code != Err.SUCCESS) {
     if (code == Err.IMG_OUTOFSIZE_ERROR_FOR_SIZE) {
       return this.onError(req, code, new Object[] {"200k"}, "createerror", null);
     }
     return this.onError(req, code, "createerror", null);
   }
   this.setOpFuncSuccessMsg(req);
   return this.onSuccess2(req, "createok", cmpNav.getOid());
 }
 /**
  * 添加栏目
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception 2010-5-10
  */
 public String create2(HkRequest req, HkResponse resp) {
   req.setAttribute("active_1", 1);
   long parentId = req.getLongAndSetAttr("parentId");
   long companyId = req.getLong("companyId");
   int ch = req.getInt("ch");
   if (ch == 0) {
     CmpNav parent = this.cmpNavService.getCmpNav(parentId);
     req.setAttribute("parent", parent);
     List<CmpFuncRef> funcreflist = this.cmpFuncService.getCmpFuncRefListByCompanyId(companyId);
     req.setAttribute("funcreflist", funcreflist);
     return this.getWebPath("admin/cmpnav/create2.jsp");
   }
   String name = req.getHtmlRow("name");
   int reffunc = req.getInt("reffunc");
   byte showflg = req.getByte("showflg");
   CmpNav cmpNav = new CmpNav();
   cmpNav.setCompanyId(companyId);
   cmpNav.setName(name);
   cmpNav.setNlevel(CmpNav.NLEVEL_2);
   cmpNav.setReffunc(reffunc);
   cmpNav.setShowflg(showflg);
   cmpNav.setParentId(parentId);
   cmpNav.setApplyformflg(req.getByte("applyformflg"));
   cmpNav.setTitle(req.getHtmlRow("title"));
   cmpNav.setIntro(req.getHtml("intro"));
   cmpNav.setUrl(req.getHtmlRow("url"));
   int code = cmpNav.validate();
   if (code != Err.SUCCESS) {
     return this.onError(req, code, "createerror", null);
   }
   if (reffunc == CmpNav.REFFUNC_BBS || reffunc == CmpNav.REFFUNC_PRODUCT) {
     CmpNav o = this.cmpNavService.getCmpNavByCompanyIdAndReffunc(companyId, reffunc);
     if (o != null) {
       if (reffunc == CmpNav.REFFUNC_BBS) {
         return this.onError(req, Err.CMPNAV_REFFUNC_BBS_EXIST, "createerror", null);
       }
       return this.onError(req, Err.CMPNAV_REFFUNC_PRODUCT_EXIST, "createerror", null);
     }
   }
   code = this.cmpNavProcessor.createCmpNav(cmpNav, null, req.getFile("bgf"));
   if (code != Err.SUCCESS) {
     if (code == Err.IMG_OUTOFSIZE_ERROR_FOR_SIZE) {
       return this.onError(
           req, Err.IMG_OUTOFSIZE_ERROR_FOR_SIZE, new Object[] {"200k"}, "createerror", null);
     }
     return this.onError(req, code, "createerror", null);
   }
   this.setOpFuncSuccessMsg(req);
   return this.onSuccess2(req, "createok", cmpNav.getOid());
 }