| | |
| | | package com.yeshi.fanli.service.manger;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLDecoder;
|
| | | import java.util.HashSet;
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.httpclient.Header;
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.HttpException;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | CommonGoods goods = parseLink(urlList.get(0));
|
| | | if (goods == null || goods.getGoodsId() == null) {
|
| | | resultListener.onResult(new GoodsDocParseResultVO(text, urlList.get(0)));
|
| | | if (urlList.size() > 1)
|
| | | resultListener.onResult(new GoodsDocParseResultVO(text, urlList.get(0)));
|
| | | else {// 单链接
|
| | | // 判断是否包含可转链的链接
|
| | | if (!isContainsLinkConvert(link))
|
| | | resultListener.none();
|
| | | else
|
| | | resultListener.onResult(new GoodsDocParseResultVO(text, link));
|
| | | }
|
| | | } else {
|
| | | if (VersionUtil.greaterThan_2_0_7(platform, version)) {
|
| | | if (urlList.size() == 1)// 单链接+文本
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | private boolean isContainsLinkConvert(String link) {
|
| | | if (link.contains(".jd.com"))
|
| | | return true;
|
| | | else if (link.contains(".taobao.com") || link.contains(".tmall"))
|
| | | return true;
|
| | | else if (link.contains(".pinduoduo.com") || link.contains(".yangkeduo.com"))
|
| | | return true;
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|