Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
2469df54
Commit
2469df54
authored
Dec 05, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改应用编码校验
parent
e6d0761d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
232 additions
and
141 deletions
+232
-141
base-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
...er/src/main/java/com/mortals/xhx/common/key/Constant.java
+5
-0
base-manager/src/main/java/com/mortals/xhx/common/utils/MatterTypeHtmlParseUtil.java
...com/mortals/xhx/common/utils/MatterTypeHtmlParseUtil.java
+148
-131
base-manager/src/main/java/com/mortals/xhx/common/utils/SyncGovMatterDetailThread.java
...m/mortals/xhx/common/utils/SyncGovMatterDetailThread.java
+0
-3
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppServiceImpl.java
...m/mortals/xhx/module/app/service/impl/AppServiceImpl.java
+15
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteThemeService.java
...com/mortals/xhx/module/site/service/SiteThemeService.java
+8
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteThemeServiceImpl.java
...ls/xhx/module/site/service/impl/SiteThemeServiceImpl.java
+52
-3
base-manager/src/test/java/com/mortals/httpclient/app/AppController.http
...c/test/java/com/mortals/httpclient/app/AppController.http
+2
-2
base-manager/src/test/java/com/mortals/httpclient/app/AppVersionController.http
...java/com/mortals/httpclient/app/AppVersionController.http
+2
-2
No files found.
base-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
View file @
2469df54
...
@@ -89,6 +89,11 @@ public final class Constant {
...
@@ -89,6 +89,11 @@ public final class Constant {
*/
*/
public
static
final
String
GOV_FR_URL
=
"gov_fr_url"
;
public
static
final
String
GOV_FR_URL
=
"gov_fr_url"
;
/**
* 政务网乡镇主题服务地址
*/
public
static
final
String
GOV_TOWN_URL
=
"gov_town_url"
;
/**
/**
* 政务网公共服务地址
* 政务网公共服务地址
*/
*/
...
...
base-manager/src/main/java/com/mortals/xhx/common/utils/MatterTypeHtmlParseUtil.java
View file @
2469df54
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.common.utils;
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.common.utils;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.core.util.ReUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
...
@@ -61,6 +62,40 @@ public class MatterTypeHtmlParseUtil {
...
@@ -61,6 +62,40 @@ public class MatterTypeHtmlParseUtil {
return
Rest
.
ok
(
resultMap
);
return
Rest
.
ok
(
resultMap
);
}
}
/**
* 获取主题页码极总条数
*
* @param params
* @param url
* @return
*/
public
static
Rest
<
Map
<
String
,
Integer
>>
getTownThemeMatterPage
(
Map
<
String
,
String
>
params
,
String
url
)
{
String
matterTotalExp
=
"//input[@id=\"result_count\"]"
;
String
matterPageExp
=
"//input[@id=\"pageNum\"]"
;
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
);
}
/**
/**
* 获取主题列表
* 获取主题列表
*
*
...
@@ -101,7 +136,7 @@ public class MatterTypeHtmlParseUtil {
...
@@ -101,7 +136,7 @@ public class MatterTypeHtmlParseUtil {
* @return
* @return
*/
*/
public
static
Rest
<
Map
<
String
,
String
>>
getTownThemeList
(
Map
<
String
,
String
>
params
,
String
url
)
{
public
static
Rest
<
Map
<
String
,
String
>>
getTownThemeList
(
Map
<
String
,
String
>
params
,
String
url
)
{
String
ThemeListExp
=
"//
div[@class='mainLeft fl']//ul[@class=\"fwlx_list cf\"
]//li"
;
String
ThemeListExp
=
"//
ul[@class='fwlx_list cf'
]//li"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
try
{
try
{
Document
dom
=
Jsoup
.
connect
(
url
).
data
(
params
).
get
();
Document
dom
=
Jsoup
.
connect
(
url
).
data
(
params
).
get
();
...
@@ -116,9 +151,16 @@ public class MatterTypeHtmlParseUtil {
...
@@ -116,9 +151,16 @@ public class MatterTypeHtmlParseUtil {
String
title
=
element
.
attr
(
"title"
);
String
title
=
element
.
attr
(
"title"
);
//changeTheme('005', '1');
//changeTheme('005', '1');
String
onclick
=
element
.
attr
(
"onclick"
);
String
onclick
=
element
.
attr
(
"onclick"
);
List
<
String
>
list
=
ReUtil
.
findAllGroup0
(
"'(.*?)'"
,
onclick
);
if
(
list
.
size
()
>
1
)
{
String
themeCode
=
StrUtil
.
subBetween
(
list
.
get
(
0
),
"'"
,
"'"
);
//1 个人服务 2 法人服务
String
type
=
StrUtil
.
subBetween
(
list
.
get
(
1
),
"'"
,
"'"
);
if
(!
""
.
equals
(
themeCode
))
{
map
.
put
(
themeCode
+
"&"
+
type
,
title
);
}
}
String
themeCode
=
StrUtil
.
subBetween
(
onclick
,
"changeTheme('"
,
"',"
);
map
.
put
(
themeCode
,
title
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -154,7 +196,7 @@ public class MatterTypeHtmlParseUtil {
...
@@ -154,7 +196,7 @@ public class MatterTypeHtmlParseUtil {
continue
;
continue
;
}
}
String
onclick
=
element
.
firstElementChild
().
attr
(
"onclick"
);
String
onclick
=
element
.
firstElementChild
().
attr
(
"onclick"
);
href
=
StrUtil
.
subBetween
(
onclick
,
"ywblurl('"
,
"',"
);
href
=
StrUtil
.
subBetween
(
onclick
,
"ywblurl('"
,
"',"
);
if
(
ObjectUtils
.
isEmpty
(
href
))
{
if
(
ObjectUtils
.
isEmpty
(
href
))
{
continue
;
continue
;
}
}
...
@@ -232,6 +274,65 @@ public class MatterTypeHtmlParseUtil {
...
@@ -232,6 +274,65 @@ public class MatterTypeHtmlParseUtil {
return
Rest
.
ok
(
matterEntityList
);
return
Rest
.
ok
(
matterEntityList
);
}
}
/**
* 乡镇服务主题获取事项列表
*
* @param params
* @param url
* @return
*/
public
static
Rest
<
List
<
MatterEntity
>>
getTownThemeMatterList
(
Map
<
String
,
String
>
params
,
String
url
)
{
String
matterListExp
=
"//div[@class=\"sx_list\"]//span[1]"
;
String
matterListLiExp
=
"//div[@class=\"sx_list\"]//li/a[1]"
;
List
<
MatterEntity
>
matterEntityList
=
new
ArrayList
<>();
try
{
Document
dom
=
Jsoup
.
connect
(
url
).
data
(
params
).
get
();
Elements
elements
=
dom
.
selectXpath
(
matterListExp
);
for
(
int
i
=
0
;
i
<
elements
.
size
();
i
++)
{
Element
element
=
elements
.
get
(
i
);
if
(
element
==
null
)
{
continue
;
}
String
title
=
element
.
attr
(
"title"
);
String
href
=
element
.
firstElementChild
().
attr
(
"href"
);
if
(
href
.
equalsIgnoreCase
(
"javascript:void(0)"
))
{
continue
;
}
/* String onclick = element.firstElementChild().attr("onclick");
href = StrUtil.subBetween(onclick, "ywblurl('", "',");
if (ObjectUtils.isEmpty(href)) {
continue;
}*/
buildMatter
(
matterEntityList
,
title
,
href
);
}
elements
=
dom
.
selectXpath
(
matterListLiExp
);
for
(
int
i
=
0
;
i
<
elements
.
size
();
i
++)
{
Element
element
=
elements
.
get
(
i
);
if
(
element
==
null
)
{
continue
;
}
String
title
=
element
.
attr
(
"title"
);
String
href
=
element
.
attr
(
"href"
);
/* String onclick = element.attr("onclick");
String href = StrUtil.subBetween(onclick, "ywblurl('", "',");
if (ObjectUtils.isEmpty(href)) {
System.out.println("子项 href is empty!,dom:" + dom.html());
continue;
}*/
buildMatter
(
matterEntityList
,
title
,
href
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"获取列表异常!params:"
+
JSON
.
toJSONString
(
params
),
e
);
return
Rest
.
fail
(
e
.
getMessage
());
}
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
)
{
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
href
,
CharsetUtil
.
CHARSET_UTF_8
);
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
href
,
CharsetUtil
.
CHARSET_UTF_8
);
String
itemCode
=
builder
.
getQuery
().
get
(
"itemCode"
).
toString
();
String
itemCode
=
builder
.
getQuery
().
get
(
"itemCode"
).
toString
();
...
@@ -253,133 +354,9 @@ public class MatterTypeHtmlParseUtil {
...
@@ -253,133 +354,9 @@ public class MatterTypeHtmlParseUtil {
}
}
public
static
Rest
<
Map
<
String
,
String
>>
syncThemeBySiteId
(
Map
<
String
,
String
>
params
,
String
url
)
{
String
deptListExp
=
"//ul[@class='bm-list']//li"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
try
{
Document
dom
=
Jsoup
.
connect
(
url
).
data
(
params
).
get
();
Elements
elements
=
dom
.
selectXpath
(
deptListExp
);
for
(
int
i
=
0
;
i
<
elements
.
size
();
i
++)
{
Element
element
=
elements
.
get
(
i
);
if
(
element
==
null
)
{
continue
;
}
String
deptName
=
element
.
attr
(
"title"
);
String
href
=
element
.
firstElementChild
().
attr
(
"href"
);
UrlBuilder
builder
=
UrlBuilder
.
ofHttp
(
href
,
CharsetUtil
.
CHARSET_UTF_8
);
String
deptCode
=
builder
.
getQuery
().
get
(
"deptCode"
).
toString
();
map
.
put
(
deptCode
,
deptName
);
}
}
catch
(
Exception
e
)
{
return
Rest
.
fail
(
e
.
getMessage
());
}
return
Rest
.
ok
(
"当前站点同步添加部门成功!"
,
map
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
/* String url = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
HashMap<String, String> params = new HashMap<>();
params.put("dxType", "21");
params.put("areaCode", "510107000000");
params.put("deptCode", "");
params.put("searchtext", "");
params.put("pageno", "5");
params.put("taskType", "");
Rest<List<MatterEntity>> rest = MatterHtmlParseUtil.getMatterList(params, url);
System.out.println(rest.getData().size());*/
/* HashMap<String, String> params = new HashMap<>();
params.put("areaCode", "510116000000");
MatterHtmlParseUtil.syncDeptBySiteId(params);*/
// String url = "http://www.sczwfw.gov.cn/jiq/front/item/qlqd";
/* 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("deptCode", "");
params.put("searchtext", "");
params.put("taskType", "");
params.put("pageno", "1");
Rest<Map<String, Integer>> rest = MatterHtmlParseUtil.statSiteMatterCount(params, url);
System.out.println(JSON.toJSONString(rest));
List<MatterEntity> allList = new ArrayList<>();
String url1 = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
HashMap<String, String> params1 = new HashMap<>();
params1.put("dxType", "56");
params1.put("areaCode", "510110006007");
params1.put("deptCode", "");
params1.put("searchtext", "");
params1.put("taskType", "");
for (int i = 1; i <= rest.getData().get("pageNum"); i++) {
params1.put("pageno", String.valueOf(i));
//System.out.println("params:" + JSON.toJSONString(params1));
Rest<List<MatterEntity>> restList = MatterHtmlParseUtil.getMatterList(params1, url1);
if (restList.getCode() == YesNoEnum.YES.getValue() && !ObjectUtils.isEmpty(restList.getData())) {
// System.out.println("pageno:" + i + " res size:" + restList.getData().size());
allList.addAll(restList.getData());
}
}
// System.out.println("--------------------------------------------project size" + rest.getData().get("total") + "----------" + allList.size());
for (int i = 0; i < allList.size(); i++) {
System.out.println(i + " " + allList.get(i).getMatterName());
}*/
// System.out.println(JSON.toJSONString(allList));
/* 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("deptCode", "");
params.put("searchtext", "");
params.put("taskType", "");
params.put("pageno", "1");
Rest<Map<String, Integer>> rest = MatterTypeHtmlParseUtil.statSiteMatterCount(params, url);
System.out.println(JSON.toJSONString(rest));
List<MatterEntity> allList = new ArrayList<>();
String url1 = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
HashMap<String, String> params1 = new HashMap<>();
params1.put("dxType", "56");
params1.put("areaCode", "510110006007");
params1.put("deptCode", "");
params1.put("searchtext", "");
params1.put("taskType", "");
for (int i = 1; i <= rest.getData().get("pageNum"); i++) {
params1.put("pageno", String.valueOf(i));
Rest<List<MatterEntity>> restList = MatterTypeHtmlParseUtil.getMatterList(params1, url1);
if (restList.getCode() == YesNoEnum.YES.getValue() && !ObjectUtils.isEmpty(restList.getData())) {
allList.addAll(restList.getData());
}
}*/
// for (int i = 0; i < allList.size(); i++) {
// System.out.println(i + " " + allList.get(i).getMatterName());
// }
/* url = "http://www.sczwfw.gov.cn/jiq/front/channel/deptSwitch";
params = new HashMap<>();
params.put("areaCode", "510110006007");*/
//Rest<Map<String, String>> rest1 = MatterTypeHtmlParseUtil.syncDeptBySiteId(params, url);
//System.out.println(JSON.toJSONString(rest1));
//个人主题服务
//个人主题服务
String
url
=
"http://www.sczwfw.gov.cn/jiq/front/item/gr_index"
;
/*
String url = "http://www.sczwfw.gov.cn/jiq/front/item/gr_index";
HashMap<String, String> params = new HashMap<>();
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", "510107000000");
params.put("areaCode", "510107000000");
Rest<Map<String, String>> grThemeRest = MatterTypeHtmlParseUtil.getThemeList(params, url);
Rest<Map<String, String>> grThemeRest = MatterTypeHtmlParseUtil.getThemeList(params, url);
...
@@ -420,10 +397,10 @@ public class MatterTypeHtmlParseUtil {
...
@@ -420,10 +397,10 @@ public class MatterTypeHtmlParseUtil {
}
}
}
}
if (count != total) {
if (count != total) {
log
.
info
(
String
.
format
(
"获取数量异常,count:%s,total:%s,theme:%s"
,
count
,
total
,
item
.
getKey
()));
log.info(String.format("获取数量异常,count:%s,total:%s,theme:%s", count, total, item.getKey()));
}
}
}
}
});
});
*/
//System.out.println(JSON.toJSONString(allList));
//System.out.println(JSON.toJSONString(allList));
...
@@ -436,6 +413,46 @@ public class MatterTypeHtmlParseUtil {
...
@@ -436,6 +413,46 @@ public class MatterTypeHtmlParseUtil {
}
}
}*/
}*/
//http://www.sczwfw.gov.cn/jiq/front/item/town?areaCode=510105521000
//村镇主题服务
String
url3
=
"http://www.sczwfw.gov.cn/jiq/front/item/town"
;
Map
params3
=
new
HashMap
<>();
params3
.
put
(
"areaCode"
,
"510105521000"
);
Rest
<
Map
<
String
,
String
>>
townThemeRest
=
MatterTypeHtmlParseUtil
.
getTownThemeList
(
params3
,
url3
);
//System.out.println(JSON.toJSONString(townThemeRest));
HashMap
<
String
,
String
>
params1
=
new
HashMap
<>();
params1
.
put
(
"dxType"
,
"54"
);
params1
.
put
(
"areaCode"
,
"510105521000"
);
params1
.
put
(
"type"
,
"1"
);
List
<
MatterEntity
>
allList
=
new
ArrayList
<>();
townThemeRest
.
getData
().
entrySet
().
stream
().
forEach
(
item
->
{
String
[]
vals
=
item
.
getKey
().
split
(
"&"
);
params1
.
put
(
"theme"
,
vals
[
0
]);
params1
.
put
(
"userType"
,
vals
[
1
]);
//http://www.sczwfw.gov.cn/jiq/interface/item/tags?dxType=54&areaCode=510105521000&theme=085&userType=1&pageno=2
String
url1
=
"http://www.sczwfw.gov.cn/jiq/interface/item/tags"
;
Rest
<
Map
<
String
,
Integer
>>
themeMatterPageRest
=
MatterTypeHtmlParseUtil
.
getTownThemeMatterPage
(
params1
,
url1
);
//System.out.println("themePageRest:"+JSON.toJSONString(themeMatterPageRest));
Integer
pageNum
=
themeMatterPageRest
.
getData
().
get
(
"pageNum"
);
Integer
total
=
themeMatterPageRest
.
getData
().
get
(
"total"
);
if
(
pageNum
>
0
&&
total
>
0
)
{
int
count
=
0
;
for
(
int
i
=
1
;
i
<=
pageNum
;
i
++)
{
params1
.
put
(
"pageno"
,
String
.
valueOf
(
i
));
Rest
<
List
<
MatterEntity
>>
restList
=
MatterTypeHtmlParseUtil
.
getTownThemeMatterList
(
params1
,
url1
);
if
(
restList
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
allList
.
addAll
(
restList
.
getData
());
count
+=
restList
.
getData
().
size
();
}
}
if
(
count
!=
total
)
{
log
.
info
(
String
.
format
(
"获取数量异常,count:%s,total:%s,theme:%s"
,
count
,
total
,
item
.
getKey
()));
}
}
});
}
}
}
}
base-manager/src/main/java/com/mortals/xhx/common/utils/SyncGovMatterDetailThread.java
View file @
2469df54
...
@@ -70,9 +70,7 @@ public class SyncGovMatterDetailThread implements Runnable {
...
@@ -70,9 +70,7 @@ public class SyncGovMatterDetailThread implements Runnable {
Rest
<
String
>
deptRest
=
deptService
.
syncDeptBySiteId
(
siteEntity
,
context
);
Rest
<
String
>
deptRest
=
deptService
.
syncDeptBySiteId
(
siteEntity
,
context
);
log
.
info
(
"同步站点部门:"
+
JSON
.
toJSONString
(
deptRest
));
log
.
info
(
"同步站点部门:"
+
JSON
.
toJSONString
(
deptRest
));
Rest
<
String
>
rest
=
siteService
.
syncMatterBySiteId
(
siteEntity
,
context
);
Rest
<
String
>
rest
=
siteService
.
syncMatterBySiteId
(
siteEntity
,
context
);
AreaEntity
areaEntity
=
areaService
.
getCache
(
siteEntity
.
getAreaCode
());
AreaEntity
areaEntity
=
areaService
.
getCache
(
siteEntity
.
getAreaCode
());
log
.
info
(
"同步事项列表:"
+
JSON
.
toJSONString
(
rest
));
log
.
info
(
"同步事项列表:"
+
JSON
.
toJSONString
(
rest
));
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
List
<
MatterEntity
>
matterEntityList
=
matterService
.
find
(
new
MatterQuery
().
areaCode
(
siteEntity
.
getAreaCode
()).
source
(
SourceEnum
.
政务网
.
getValue
()));
List
<
MatterEntity
>
matterEntityList
=
matterService
.
find
(
new
MatterQuery
().
areaCode
(
siteEntity
.
getAreaCode
()).
source
(
SourceEnum
.
政务网
.
getValue
()));
...
@@ -110,7 +108,6 @@ public class SyncGovMatterDetailThread implements Runnable {
...
@@ -110,7 +108,6 @@ public class SyncGovMatterDetailThread implements Runnable {
//省,市,区
//省,市,区
Rest
<
String
>
themeRest
=
siteThemeService
.
syncThemeBySiteId
(
siteEntity
,
context
);
Rest
<
String
>
themeRest
=
siteThemeService
.
syncThemeBySiteId
(
siteEntity
,
context
);
log
.
info
(
"同步站点主题:"
+
JSON
.
toJSONString
(
themeRest
));
log
.
info
(
"同步站点主题:"
+
JSON
.
toJSONString
(
themeRest
));
log
.
info
(
"同步站点个人主题事项开始....."
);
log
.
info
(
"同步站点个人主题事项开始....."
);
siteThemeMatterService
.
deleteGovBySiteId
(
siteEntity
.
getId
(),
context
);
siteThemeMatterService
.
deleteGovBySiteId
(
siteEntity
.
getId
(),
context
);
Rest
<
String
>
grRest
=
siteThemeMatterService
.
syncThemeMatterBySiteId
(
siteEntity
.
getId
(),
"2"
,
context
);
Rest
<
String
>
grRest
=
siteThemeMatterService
.
syncThemeMatterBySiteId
(
siteEntity
.
getId
(),
"2"
,
context
);
...
...
base-manager/src/main/java/com/mortals/xhx/module/app/service/impl/AppServiceImpl.java
View file @
2469df54
...
@@ -204,8 +204,23 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
...
@@ -204,8 +204,23 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
}
}
@Override
protected
void
validData
(
AppEntity
entity
,
Context
context
)
throws
AppException
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getAppCode
())){
throw
new
AppException
(
"应用编码不能为空!"
);
}
super
.
validData
(
entity
,
context
);
}
@Override
@Override
protected
void
saveBefore
(
AppEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveBefore
(
AppEntity
entity
,
Context
context
)
throws
AppException
{
//校验appCode是否唯一
Long
siteId
=
entity
.
getSiteId
();
String
appCode
=
entity
.
getAppCode
();
int
count
=
this
.
count
(
new
AppQuery
().
siteId
(
siteId
).
appCode
(
appCode
),
context
);
if
(
count
>
0
){
throw
new
AppException
(
"当前站点已存在应用编码"
);
}
super
.
saveBefore
(
entity
,
context
);
super
.
saveBefore
(
entity
,
context
);
}
}
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteThemeService.java
View file @
2469df54
...
@@ -16,6 +16,14 @@ public interface SiteThemeService extends ICRUDService<SiteThemeEntity,Long>{
...
@@ -16,6 +16,14 @@ public interface SiteThemeService extends ICRUDService<SiteThemeEntity,Long>{
Rest
<
String
>
syncThemeBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
Rest
<
String
>
syncThemeBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
/**
* 乡镇主题同步
* @param siteEntity
* @param context
* @return
*/
Rest
<
String
>
syncTownThemeBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
void
deleteGovBySiteId
(
Long
siteId
,
Context
context
);
void
deleteGovBySiteId
(
Long
siteId
,
Context
context
);
}
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteThemeServiceImpl.java
View file @
2469df54
...
@@ -65,6 +65,23 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
...
@@ -65,6 +65,23 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
return
Rest
.
ok
(
"当前站点同步添加主题成功!"
);
return
Rest
.
ok
(
"当前站点同步添加主题成功!"
);
}
}
@Override
public
Rest
<
String
>
syncTownThemeBySiteId
(
SiteEntity
siteEntity
,
Context
context
)
{
String
url
=
GlobalSysInfo
.
getParamValue
(
Constant
.
GOV_TOWN_URL
,
"http://www.sczwfw.gov.cn/jiq/front/item/town"
);
Long
siteId
=
siteEntity
.
getId
();
this
.
deleteGovBySiteId
(
siteId
,
context
);
String
areaCode
=
siteEntity
.
getAreaCode
();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"areaCode"
,
areaCode
);
Rest
<
String
>
townRest
=
buildTheme
(
siteId
,
DxTypeEnum
.
个人服务
.
getValue
(),
url
,
params
,
context
);
if
(
townRest
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
()
)
{
log
.
info
(
"服务结果:"
+
JSON
.
toJSONString
(
townRest
));
return
Rest
.
fail
(
"同步主题失败!"
);
}
return
Rest
.
ok
(
"当前站点同步添加主题成功!"
);
}
private
Rest
<
String
>
buildTheme
(
Long
siteId
,
String
userType
,
String
url
,
Map
<
String
,
String
>
params
,
Context
context
)
{
private
Rest
<
String
>
buildTheme
(
Long
siteId
,
String
userType
,
String
url
,
Map
<
String
,
String
>
params
,
Context
context
)
{
Rest
<
Map
<
String
,
String
>>
rest
=
MatterTypeHtmlParseUtil
.
getThemeList
(
params
,
url
);
Rest
<
Map
<
String
,
String
>>
rest
=
MatterTypeHtmlParseUtil
.
getThemeList
(
params
,
url
);
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
rest
.
getData
().
keySet
().
size
()
>
0
)
{
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
rest
.
getData
().
keySet
().
size
()
>
0
)
{
...
@@ -96,6 +113,38 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
...
@@ -96,6 +113,38 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
return
Rest
.
ok
(
rest
.
getMsg
());
return
Rest
.
ok
(
rest
.
getMsg
());
}
}
private
Rest
<
String
>
buildTwonTheme
(
Long
siteId
,
String
url
,
Map
<
String
,
String
>
params
,
Context
context
)
{
Rest
<
Map
<
String
,
String
>>
rest
=
MatterTypeHtmlParseUtil
.
getTownThemeList
(
params
,
url
);
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
()
&&
rest
.
getData
().
keySet
().
size
()
>
0
)
{
//删除部门中属于政务部门的
// deptService.syncDeptBySiteId(siteId, context);
Map
<
String
,
String
>
data
=
rest
.
getData
();
for
(
Map
.
Entry
<
String
,
String
>
item
:
data
.
entrySet
())
{
String
[]
vals
=
item
.
getKey
().
split
(
"&"
);
String
themeCode
=
vals
[
0
];
String
userType
=
vals
[
1
];
String
themeName
=
item
.
getValue
();
int
count
=
this
.
count
(
new
SiteThemeQuery
().
siteId
(
siteId
).
userType
(
userType
).
themeCode
(
themeCode
),
context
);
if
(
count
==
0
)
{
SiteThemeEntity
siteThemeEntity
=
new
SiteThemeEntity
();
siteThemeEntity
.
initAttrValue
();
siteThemeEntity
.
setSiteId
(
siteId
);
siteThemeEntity
.
setUserType
(
userType
);
siteThemeEntity
.
setThemeCode
(
themeCode
);
siteThemeEntity
.
setThemeName
(
themeName
);
siteThemeEntity
.
setCreateTime
(
new
Date
());
siteThemeEntity
.
setCreateUserId
(
getContextUserId
(
context
));
this
.
save
(
siteThemeEntity
,
context
);
}
}
}
else
{
return
Rest
.
fail
(
rest
.
getMsg
());
}
return
Rest
.
ok
(
rest
.
getMsg
());
}
@Override
@Override
public
void
deleteGovBySiteId
(
Long
siteId
,
Context
context
)
{
public
void
deleteGovBySiteId
(
Long
siteId
,
Context
context
)
{
Map
<
String
,
Object
>
condition
=
new
HashMap
<>();
Map
<
String
,
Object
>
condition
=
new
HashMap
<>();
...
@@ -105,14 +154,14 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
...
@@ -105,14 +154,14 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
str
=
"changeTheme('005', '1')"
;
String
str
=
"changeTheme('005', '1')"
;
String
reg
=
"'.*?'"
;
String
reg
=
"'.*?'"
;
Pattern
compile
=
Pattern
.
compile
(
reg
);
Pattern
compile
=
Pattern
.
compile
(
reg
);
List
<
String
>
allGroups
=
ReUtil
.
findAllGroup0
(
compile
,
str
);
List
<
String
>
allGroups
=
ReUtil
.
findAllGroup0
(
compile
,
str
);
allGroups
.
forEach
(
item
->
{
allGroups
.
forEach
(
item
->
{
System
.
out
.
println
(
item
);
System
.
out
.
println
(
item
);
});
});
...
...
base-manager/src/test/java/com/mortals/httpclient/app/AppController.http
View file @
2469df54
...
@@ -41,7 +41,7 @@ Content-Type: application/json
...
@@ -41,7 +41,7 @@ Content-Type: application/json
"type":1,
"type":1,
"downDevCount":0,
"downDevCount":0,
"shelves":0,
"shelves":0,
"fileName":"窗口屏.zip",
"fileName":"窗口屏
3
.zip",
"filePath":"/file/uploadfile/1661928678354.zip",
"filePath":"/file/uploadfile/1661928678354.zip",
"summary":"vyk2sq"
"summary":"vyk2sq"
}
}
...
@@ -66,7 +66,7 @@ Content-Type: application/json
...
@@ -66,7 +66,7 @@ Content-Type: application/json
"type":1,
"type":1,
"downDevCount":0,
"downDevCount":0,
"shelves":0,
"shelves":0,
"fileName":"窗口屏
1
.zip",
"fileName":"窗口屏
2
.zip",
"filePath":"/file/uploadfile/1664180492089.zip",
"filePath":"/file/uploadfile/1664180492089.zip",
"summary":"vyk2sq"
"summary":"vyk2sq"
}
}
...
...
base-manager/src/test/java/com/mortals/httpclient/app/AppVersionController.http
View file @
2469df54
...
@@ -62,12 +62,12 @@ Accept: application/json
...
@@ -62,12 +62,12 @@ Accept: application/json
###自助终端应用版本使用
###自助终端应用版本使用
POST {{baseUrl}}/app/version/used?appVersionId=
4
POST {{baseUrl}}/app/version/used?appVersionId=
7
Authorization: {{authToken}}
Authorization: {{authToken}}
Accept: application/json
Accept: application/json
###自助终端应用版本预览
###自助终端应用版本预览
GET {{baseUrl}}/app/version/preview?appVersionId=
4
GET {{baseUrl}}/app/version/preview?appVersionId=
5
Authorization: {{authToken}}
Authorization: {{authToken}}
Accept: application/json
Accept: application/json
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment