标签:sys lock error 当前时间 script news format eth service
题目
要求
源码
package servlet; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; public class paquc { public static void main(String args[]) { // TODO Auto-generated method stub String sheng=""; String xinzeng=""; String leiji=""; String zhiyu=""; String siwang=""; String url = "https://wp.m.163.com/163/page/news/virus_report/index.html?_nw_=1&_anw_=1"; int i=0; try { //构造一个webClient 模拟Chrome 浏览器 WebClient webClient = new WebClient(BrowserVersion.CHROME); //支持JavaScript webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setActiveXNative(false); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setTimeout(8000); HtmlPage rootPage = webClient.getPage(url); //设置一个运行JavaScript的时间 webClient.waitForBackgroundJavaScript(6000); String html = rootPage.asXml(); Document doc = Jsoup.parse(html); //System.out.println(doc); Elements listdiv1 = doc.select(".wrap"); Elements listdiv2 = listdiv1.select(".province"); for(Element s:listdiv2) { Elements span = s.getElementsByTag("span"); Elements real_name=span.select(".item_name"); Elements real_newconfirm=span.select(".item_newconfirm"); Elements real_confirm=span.select(".item_confirm"); Elements real_dead=span.select(".item_dead"); Elements real_heal=span.select(".item_heal"); sheng=real_name.text(); xinzeng=real_newconfirm.text(); leiji=real_confirm.text(); zhiyu=real_heal.text(); siwang=real_dead.text(); //System.out.println(sheng+" 新增确诊:"+xinzeng+" 累计确诊:"+leiji+" 累计治愈:"+zhiyu+" 累计死亡:"+siwang); Date currentTime=new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String time = formatter.format(currentTime);//获取当前时间 AddService1 dao=new AddService1(); dao.add("info", sheng, xinzeng, leiji, zhiyu, siwang,time);//将爬取到的数据添加至数据库 } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("爬取失败"); } } }
package servlet; import java.sql.Connection; import java.sql.Statement; import util.DBUtil; public class AddService { public void add(String table,String sheng,String xinzeng,String leiji,String zhiyu,String dead,String time,int Kind) { String sql = "insert into "+table+" (Province,Newconfirmed_num ,Confirmed_num,Cured_num,Dead_num,Date,Kind) values(‘" + sheng + "‘,‘" + xinzeng +"‘,‘" + leiji +"‘,‘" + zhiyu + "‘,‘" + dead+ "‘,‘" + time+ "‘,‘" + Kind +"‘)"; System.out.println(sql); Connection conn = DBUtil.conn(); Statement state = null; int a = 0; try { state = conn.createStatement(); a=state.executeUpdate(sql); } catch (Exception e) { e.printStackTrace(); } finally { DBUtil.close(state, conn); } } }
psp
实际完成时间表
日期 |
开始时间 |
结束时间 |
中断时间 |
净时间 |
活动 |
备注 |
2020-03-09 |
16:00 |
18:00 |
|
1h30min |
|
|
2020--3-13 |
17:00 |
20:00 |
1h |
2h |
吃饭 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
缺陷记录表
日期 |
编号 |
类型 |
引入阶段 |
排除阶段 |
修复时间 |
修复缺陷 |
2020-03-09 |
1 |
只能获取源码,不能读取页面数据 |
|
|
|
|
描述 |
||||||
|
|
|
|
|
|
|
描述 |
||||||
|
|
|
|
|
|
|
描述 |
标签:sys lock error 当前时间 script news format eth service
原文地址:https://www.cnblogs.com/songxinai/p/12511494.html