Commit 8a869d7e authored by 赵啸非's avatar 赵啸非

更新根据站点查询站点树

parent 14a2b22b
......@@ -226,7 +226,6 @@ public class MatterDetailHtmlParseUtil {
List<Map<String, Object>> resultListMap = new ArrayList<>();
String baseInfoExp = "//div[@class='section7']//table[1]//tr[1]//td";
String baseInfoExp1 = "//div[@class='section7']//table[1]//tr";
XPath xPath = XPathFactory.newInstance().newXPath();
Object result;
int rowNum = 0;
try {
......@@ -237,36 +236,13 @@ public class MatterDetailHtmlParseUtil {
Map<String, Object> map = new HashMap<>();
String baseInfoTempExp = String.format("//div[@class='section7']//table[1]//tr[%d]//td", j + 1);
Elements evaluateList = dom.selectXpath(baseInfoTempExp);
if (ObjectUtils.isEmpty(evaluateList)) continue;
for (int k = 0; k < evaluateList.size(); k++) {
map.put(nodeList.get(k).text(), evaluateList.get(k).text().trim());
map.put("sort", j);
}
resultListMap.add(map);
}
/*
result = xPath.evaluate(baseInfoExp1, dom, XPathConstants.NODESET);
if (result instanceof NodeList) {
NodeList nodeList = (NodeList) result;
rowNum = nodeList.getLength();
}
result = xPath.evaluate(baseInfoExp, dom, XPathConstants.NODESET);
if (result instanceof NodeList) {
NodeList nodeList = (NodeList) result;
// int num = nodeList.getLength();
for (int j = 1; j <= rowNum; j++) {
Map<String, Object> map = new HashMap<>();
String baseInfoTempExp = String.format("//div[@class='section7']//table[1]//tr[%d]//td", j + 1);
Object evaluate = xPath.evaluate(baseInfoTempExp, dom, XPathConstants.NODESET);
if (evaluate instanceof NodeList) {
NodeList evaluateList = (NodeList) evaluate;
for (int k = 0; k < evaluateList.getLength(); k++) {
map.put(nodeList.item(k).getTextContent(), evaluateList.item(k).getTextContent().trim());
map.put("sort", j);
}
}
resultListMap.add(map);
}
}*/
} catch (Exception e) {
log.error("办理流程xpath解析异常:", e);
}
......
......@@ -233,9 +233,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
*/
@Override
public Rest<String> syncDelMatterBySiteId(SiteEntity siteEntity, Context context) {
//
List<MatterEntity> govMatterList = getMatterEntities(siteEntity, context);
log.info("计算差集");
MatterQuery matterQuery = new MatterQuery();
matterQuery.setAreaCode(siteEntity.getAreaCode());
......@@ -260,21 +258,16 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
}
SiteThemeMatterQuery siteThemeMatterQuery = new SiteThemeMatterQuery();
siteThemeMatterQuery.setMatterIdList(Arrays.asList(delMatterIds));
List<SiteThemeMatterEntity> delSiteThemeMatterList = siteThemeMatterService.find(siteThemeMatterQuery);
if (!ObjectUtils.isEmpty(delSiteThemeMatterList)) {
log.info("删除站点主题事项数量:{}", delSiteThemeMatterList.size());
siteThemeMatterService.removeList(delSiteThemeMatterList, context);
}
}
return Rest.ok("同步删除成功!");
}
/**
* @param Code
* @param context
* @return
*/
......
......@@ -1041,15 +1041,11 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
//根据事项url 获取事项详细信息,构建相关详细信息
// String html = null;
//Boolean bool = false;
String msg = "";
int reCount = 0;
while (reCount < MAX_RETRY_COUNT) {
try {
if (ObjectUtils.isEmpty(matterEntity.getUrl())) {
// bool = true;
msg = "事项url不能为空!";
break;
//return Rest.fail("事项url不能为空!");
return Rest.fail("事项url不能为空!");
}
Document dom = Jsoup.connect(matterEntity.getUrl())
.ignoreContentType(true)
......@@ -1063,10 +1059,6 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
Setting baseInfoSetting = interceptorConfig.getBaseInfoSetting();
Setting sqclInfoSetting = interceptorConfig.getSqclInfoSetting();
/* if(!ObjectUtils.isEmpty(matterEntity.getDeptCode())&&ObjectUtils.isEmpty(matterEntity.getDeptName())){
DeptEntity extCache = deptService.getExtCache(matterEntity.getDeptCode());
matterEntity.setDeptName(extCache==null?"":extCache.getName());
}*/
//根据本地与远端事项版本觉得是否更新或者新增
Integer matterEditionLocal = DataUtil.converStr2Int(matterEntity.getMatterEdition(), 0);
......@@ -1074,41 +1066,29 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
Integer matterEditionRemote = DataUtil.converStr2Int(baseInfoMap.getOrDefault("事项版本", "0"), 0);
if (matterEditionLocal >= matterEditionRemote) {
//bool = true;
msg = "本地事项版本大于等于远端,不需要更新!!";
// break;
// return Rest.fail("本地事项版本大于等于远端,不需要更新!");
return Rest.fail("本地事项版本大于等于远端,不需要更新!");
}
// log.info("更新详细事项==>{},id===>{},localVersion===>{},newVersion==>{}", matterEntity.getMatterName(),matterEntity.getId(),matterEntity.getMatterEdition(), matterEditionRemote);
//更新部门信息
DeptEntity extCache = deptService.getExtCache(matterEntity.getDeptCode());
matterEntity.setDeptName(extCache == null ? "" : extCache.getName());
//构建基础信息参数
savebaseInfo(matterEntity, baseInfoMap, baseInfoSetting);
//更新材料属性
saveDatumInfo(matterEntity, context, dom, sqclInfoSetting);
//更新受理条件
saveSltjInfo(matterEntity, context, dom);
//更新办理流程
saveBllcInfo(matterEntity, context, dom);
//更新收费标准
saveSfbzInfo(matterEntity, context, dom);
//设定依据
saveSdyjInfo(matterEntity, context, dom);
//中介服务
saveZjfwInfo(matterEntity, context, dom);
//常见问题
saveCjwtInfo(matterEntity, context, dom);
//更新事项更新标志
matterEntity.setHaveGetMatterInfo("true");
......@@ -1139,19 +1119,10 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
}
} catch (Exception e) {
log.error(String.format("获取详细异常! id:%s,matterCode:%s,url:%s", matterEntity.getId(), matterEntity.getMatterNo(), matterEntity.getUrl()), e);
//bool = true;
msg = e.getMessage();
break;
// return Rest.fail("更新事项失败!" + e.getMessage());
return Rest.fail("更新事项失败!" + e.getMessage());
}
}
return Rest.fail(msg);
/* if (bool) {
return Rest.fail(msg);
} else {
return Rest.ok("更新详细成功!");
}*/
return Rest.fail("更新事项失败!");
}
......
......@@ -113,8 +113,7 @@ POST {{baseUrl}}/site/getAreaSitesBySite
Content-Type: application/json
{
"areaName":"盐源县",
"siteName":"政33务"
"areaName":"盐源县"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment