Commit b5e8e1df authored by “yiyousong”'s avatar “yiyousong”
parents 8b1e0eb0 83cd7550
......@@ -406,6 +406,8 @@ CREATE TABLE mortals_sys_matter
`superviseShow` varchar(1024) COMMENT '监督投诉方式',
`sort` int(4) COMMENT '排序',
`source` tinyint(2) COMMENT '事项来源(0.政务网,1.自定义)',
`evaluationUrl` varchar(1024) COMMENT '评价地址',
`netApplyUrl` varchar(1024) COMMENT '申请地址',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
......
......@@ -9141,7 +9141,7 @@ data| object |数据对象
  appThemeName| String |应用主题名称
  type| Integer |类型(1.终端应用,2.移动端应用)
  downDevCount| Integer |下发设备次数
  shelves| Integer |是否上架(0.上架,1.下架)
  shelves| Integer |是否上架(1.上架,0.下架)
  filePath| String |文件相对路径地址
  distributeFilePath| String |文件部署路径地址
  version| String |当前版本
......@@ -9208,7 +9208,7 @@ data|object|数据对象
 appThemeName|String|应用主题名称
 type|Integer|类型(1.终端应用,2.移动端应用)
 downDevCount|Integer|下发设备次数
 shelves|Integer|是否上架(0.上架,1.下架)
 shelves|Integer|是否上架(1.上架,0.下架)
 filePath|String|文件相对路径地址
 distributeFilePath|String|文件部署路径地址
 version|String|当前版本
......
......@@ -2,6 +2,8 @@ package com.mortals.xhx.common.utils;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.DataUtil;
......@@ -65,10 +67,34 @@ public class MatterHtmlParseUtil {
}
String title = element.attr("title");
String href = element.firstElementChild().attr("href");
//element.child()
if (href.equalsIgnoreCase("javascript:void(0)")) {
continue;
}
buildMatter(matterEntityList, title, href);
//抓取申请与评价页面地址
Element nextElementSibling = element.nextElementSibling();
String evaluationUrl = "";
String netApplyUrl = "";
Elements elementsA = nextElementSibling.selectXpath("//a");
if (elementsA != null) {
for (Element tempElement : elementsA) {
if (tempElement.text().trim().equals("好差评")) {
String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
}
if (tempElement.text().trim().equals("申请")) {
String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 4) {
netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'");
}
}
}
}
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
}
elements = dom.selectXpath(matterListLiExp);
......@@ -79,7 +105,27 @@ public class MatterHtmlParseUtil {
}
String title = element.attr("title");
String href = element.attr("href");
buildMatter(matterEntityList, title, href);
//抓取申请与评价页面地址
String evaluationUrl = "";
String netApplyUrl = "";
Element nextElementSibling = element.nextElementSibling();
if (nextElementSibling != null) {
Elements elementsA = nextElementSibling.selectXpath("//a");
for (Element tempElement : elementsA) {
if ("好差评".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
}
if ("申请".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 4) {
netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'");
}
}
}
}
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
}
} catch (Exception e) {
......@@ -90,7 +136,7 @@ public class MatterHtmlParseUtil {
return Rest.ok(matterEntityList);
}
private static void buildMatter(List<MatterEntity> matterEntityList, String title, String href) {
private static void buildMatter(List<MatterEntity> matterEntityList, String title, String href, String evaluationUrl, String netApplyUrl) {
UrlBuilder builder = UrlBuilder.ofHttp(href, CharsetUtil.CHARSET_UTF_8);
String itemCode = builder.getQuery().get("itemCode").toString();
String taskType = builder.getQuery().get("taskType").toString();
......@@ -106,6 +152,8 @@ public class MatterHtmlParseUtil {
matterEntity.setAreaCode(areaCode);
matterEntity.setMatterName(title);
matterEntity.setUrl(href);
matterEntity.setEvaluationUrl(evaluationUrl);
matterEntity.setNetApplyUrl(evaluationUrl);
matterEntity.setSource(SourceEnum.政务网.getValue());
matterEntityList.add(matterEntity);
}
......
......@@ -8,7 +8,7 @@ import com.mortals.xhx.module.matter.model.MatterEntity;
* 基础事项查询对象
*
* @author zxfei
* @date 2022-11-23
* @date 2022-12-28
*/
public class MatterQuery extends MatterEntity {
/** 开始 序号,主键,自增长 */
......@@ -326,6 +326,12 @@ public class MatterQuery extends MatterEntity {
/** 结束 修改时间 */
private String updateTimeEnd;
/** 评价地址 */
private List<String> evaluationUrlList;
/** 申请地址 */
private List<String> netApplyUrlList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<MatterQuery> orConditionList;
......@@ -1949,6 +1955,36 @@ public class MatterQuery extends MatterEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 评价地址
* @return evaluationUrlList
*/
public List<String> getEvaluationUrlList(){
return this.evaluationUrlList;
}
/**
* 设置 评价地址
* @param evaluationUrlList
*/
public void setEvaluationUrlList(List<String> evaluationUrlList){
this.evaluationUrlList = evaluationUrlList;
}
/**
* 获取 申请地址
* @return netApplyUrlList
*/
public List<String> getNetApplyUrlList(){
return this.netApplyUrlList;
}
/**
* 设置 申请地址
* @param netApplyUrlList
*/
public void setNetApplyUrlList(List<String> netApplyUrlList){
this.netApplyUrlList = netApplyUrlList;
}
/**
* 设置 序号,主键,自增长
* @param id
......@@ -3548,6 +3584,44 @@ public class MatterQuery extends MatterEntity {
}
/**
* 设置 评价地址
* @param evaluationUrl
*/
public MatterQuery evaluationUrl(String evaluationUrl){
setEvaluationUrl(evaluationUrl);
return this;
}
/**
* 设置 评价地址
* @param evaluationUrlList
*/
public MatterQuery evaluationUrlList(List<String> evaluationUrlList){
this.evaluationUrlList = evaluationUrlList;
return this;
}
/**
* 设置 申请地址
* @param netApplyUrl
*/
public MatterQuery netApplyUrl(String netApplyUrl){
setNetApplyUrl(netApplyUrl);
return this;
}
/**
* 设置 申请地址
* @param netApplyUrlList
*/
public MatterQuery netApplyUrlList(List<String> netApplyUrlList){
this.netApplyUrlList = netApplyUrlList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
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