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
6d6be053
Commit
6d6be053
authored
Mar 15, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改同步事项
parent
680464c1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
267 additions
and
175 deletions
+267
-175
base-manager/src/main/java/com/mortals/xhx/busiz/web/DemoWebApiController.java
.../java/com/mortals/xhx/busiz/web/DemoWebApiController.java
+45
-3
base-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
...er/src/main/java/com/mortals/xhx/common/key/Constant.java
+130
-126
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
...als/xhx/module/matter/service/impl/MatterServiceImpl.java
+84
-46
base-manager/src/test/java/com/mortals/httpclient/system/system.http
...r/src/test/java/com/mortals/httpclient/system/system.http
+8
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/busiz/web/DemoWebApiController.java
View file @
6d6be053
...
...
@@ -14,6 +14,9 @@ import com.mortals.xhx.common.code.DxTypeEnum;
import
com.mortals.xhx.common.code.SourceEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.keys.RedisCacheKeys
;
import
com.mortals.xhx.module.business.model.BusinessMatterEntity
;
import
com.mortals.xhx.module.business.model.BusinessMatterQuery
;
import
com.mortals.xhx.module.business.service.BusinessMatterService
;
import
com.mortals.xhx.module.dept.model.DeptEntity
;
import
com.mortals.xhx.module.dept.model.DeptQuery
;
import
com.mortals.xhx.module.dept.service.DeptService
;
...
...
@@ -79,6 +82,8 @@ public class DemoWebApiController {
private
SiteThemeService
siteThemeService
;
@Autowired
private
SiteThemeMatterService
siteThemeMatterService
;
@Autowired
private
BusinessMatterService
businessMatterService
;
@PostMapping
(
value
=
"testGov"
)
...
...
@@ -240,7 +245,7 @@ public class DemoWebApiController {
ArrayList
<
MatterEntity
>
allList
=
new
ArrayList
<>();
if
(
count
>
0
)
{
//分页获取
int
pages
=
count
/
500
+
1
;
int
pages
=
count
/
500
+
1
;
for
(
int
i
=
1
;
i
<=
pages
;
i
++)
{
stopWatch
.
start
(
"开始同步事项方法"
);
PageInfo
pageInfo
=
new
PageInfo
();
...
...
@@ -282,8 +287,45 @@ public class DemoWebApiController {
}
@PostMapping
(
value
=
"saveWinMatters"
)
@UnAuth
public
Rest
<
String
>
saveWinMatters
(
@RequestBody
WindowMatterQuery
windowMatterQuery
)
{
log
.
info
(
"保存窗口站点=="
);
BusinessMatterQuery
businessMatterQuery
=
new
BusinessMatterQuery
();
businessMatterQuery
.
setSiteBusinessId
(
17L
);
List
<
BusinessMatterEntity
>
businessMatterEntities
=
businessMatterService
.
find
(
businessMatterQuery
);
List
<
Long
>
windowIdList
=
windowMatterQuery
.
getWindowIdList
();
for
(
Long
windowId
:
windowIdList
)
{
List
<
WindowMatterEntity
>
windowMatterEntities
=
businessMatterEntities
.
stream
().
map
(
item
->
{
WindowMatterEntity
windowMatterEntity
=
new
WindowMatterEntity
();
WindowEntity
cache
=
windowService
.
getCache
(
windowId
.
toString
());
windowMatterEntity
.
setWindowId
(
cache
.
getId
());
windowMatterEntity
.
setWindowName
(
cache
.
getName
());
windowMatterEntity
.
setSiteMatterId
(
item
.
getMatterId
());
windowMatterEntity
.
setMatterName
(
item
.
getMatterName
());
windowMatterEntity
.
setDeptId
(
50L
);
windowMatterEntity
.
setDeptCode
(
"3890499118653034496"
);
windowMatterEntity
.
setDeptName
(
"县行政审批局"
);
windowMatterEntity
.
setCreateTime
(
new
Date
());
windowMatterEntity
.
setCreateUserId
(
1L
);
return
windowMatterEntity
;
}).
collect
(
Collectors
.
toList
());
windowMatterService
.
getDao
().
insertBatch
(
windowMatterEntities
);
}
return
Rest
.
ok
();
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
1001
/
500
);
System
.
out
.
println
(
1001
/
500
);
/* HttpClient http = null;
CookieStore httpCookieStore = new BasicCookieStore();
...
...
base-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
View file @
6d6be053
...
...
@@ -28,6 +28,10 @@ public final class Constant {
* 站点编号补零位数
*/
public
static
final
Integer
SITE_CODE_NUM
=
4
;
/**
* 最大重试次数
*/
public
static
final
Integer
MAX_RETRY_COUNT
=
5
;
/**
...
...
@@ -61,7 +65,9 @@ public final class Constant {
*/
public
static
final
String
DOMAIN
=
"domain"
;
/** 基础代码版本 Z-BASE.MANAGER-S1.0.0 */
/**
* 基础代码版本 Z-BASE.MANAGER-S1.0.0
*/
public
final
static
String
BASEMANAGER_VERSION
=
"Z-BASE.MANAGER-S1.0.0"
;
...
...
@@ -118,7 +124,6 @@ public final class Constant {
public
static
final
String
APP_BASE_DISTRIBUTE_PATH
=
"app_base_distribute_path"
;
/**
* 版本前缀
*/
...
...
@@ -137,7 +142,6 @@ public final class Constant {
public
final
static
String
CUSTAPP_ROOT_PATH
=
"app"
;
public
final
static
String
USER_SITE_TREE
=
"user:site:tree"
;
...
...
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
View file @
6d6be053
...
...
@@ -39,6 +39,7 @@ import com.mortals.xhx.module.site.service.SiteThemeMatterService;
import
com.mortals.xhx.module.site.service.SiteThemeService
;
import
com.mortals.xhx.module.window.model.WindowMatterQuery
;
import
com.mortals.xhx.module.window.service.WindowMatterService
;
import
io.netty.handler.timeout.ReadTimeoutException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -49,9 +50,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.net.ConnectException
;
import
java.net.SocketTimeoutException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.
MAX_RETRY_COUNT
;
/**
* MatterService
* 基础事项 service实现
...
...
@@ -1020,10 +1025,17 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override
public
Rest
<
String
>
buildMatterDetail
(
MatterEntity
matterEntity
,
Context
context
)
{
//根据事项url 获取事项详细信息,构建相关详细信息
String
html
=
null
;
// String html = null;
Boolean
bool
=
false
;
String
msg
=
""
;
int
reCount
=
0
;
while
(
reCount
<
MAX_RETRY_COUNT
)
{
try
{
if
(
ObjectUtils
.
isEmpty
(
matterEntity
.
getUrl
()))
{
return
Rest
.
fail
(
"事项url不能为空!"
);
bool
=
true
;
msg
=
"事项url不能为空!"
;
break
;
//return Rest.fail("事项url不能为空!");
}
Document
dom
=
Jsoup
.
connect
(
matterEntity
.
getUrl
()).
timeout
(
60
*
1000
).
get
();
// html = Jsoup.connect(matterEntity.getUrl()).get().body().html();
...
...
@@ -1045,10 +1057,13 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
Integer
matterEditionRemote
=
DataUtil
.
converStr2Int
(
baseInfoMap
.
getOrDefault
(
"事项版本"
,
"0"
),
0
);
if
(
matterEditionLocal
>=
matterEditionRemote
)
{
return
Rest
.
fail
(
"本地事项版本大于等于远端,不需要更新!"
);
bool
=
true
;
msg
=
"本地事项版本大于等于远端,不需要更新!!"
;
break
;
// return Rest.fail("本地事项版本大于等于远端,不需要更新!");
}
log
.
info
(
"更新详细事项==>{},version==>{}"
,
matterEntity
.
getMatterName
(),
matterEditionRemote
);
log
.
info
(
"更新详细事项==>{},version==>{}"
,
matterEntity
.
getMatterName
(),
matterEditionRemote
);
//更新部门信息
DeptEntity
extCache
=
deptService
.
getExtCache
(
matterEntity
.
getDeptCode
());
matterEntity
.
setDeptName
(
extCache
==
null
?
""
:
extCache
.
getName
());
...
...
@@ -1080,13 +1095,36 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
//更新事项更新标志
matterEntity
.
setHaveGetMatterInfo
(
"true"
);
}
catch
(
SocketTimeoutException
readTimeoutException
)
{
log
.
info
(
"请求超时,休眠后重试"
);
reCount
++;
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
}
}
catch
(
ConnectException
connectException
)
{
log
.
info
(
"链接拒绝,休眠后重试"
);
reCount
++;
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
}
}
catch
(
Exception
e
)
{
log
.
error
(
String
.
format
(
"获取详细异常! id:%s,matterCode:%s,url:%s"
,
matterEntity
.
getId
(),
matterEntity
.
getMatterNo
(),
matterEntity
.
getUrl
()),
e
);
return
Rest
.
fail
(
"更新事项失败!"
+
e
.
getMessage
());
bool
=
true
;
msg
=
e
.
getMessage
();
break
;
// return Rest.fail("更新事项失败!" + e.getMessage());
}
}
if
(
bool
)
{
return
Rest
.
fail
(
msg
);
}
else
{
return
Rest
.
ok
(
"更新详细成功!"
);
}
}
private
void
saveCjwtInfo
(
MatterEntity
matterEntity
,
Context
context
,
Document
dom
)
{
matterQuestionService
.
deleteByMatterId
(
matterEntity
.
getId
(),
context
);
...
...
base-manager/src/test/java/com/mortals/httpclient/system/system.http
View file @
6d6be053
...
...
@@ -130,6 +130,14 @@ Content-Type: application/json
"areaCode":"511500000000"
}
###test saveWinMatters
POST {{baseUrl}}/test/saveWinMatters
Content-Type: application/json
{
"windowIdList":[11,12,13,14,15,16]
}
###testre
...
...
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