package six.com.crawler.work.plugs;

import six.com.crawler.entity.Page;
import six.com.crawler.entity.ResultContext;
import six.com.crawler.http.HttpMethod;
import six.com.crawler.work.AbstractCrawlWorker;
import six.com.crawler.work.space.WorkSpace;

/**
 * 
 * @author weijiyong@tospur.com
 *
 */
public class DLDCJZUnitInfoWorker  extends AbstractCrawlWorker{

	WorkSpace<Page> roomStateInfoQueue;
	@Override
	protected void insideInit() {
		// TODO Auto-generated method stub
		roomStateInfoQueue = getManager().getWorkSpaceManager().newWorkSpace("dldc_jz_room_state_info", Page.class);
	}

	@Override
	protected void beforeDown(Page doingPage) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void beforeExtract(Page doingPage) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void afterExtract(Page doingPage, ResultContext resultContext) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void onComplete(Page doingPage, ResultContext resultContext) {
		String url=doingPage.getMeta("url").get(0);
		Page roomStateInfoPage= new Page(doingPage.getSiteCode(), 1, url, url);
		roomStateInfoPage.setReferer(doingPage.getFinalUrl());
		roomStateInfoPage.setMethod(HttpMethod.GET);
		
		roomStateInfoPage.getMetaMap().put("projectId", doingPage.getMeta("projectId"));
		roomStateInfoPage.getMetaMap().put("projectName", doingPage.getMeta("projectName"));
		roomStateInfoPage.getMetaMap().put("lid", doingPage.getMeta("lid"));
		roomStateInfoPage.getMetaMap().put("xmid", doingPage.getMeta("xmid"));
		roomStateInfoPage.getMetaMap().put("presellCode", doingPage.getMeta("presellCode"));
		roomStateInfoQueue.push(roomStateInfoPage);
	}
}

@@ -32,16 +32,99 @@
 ugs;%0D%0A%0D%0A
+import org.apache.commons.lang3.StringUtils;%0D%0Aimport org.jsoup.select.Elements;%0D%0A%0D%0A
 import s
@@ -152,16 +152,16 @@
 .Page;%0D%0A
-
 import s
@@ -239,16 +239,62 @@
 ethod;%0D%0A
+import six.com.crawler.utils.ArrayListUtils;%0D%0A
 import s
@@ -540,16 +540,124 @@
 Queue;%0D%0A
+%09%0D%0A%09String unitDetailCss=%22form%5Bid=ysxkzForm%5D%3Etable%3Etbody%3Etr:eq(0)%3Etd%3Etable%3Etbody%3Etr%3Etd%3Etable%3Etbody%3Etr%3Etd%22;%0D%0A
 %09@Overri
@@ -1021,46 +1021,569 @@
 %0D%0A%09%09
-// TODO Auto-generated method stub%0D%0A%09%09
+Elements details=doingPage.getDoc().select(unitDetailCss);%0D%0A%09%09String buildStructure=StringUtils.substringAfter(details.get(0).ownText(),%22%E5%BB%BA%E7%AD%91%E7%BB%93%E6%9E%84%EF%BC%9A%22);%0D%0A%09%09String totalLayer=StringUtils.substringAfter(details.get(1).ownText(),%22%E6%80%BB%E5%B1%82%E6%95%B0%EF%BC%9A%22);%0D%0A%09%09String groundLayer=StringUtils.substringAfter(details.get(3).ownText(),%22%E5%9C%B0%E4%B8%8A%E5%B1%82%E6%95%B0%EF%BC%9A%22);%0D%0A%09%09doingPage.getMetaMap().put(%22buildStructure%22, ArrayListUtils.asList(buildStructure));%0D%0A%09%09doingPage.getMetaMap().put(%22totalLayer%22, ArrayListUtils.asList(totalLayer));%0D%0A%09%09doingPage.getMetaMap().put(%22groundLayer%22, ArrayListUtils.asList(groundLayer));
 %0D%0A%09%7D
@@ -2082,21 +2082,21 @@
 .put(%22pr
-oject
+esell
 Id%22, doi
@@ -2117,222 +2117,64 @@
 (%22pr
-ojectId%22));%0D%0A%09%09roomStateInfoPage.getMetaMap().put(%22projectName%22, doingPage.getMeta(%22projectName%22));%0D%0A%09%09roomStateInfoPage.getMetaMap().put(%22lid%22, doingPage.getMeta(%22lid%22));%0D%0A%09%09roomStateInfoPage.getMetaMap().put(%22xmi
+esellId%22));%0D%0A%09%09roomStateInfoPage.getMetaMap().put(%22unitI
 d%22, 
@@ -2196,11 +2196,13 @@
 ta(%22
-xmi
+unitI
 d%22))
@@ -2244,25 +2244,23 @@
 .put(%22pr
-esellCode
+ojectId
 %22, doing
@@ -2279,17 +2279,15 @@
 (%22pr
-esellCode
+ojectId
 %22));

添加楼栋详细建筑结构、总层数、地上层数属性，并优化代码逻辑