日期:2014-05-17 浏览次数:20757 次
public String downnew() throws Exception{
int total = downManager.get_total();//error=0数据个数
int p=total/1000;
/*if(p%1000>0)
p=p+1;*/
System.out.println("开始执行down导入程序");
System.out.println("total:"+String.valueOf(total));
System.out.println("p:"+String.valueOf(p));
int i=base;
try {
for(int pp=0;pp<p;pp++){
List<Down> listdown = downManager.getDown_news(pp*1000);
for(Down d :listdown){
Integer fid=d.getFid();
Integer zid=d.getZid();
String chapter=d.getChapter();
String type=d.getType();
Date downtime=d.getTime();
boolean error=d.isError();
Downnew d_new=new Downnew();
d_new.setFid(fid);
d_new.setZid(zid);
d_new.setChapter(chapter);
d_new.setType(type);
d_new.setTime(downtime);
d_new.setError(error);
try{
hibernateDao.save(d_new);
System.out.println("i:"+String.valueOf(++i));
}catch (Exception e) {
e.printStackTrace();
}
}
}
}catch (Exception e) {
e.printStackTrace();
}
System.out.println("----------------------------开始执行down导入程序完成-----------------------------------------------");
return "input";
}
/**
* 获取down列表error=0的前面100个数据----调试用
* @param i :结果集的第i条开始获取
*/
public List<Down> getDown_news(Integer i){
return super.createCriteria(Down.class)
.add(Restrictions.eq("error", false))
.setFirstResult(i)
.setMaxResults(1000)
.list();
}