替换掉递归的方法实现

public void repaceT(String storeId)throws Exception{

String hql = "from StoreBookInfo t where t.isSale='0' and t.sif.id='"+storeId+"' order by t.id";
  for (int i = 0; i < Integer.MAX_VALUE; i++) {
   List<StoreBookInfo> list = storeBookInfoBo.findByPage(hql, i, 300);
   if (list != null) {
    if (0 == list.size()) {
     break;
    } else {
     String bookId = null;
     for (int j = 0; j < list.size(); j++) {
      // 获取编号
      bookId = list.get(j).getId();
      // 首先判断是否存在此编号
      String hasId = htmlFlagLogBo.findLog(bookId);
      if (hasId == null) {
       // 表示在静态化日志表中不存在此图书编号
       try {
        createBookDetail(storeId, bookId);
        // 如果没有问题,则直接更新状态为已经生成Y。
        // 则插入一条记录
        HtmlFlagLog hfg = new HtmlFlagLog();
        hfg.setId(bookId);
        hfg.setIsHtml(HtmlFlagLog.IS_HTML_FLAG_Y);
        hfg.setUpdateTime(new Date());
        htmlFlagLogBo.saveHtmlFlagLog(hfg);

       } catch (Exception e) {
        log.error("静态化日志表中不存在此编号图书,但生成静态化时,出现异常。图书编号为:"
          + bookId + "店铺编号为:" + storeId
          + e.getMessage());
       }
      } else {
       // 静态化日志表中有此编号

       String flag = htmlFlagLogBo.findLog(bookId);
       if (HtmlFlagLog.IS_HTML_FLAG_N.equals(flag)) {
        try {
         createBookDetail(storeId, bookId);
         // 如果没有问题,则直接更新状态为已经生成Y。
         htmlFlagLogBo.updateHtmlFlagLog(bookId,
           HtmlFlagLog.IS_HTML_FLAG_Y);
        } catch (Exception e) {
         log
           .error("静态化日志表中存在此编号图书,但生成静态化时,出现异常。图书编号为:"
             + bookId
             + "店铺编号为:"
             + storeId + e.getMessage());
        }
       }

      }
     }
     log.info("=====================页数=================" + i);
    }
   }
  }

}

你可能感兴趣的:(html,J#)