Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
lcstore committed Jan 23, 2015
1 parent 4e83bbb commit 10dd5ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void testConfig() throws Exception {
parser = new ConfigProxyChecker();
parser = new ConfigProxyDetector();
parser = new ConfigProxyCollector();
parser = new ConfigJdProduct();
parser = new ConfigJdPromotion();
parser = new ConfigTmallBrandList();
parser = new ConfigTmallBrandShop();
Expand All @@ -83,7 +82,8 @@ public void testConfig() throws Exception {
// parser = new ConfigBarCodeCollector();
// parser = new ConfigBaiduDoc();
// parser = new ConfigBarCodeMatcher();
// parser = new ConfigYhdProduct();
parser = new ConfigYhdProduct();
parser = new ConfigJdProduct();
// parser = new ConfigYhdPromotion();
// parser = new ConfigYhdProduct();
// parser = new ConfigYhdPromotList();
Expand Down Expand Up @@ -131,6 +131,8 @@ public void testConfig() throws Exception {
url = "http://item.jd.com/1226984.html";
url = "http://brand.tmall.com/brandMap.htm?spm=a3200.2192449.0.0.6OiqFL";
url = "http://brand.tmall.com/brandInfo.htm?brandId=31674&type=0";
url = "http://item.yhd.com/item/9105839";
url = "http://item.jd.com/1264683.html";
// urlList.add(url);
TaskWritable task = new TaskWritable();
// task.put("barCode", "6900068005020");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.cookie.BasicClientCookie;
Expand Down Expand Up @@ -90,7 +91,14 @@ private DataBean getDataObject(TaskWritable task) throws Exception {
productBean.setProductCode(oElements.first().attr("value").trim());
}
if (oHomeAs.isEmpty()) {
productBean.setSoldNum(-1);
if (StringUtils.isEmpty(productBean.getProductCode())) {
Pattern oReg = Pattern.compile("item/([0-9]{5,})");
Matcher matcher = oReg.matcher(url);
if (matcher.find()) {
productBean.setProductCode(matcher.group(1));
}
}
productBean.setStockNum(-1);
return dataBean;
}
String detailUrl = String.format("http://gps.yihaodian.com/restful/detail?mcsite=1&provinceId=1&pmId=%s&callback=jsonp%s", productBean.getProductCode(), System.currentTimeMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ public void write(List<ProductStatDto> dataList) {
productStatService.batchSaveProductStatDtos(dataList);
}
}

}

0 comments on commit 10dd5ce

Please sign in to comment.