|
|
|
@ -12,9 +12,9 @@ import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.jsoup.Jsoup;
|
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
|
import org.jsoup.nodes.Element;
|
|
|
|
|
import org.jsoup.select.Elements;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -99,38 +99,41 @@ public class MesFordFetchWebServiceImpl implements IFordFetchWebService {
|
|
|
|
|
log.info("doFetchData-查询出来的内容为:{}",response.body());
|
|
|
|
|
Document doc = Jsoup.parse(response.body());
|
|
|
|
|
Elements trList = doc.select("tr");
|
|
|
|
|
for (Element tr : trList) {
|
|
|
|
|
Elements tdList = tr.select("td");
|
|
|
|
|
MesFordJsaSortInfoWithFetchWeb webInfo = new MesFordJsaSortInfoWithFetchWeb();
|
|
|
|
|
webInfo.setSeq(Long.parseLong(tdList.get(0).text()));
|
|
|
|
|
webInfo.setFetchDate(tdList.get(1).text());
|
|
|
|
|
webInfo.setFetchTime(tdList.get(2).text());
|
|
|
|
|
webInfo.setVinCode(tdList.get(3).text());
|
|
|
|
|
webInfo.setPartNo(tdList.get(4).text());
|
|
|
|
|
webInfo.setPartName(tdList.get(5).text());
|
|
|
|
|
webInfo.setColorCode(tdList.get(6).text());
|
|
|
|
|
webInfo.setInfo0008(tdList.get(7).text());
|
|
|
|
|
webInfo.setSeqContext(tdList.get(8).text());
|
|
|
|
|
webInfo.setRemark(tdList.get(9).text());
|
|
|
|
|
webInfo.setInfoPointDesc(tdList.get(10).text());
|
|
|
|
|
webInfo.setFetchType(1); //抓取类型
|
|
|
|
|
webInfo.setDataStatus(200);
|
|
|
|
|
webInfo.setOrganizeCode(organizeCode);
|
|
|
|
|
webInfo.setInfoPointCode(parameter.getInfoPointCode());
|
|
|
|
|
webInfo.setCustOrganizeCode(parameter.getCustOrganizeCode());
|
|
|
|
|
ConvertBean.saveOrUpdate(webInfo,"doFetchData");
|
|
|
|
|
//校验是否已经查询过
|
|
|
|
|
DdlPackBean webInfoPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(webInfo.getSeq(),"seq",webInfoPackBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(webInfo.getFetchDate(),"fetchDate",webInfoPackBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(webInfo.getFetchTime(),"fetchTime",webInfoPackBean);
|
|
|
|
|
int count = fetchWebRao.findByHqlWhereCount(webInfoPackBean);
|
|
|
|
|
if (count > 0){
|
|
|
|
|
continue;
|
|
|
|
|
for (int i = 1; i < trList.size(); i++) {
|
|
|
|
|
Elements tdList = trList.get(i).select("td");
|
|
|
|
|
MesFordJsaSortInfoWithFetchWeb webInfo = new MesFordJsaSortInfoWithFetchWeb();
|
|
|
|
|
if (tdList.get(0).text().equals("无数据") || StringUtils.isBlank(tdList.get(0).text())){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
webInfo.setSeq(Long.parseLong(tdList.get(0).text()));
|
|
|
|
|
webInfo.setFetchDate(tdList.get(1).text());
|
|
|
|
|
webInfo.setFetchTime(tdList.get(2).text());
|
|
|
|
|
webInfo.setVinCode(tdList.get(3).text());
|
|
|
|
|
webInfo.setPartNo(tdList.get(4).text());
|
|
|
|
|
webInfo.setPartName(tdList.get(5).text());
|
|
|
|
|
webInfo.setColorCode(tdList.get(6).text());
|
|
|
|
|
webInfo.setInfo0008(tdList.get(7).text());
|
|
|
|
|
webInfo.setSeqContext(tdList.get(8).text());
|
|
|
|
|
webInfo.setRemark(tdList.get(9).text());
|
|
|
|
|
webInfo.setInfoPointDesc(tdList.get(10).text());
|
|
|
|
|
webInfo.setFetchType(1); //抓取类型
|
|
|
|
|
webInfo.setDataStatus(200);
|
|
|
|
|
webInfo.setOrganizeCode(organizeCode);
|
|
|
|
|
webInfo.setInfoPointCode(parameter.getInfoPointCode());
|
|
|
|
|
webInfo.setCustOrganizeCode(parameter.getCustOrganizeCode());
|
|
|
|
|
ConvertBean.saveOrUpdate(webInfo,"doFetchData");
|
|
|
|
|
//校验是否已经查询过
|
|
|
|
|
DdlPackBean webInfoPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(webInfo.getSeq(),"seq",webInfoPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(webInfo.getFetchDate(),"fetchDate",webInfoPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(webInfo.getFetchTime(),"fetchTime",webInfoPackBean);
|
|
|
|
|
int count = fetchWebRao.findByHqlWhereCount(webInfoPackBean);
|
|
|
|
|
if (count > 0){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
fetchWebRao.insert(webInfo);
|
|
|
|
|
infoList.add(webInfo);
|
|
|
|
|
}
|
|
|
|
|
fetchWebRao.insert(webInfo);
|
|
|
|
|
infoList.add(webInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return infoList;
|
|
|
|
|
}
|
|
|
|
|