Commit a7755e1c authored by 赵啸非's avatar 赵啸非

添加部门事项过滤

parent 4d07e3b6
......@@ -4938,6 +4938,7 @@ size|Integer|每页条数|否|-
name|String|部门名称|否|-
deptAbb|String|部门简称|否|-
deptNumber|String|部门编号|否|-
filter|Integer|是否过滤没有事项的部门(0.否,1.是)|否|-
**请求样例:**
......
......@@ -51,6 +51,33 @@ public class MatterHtmlParseUtil {
return Rest.ok(resultMap);
}
public static Rest<Map<String, Integer>> statSiteMatterDeptCount(Map<String, String> params, String url) {
String matterTotalExp = "//input[@id=\"result_countDept\"]";
String matterPageExp = "//input[@id=\"pageNumDept\"]";
Map<String, Integer> resultMap = new HashMap<>();
try {
Document dom = Jsoup.connect(url).data(params).get();
Elements elements = dom.selectXpath(matterTotalExp);
if (elements.size() > 0) {
Integer total = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("total", total);
}
elements = dom.selectXpath(matterPageExp);
if (elements.size() > 0) {
Integer pageNum = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("pageNum", pageNum);
}
} catch (Exception e) {
log.error("获取事项数量异常!params:" + JSON.toJSONString(params), e);
return Rest.fail(e.getMessage());
}
return Rest.ok(resultMap);
}
public static Rest<List<MatterEntity>> getMatterList(Map<String, String> params, String url) {
String matterListExp = "//div[@class=\"sx_list\"]//span[1]";
String matterListLiExp = "//div[@class=\"sx_list\"]//li/a[1]";
......@@ -245,15 +272,17 @@ public class MatterHtmlParseUtil {
String url = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", "510110006007");
params.put("dxType", "56");
params.put("areaCode", "511500000000");
params.put("dxType", "3");
params.put("deptCode", "");
params.put("searchtext", "");
params.put("type", "2");//类型 2.部门 1.主题 3.热度
params.put("taskType", "");
params.put("pageno", "1");
Rest<Map<String, Integer>> rest = MatterHtmlParseUtil.statSiteMatterCount(params, url);
// params.put("pageno", "1");
Rest<Map<String, Integer>> rest = MatterHtmlParseUtil.statSiteMatterDeptCount(params, url);
System.out.println(JSON.toJSONString(rest));
/*
List<MatterEntity> allList = new ArrayList<>();
String url1 = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
......@@ -282,6 +311,7 @@ public class MatterHtmlParseUtil {
Rest<Map<String, String>> rest1 = MatterHtmlParseUtil.syncDeptBySiteId(params, url);
System.out.println(JSON.toJSONString(rest1));
*/
}
......
......@@ -85,7 +85,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
@Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
......@@ -103,15 +102,15 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
//子节点已经全部选中,删除父节点
iterator.remove();
pageInfo.setTotalResult(pageInfo.getTotalResult() - 1);
} else {
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
}
}
buildChildBusiness(item);
}
} else {
list.stream().peek(item -> {
......@@ -187,10 +186,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
//删除
businessService.remove(mainIds,context);
}
}
......
......@@ -4,9 +4,7 @@ POST {{baseUrl}}/dept/list
Content-Type: application/json
{
"name":"qwudiq" ,
"deptAbb":"zudynx" ,
"deptNumber":"w2q60e" ,
"filter":1 ,
"page":1,
"size":10
}
......
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