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
25a92094
Commit
25a92094
authored
Mar 06, 2024
by
“yiyousong”
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/smart_gov_platform
parents
5e59d933
0ee29257
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
531 additions
and
35 deletions
+531
-35
base-manager/src/main/java/com/mortals/xhx/busiz/web/DemoWebApiController.java
.../java/com/mortals/xhx/busiz/web/DemoWebApiController.java
+63
-8
base-manager/src/main/java/com/mortals/xhx/daemon/task/SyncMatterTaskImpl.java
.../java/com/mortals/xhx/daemon/task/SyncMatterTaskImpl.java
+20
-2
base-manager/src/main/java/com/mortals/xhx/module/matter/dao/MatterDao.java
...ain/java/com/mortals/xhx/module/matter/dao/MatterDao.java
+13
-0
base-manager/src/main/java/com/mortals/xhx/module/matter/dao/ibatis/MatterDaoImpl.java
...m/mortals/xhx/module/matter/dao/ibatis/MatterDaoImpl.java
+33
-0
base-manager/src/main/java/com/mortals/xhx/module/matter/service/MatterExtService.java
...m/mortals/xhx/module/matter/service/MatterExtService.java
+12
-1
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterExtServiceImpl.java
.../xhx/module/matter/service/impl/MatterExtServiceImpl.java
+259
-7
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
...als/xhx/module/matter/service/impl/MatterServiceImpl.java
+33
-13
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteMatterService.java
...om/mortals/xhx/module/site/service/SiteMatterService.java
+5
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteMatterServiceImpl.java
...s/xhx/module/site/service/impl/SiteMatterServiceImpl.java
+59
-3
base-manager/src/main/resources/sqlmap/module/matter/MatterMapperExt.xml
...c/main/resources/sqlmap/module/matter/MatterMapperExt.xml
+34
-1
No files found.
base-manager/src/main/java/com/mortals/xhx/busiz/web/DemoWebApiController.java
View file @
25a92094
...
...
@@ -7,9 +7,11 @@ import com.mortals.framework.annotation.UnAuth;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.web.BaseJsonBodyController
;
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.dept.model.DeptEntity
;
...
...
@@ -40,15 +42,13 @@ import org.apache.http.impl.client.HttpClientBuilder;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.
MESSAGE_INFO
;
...
...
@@ -205,13 +205,68 @@ public class DemoWebApiController {
return
Rest
.
ok
();
}
@PostMapping
(
value
=
"testAllMatter"
)
@UnAuth
public
Rest
<
String
>
testAllMatter
(
@RequestBody
SiteEntity
siteEntity
)
{
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch syncmatter"
);
log
.
info
(
"开始查询事项=="
);
stopWatch
.
start
(
"开始同步事项方法"
);
MatterQuery
matterQuery
=
new
MatterQuery
();
matterQuery
.
setAreaCode
(
siteEntity
.
getAreaCode
());
matterQuery
.
setSource
(
SourceEnum
.
政务网
.
getValue
());
List
<
MatterEntity
>
matterList
=
matterService
.
getDao
().
getMatterListByAreaCode
(
matterQuery
);
stopWatch
.
stop
();
log
.
info
(
"本地事项总数:{},{}s"
,
matterList
.
size
(),
stopWatch
.
getLastTaskTimeMillis
()
/
1000
);
return
Rest
.
ok
();
}
@PostMapping
(
value
=
"testAllMatterPage"
)
@UnAuth
public
Rest
<
String
>
testAllMatterPage
(
@RequestBody
SiteEntity
siteEntity
)
{
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch syncmatter"
);
log
.
info
(
"开始查询事项=="
);
stopWatch
.
start
(
"开始同步事项方法"
);
MatterQuery
matterQuery
=
new
MatterQuery
();
matterQuery
.
setAreaCode
(
siteEntity
.
getAreaCode
());
matterQuery
.
setSource
(
SourceEnum
.
政务网
.
getValue
());
ParamDto
param
=
new
ParamDto
();
param
.
getCondition
().
put
(
"areaCode"
,
matterQuery
.
getAreaCode
());
if
(!
ObjectUtils
.
isEmpty
(
matterQuery
.
getSource
()))
{
param
.
getCondition
().
put
(
"source"
,
matterQuery
.
getSource
());
}
int
count
=
matterService
.
getDao
().
getMatterListByAreaCodeCount
(
param
);
ArrayList
<
MatterEntity
>
allList
=
new
ArrayList
<>();
if
(
count
>
0
)
{
//分页获取
int
pages
=
count
/
500
+
1
;
for
(
int
i
=
1
;
i
<=
pages
;
i
++)
{
PageInfo
pageInfo
=
new
PageInfo
();
pageInfo
.
setCurrPage
(
i
);
pageInfo
.
setPrePageResult
(
500
);
Result
<
MatterEntity
>
rest
=
matterService
.
getDao
().
getMatterListByAreaCodePage
(
matterQuery
,
pageInfo
);
allList
.
addAll
(
rest
.
getList
());
}
stopWatch
.
stop
();
log
.
info
(
"本地事项总数:{},{}s"
,
allList
.
size
(),
stopWatch
.
getLastTaskTimeMillis
()
/
1000
);
}
return
Rest
.
ok
();
}
public
static
void
main
(
String
[]
args
)
{
HttpClient
http
=
null
;
System
.
out
.
println
(
1001
/
500
);
/* HttpClient http = null;
CookieStore httpCookieStore = new BasicCookieStore();
http = HttpClientBuilder.create().setDefaultCookieStore(httpCookieStore).build();
/* do stuff */
*//* do stuff *//*
HttpGet httpRequest = new HttpGet("http://zxbl.sczwfw.gov.cn/app/account/imageCode");
HttpResponse httpResponse = null;
try {
...
...
@@ -228,9 +283,9 @@ public class DemoWebApiController {
} catch (Exception e) {
log.error("异常", e);
}
/* check cookies */
*//* check cookies *//*
String cookieStr = Arrays.asList(httpCookieStore.getCookies()).stream().map(item -> JSON.toJSONString(item)).collect(Collectors.joining("|"));
// log.info("cookies:{}", cookieStr);
// log.info("cookies:{}", cookieStr);
*/
}
...
...
base-manager/src/main/java/com/mortals/xhx/daemon/task/SyncMatterTaskImpl.java
View file @
25a92094
...
...
@@ -17,6 +17,7 @@ import com.mortals.xhx.module.area.service.AreaService;
import
com.mortals.xhx.module.dept.service.DeptService
;
import
com.mortals.xhx.module.matter.model.MatterEntity
;
import
com.mortals.xhx.module.matter.model.MatterQuery
;
import
com.mortals.xhx.module.matter.service.MatterExtService
;
import
com.mortals.xhx.module.matter.service.MatterService
;
import
com.mortals.xhx.module.site.model.SiteEntity
;
import
com.mortals.xhx.module.site.model.SiteMatterEntity
;
...
...
@@ -30,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -64,13 +66,28 @@ public class SyncMatterTaskImpl implements ITaskExcuteService {
@Autowired
private
ICacheService
cacheService
;
@Autowired
private
MatterExtService
matterExtService
;
@Override
public
void
excuteTask
(
ITask
task
)
throws
AppException
{
log
.
info
(
"开始同步事项!"
);
List
<
SiteEntity
>
siteEntities
=
siteService
.
find
(
new
SiteEntity
());
for
(
SiteEntity
siteEntity
:
siteEntities
)
{
syncMatter
(
siteEntity
);
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch syncmatter"
);
log
.
info
(
"开始同步事项==》{}"
,
siteEntity
.
getSiteName
());
stopWatch
.
start
(
"开始同步事项方法"
);
matterExtService
.
doMatterBySiteId
(
siteEntity
,
null
);
stopWatch
.
stop
();
log
.
info
(
"同步事项完成,耗时:{}s"
,
stopWatch
.
getLastTaskTimeMillis
()/
1000
);
log
.
info
(
"开始添加站点事项==》{}"
,
siteEntity
.
getSiteName
());
stopWatch
.
start
(
"开始添加站点事项"
);
siteMatterService
.
doSyncSiteMatter
(
siteEntity
,
null
);
stopWatch
.
stop
();
log
.
info
(
"开始添加站点事项,耗时:{} s"
,
stopWatch
.
getLastTaskTimeMillis
()/
1000
);
// syncMatter(siteEntity);
}
// syncDevice();
log
.
info
(
"结束同步事项!"
);
...
...
@@ -82,8 +99,9 @@ public class SyncMatterTaskImpl implements ITaskExcuteService {
Rest
<
String
>
deptRest
=
deptService
.
syncDeptBySiteId
(
siteEntity
,
null
);
log
.
info
(
"同步站点部门结果:"
+
JSON
.
toJSONString
(
deptRest
));
Rest
<
String
>
rest
=
siteService
.
syncMatterBySiteId
(
siteEntity
,
null
);
log
.
info
(
"同步事项列表:"
+
JSON
.
toJSONString
(
rest
));
//
log.info("同步事项列表:" + JSON.toJSONString(rest));
if
(
rest
.
getCode
()
==
YesNoEnum
.
YES
.
getValue
())
{
List
<
MatterEntity
>
matterEntityList
=
matterService
.
find
(
new
MatterQuery
().
areaCode
(
siteEntity
.
getAreaCode
()).
source
(
SourceEnum
.
政务网
.
getValue
()));
log
.
info
(
"查询本地事项列表,size:{}"
,
matterEntityList
.
size
());
List
<
MatterEntity
>
unSyncDetailMatterList
=
matterEntityList
.
stream
()
...
...
base-manager/src/main/java/com/mortals/xhx/module/matter/dao/MatterDao.java
View file @
25a92094
...
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.module.matter.dao;
import
com.mortals.framework.dao.ICRUDDao
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.ParamDto
;
import
com.mortals.framework.model.Result
;
import
com.mortals.xhx.module.matter.model.MatterEntity
;
import
org.apache.poi.ss.formula.functions.T
;
...
...
@@ -21,7 +22,19 @@ public interface MatterDao extends ICRUDDao<MatterEntity, Long> {
String
SQLID_SUB_COUNT
=
"getSubListCount"
;
String
SQLID_MATTERLIST_AREACODE
=
"getMatterListByAreaCode"
;
String
SQLID_MATTERLIST_AREACODE_COUNT
=
"getMatterListByAreaCodeCount"
;
Result
<
MatterEntity
>
getSubList
(
MatterEntity
matterQuery
,
PageInfo
pageInfo
);
List
<
MatterEntity
>
getMatterListByAreaCode
(
MatterEntity
matterQuery
);
Result
<
MatterEntity
>
getMatterListByAreaCodePage
(
MatterEntity
matterQuery
,
PageInfo
pageInfo
);
int
getMatterListByAreaCodeCount
(
ParamDto
paramDto
);
}
base-manager/src/main/java/com/mortals/xhx/module/matter/dao/ibatis/MatterDaoImpl.java
View file @
25a92094
...
...
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
org.springframework.util.ObjectUtils
;
import
java.util.List
;
...
...
@@ -50,13 +51,45 @@ public class MatterDaoImpl extends BaseCRUDDaoMybatis<MatterEntity, Long> implem
public
int
getSubCount
(
ParamDto
paramDto
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getSqlId
(
SQLID_SUB_COUNT
),
this
.
cpyQueryParamDto
(
paramDto
));
}
@Override
public
int
getMatterListByAreaCodeCount
(
ParamDto
paramDto
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getSqlId
(
SQLID_MATTERLIST_AREACODE_COUNT
),
this
.
cpyQueryParamDto
(
paramDto
));
}
@Override
public
List
<
MatterEntity
>
getMatterListByAreaCode
(
MatterEntity
matterQuery
)
{
ParamDto
param
=
new
ParamDto
();
param
.
getCondition
().
put
(
"areaCode"
,
matterQuery
.
getAreaCode
());
if
(!
ObjectUtils
.
isEmpty
(
matterQuery
.
getSource
())){
param
.
getCondition
().
put
(
"source"
,
matterQuery
.
getSource
());
}
return
this
.
getSqlSession
().
selectList
(
this
.
getSqlId
(
"getMatterListByAreaCode"
),
param
);
}
/**
* @param matterQuery
* @param pageInfo
* @return
*/
@Override
public
Result
<
MatterEntity
>
getMatterListByAreaCodePage
(
MatterEntity
matterQuery
,
PageInfo
pageInfo
)
{
Result
<
MatterEntity
>
result
=
new
Result
();
ParamDto
paramDto
=
this
.
getQueryParam
(
matterQuery
);
int
count
=
this
.
getMatterListByAreaCodeCount
(
paramDto
);
List
list
=
null
;
if
(
count
==
0
)
{
list
=
new
ArrayList
();
}
else
if
(
pageInfo
.
getPrePageResult
()
==
-
1
)
{
list
=
this
.
getSqlSession
().
selectList
(
this
.
getSqlId
(
SQLID_MATTERLIST_AREACODE
),
paramDto
);
}
else
{
RowBounds
rowBounds
=
new
RowBounds
(
pageInfo
.
getBeginIndex
(),
pageInfo
.
getPrePageResult
());
list
=
this
.
getSqlSession
().
selectList
(
this
.
getSqlId
(
SQLID_MATTERLIST_AREACODE
),
this
.
cpyQueryParamDto
(
paramDto
),
rowBounds
);
}
pageInfo
.
setTotalResult
(
count
);
result
.
setPageInfo
(
pageInfo
);
result
.
setList
(
list
);
return
result
;
}
}
base-manager/src/main/java/com/mortals/xhx/module/matter/service/MatterExtService.java
View file @
25a92094
package
com.mortals.xhx.module.matter.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.matter.dao.MatterExtDao
;
import
com.mortals.xhx.module.matter.model.MatterExtEntity
;
import
com.mortals.xhx.module.site.model.SiteEntity
;
/**
* MatterExtService
*
...
...
@@ -12,5 +16,12 @@ import com.mortals.xhx.module.matter.model.MatterExtEntity;
*/
public
interface
MatterExtService
extends
ICRUDService
<
MatterExtEntity
,
Long
>{
MatterExtDao
getDao
();
Rest
<
String
>
doMatterBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
Rest
<
String
>
doMatterThemeBySiteId
(
SiteEntity
siteEntity
,
Context
context
);
void
deleteByMatterId
(
Long
matterId
,
Context
context
);
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterExtServiceImpl.java
View file @
25a92094
This diff is collapsed.
Click to expand it.
base-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterServiceImpl.java
View file @
25a92094
...
...
@@ -267,11 +267,11 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
siteMatterEntity
.
setMatterId
(
item
.
getId
());
siteMatterEntity
.
setMatterCode
(
item
.
getMatterNo
());
siteMatterEntity
.
setMatterName
(
item
.
getMatterName
());
siteMatterEntity
.
setDeptCode
(
item
.
getDeptCode
());
siteMatterEntity
.
setSource
(
item
.
getSource
());
siteMatterEntity
.
setEventTypeShow
(
item
.
getEventTypeShow
());
siteMatterEntity
.
setDeptName
(
deptEntity
==
null
?
""
:
deptEntity
.
getName
());
siteMatterEntity
.
setDeptId
(
deptEntity
==
null
?
-
1L
:
deptEntity
.
getId
());
siteMatterEntity
.
setDeptCode
(
deptEntity
==
null
?
""
:
deptEntity
.
getDeptNumber
());
siteMatterEntity
.
setCreateUserId
(
context
==
null
?
1L
:
context
.
getUser
()
==
null
?
1L
:
context
.
getUser
().
getId
());
siteMatterEntity
.
setCreateTime
(
new
Date
());
return
Rest
.
ok
(
siteMatterEntity
);
...
...
@@ -284,9 +284,10 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override
public
Result
<
MatterEntity
>
findSubList
(
MatterEntity
matterQuery
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
// SiteEntity siteCache = siteService.getCache(matterQuery.getSiteId().toString());
// SiteEntity siteCache = siteService.getCache(matterQuery.getSiteId().toString());
SiteEntity
siteCache
=
siteService
.
get
(
matterQuery
.
getSiteId
());
if
(
ObjectUtils
.
isEmpty
(
siteCache
))
throw
new
AppException
(
"查询站点id不能为空!siteId:"
+
matterQuery
.
getSiteId
());
if
(
ObjectUtils
.
isEmpty
(
siteCache
))
throw
new
AppException
(
"查询站点id不能为空!siteId:"
+
matterQuery
.
getSiteId
());
if
(
ObjectUtils
.
isEmpty
(
matterQuery
.
getAreaCode
()))
{
matterQuery
.
setAreaCode
(
siteCache
==
null
?
null
:
siteCache
.
getAreaCode
());
}
...
...
@@ -1021,7 +1022,11 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
//根据事项url 获取事项详细信息,构建相关详细信息
String
html
=
null
;
try
{
Document
dom
=
Jsoup
.
connect
(
matterEntity
.
getUrl
()).
timeout
(
30
*
1000
).
get
();
if
(
ObjectUtils
.
isEmpty
(
matterEntity
.
getUrl
()))
{
return
Rest
.
fail
(
"事项url不能为空!"
);
}
Document
dom
=
Jsoup
.
connect
(
matterEntity
.
getUrl
()).
timeout
(
60
*
1000
).
get
();
// html = Jsoup.connect(matterEntity.getUrl()).get().body().html();
// html = HttpUtil.get(matterEntity.getUrl());
//System.out.println(html);
...
...
@@ -1030,16 +1035,25 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
Setting
baseInfoSetting
=
interceptorConfig
.
getBaseInfoSetting
();
Setting
sqclInfoSetting
=
interceptorConfig
.
getSqclInfoSetting
();
//更新部门信息
DeptEntity
extCache
=
deptService
.
getExtCache
(
matterEntity
.
getDeptCode
());
matterEntity
.
setDeptName
(
extCache
==
null
?
""
:
extCache
.
getName
());
/* 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
);
Map
<
String
,
String
>
baseInfoMap
=
MatterDetailHtmlParseUtil
.
getbaseInfoMapByHtml
(
dom
);
Integer
matterEditionRemote
=
DataUtil
.
converStr2Int
(
baseInfoMap
.
getOrDefault
(
"事项版本"
,
"0"
),
0
);
if
(
matterEditionLocal
>=
matterEditionRemote
)
{
return
Rest
.
fail
(
"本地事项版本大于等于远端,不需要更新!"
);
}
//更新部门信息
DeptEntity
extCache
=
deptService
.
getExtCache
(
matterEntity
.
getDeptCode
());
matterEntity
.
setDeptName
(
extCache
==
null
?
""
:
extCache
.
getName
());
//构建基础信息参数
savebaseInfo
(
matterEntity
,
dom
,
baseInfoSetting
);
savebaseInfo
(
matterEntity
,
baseInfoMap
,
baseInfoSetting
);
//更新材料属性
saveDatumInfo
(
matterEntity
,
context
,
dom
,
sqclInfoSetting
);
...
...
@@ -1168,8 +1182,8 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
matterChargesService
.
save
(
matterChargesEntity
);
}
private
void
savebaseInfo
(
MatterEntity
matterEntity
,
Document
dom
,
Setting
baseInfoSetting
)
{
Map
<
String
,
String
>
baseInfoMap
=
MatterDetailHtmlParseUtil
.
getbaseInfoMapByHtml
(
dom
);
private
void
savebaseInfo
(
MatterEntity
matterEntity
,
Map
<
String
,
String
>
baseInfoMap
,
Setting
baseInfoSetting
)
{
//
Map<String, String> baseInfoMap = MatterDetailHtmlParseUtil.getbaseInfoMapByHtml(dom);
List
<
MatterExtEntity
>
matterExtEntities
=
new
ArrayList
<>();
long
sortN
=
1
;
for
(
Map
.
Entry
<
String
,
String
>
m
:
baseInfoMap
.
entrySet
())
{
...
...
@@ -1202,6 +1216,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
if
(!
ObjectUtils
.
isEmpty
(
matterExtEntities
))
{
//先删除后添加
matterExtService
.
deleteByMatterId
(
matterEntity
.
getId
(),
null
);
matterExtService
.
save
(
matterExtEntities
,
null
);
}
...
...
@@ -1209,7 +1224,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
private
void
saveBllcInfo
(
MatterEntity
matterEntity
,
Context
context
,
Document
dom
)
{
List
<
Map
<
String
,
Object
>>
bllcMapList
=
MatterDetailHtmlParseUtil
.
getbllcMapByHtml
(
dom
);
matterFlowlimitService
.
deleteByMatterId
(
matterEntity
.
getId
(),
context
);
List
<
MatterFlowlimitEntity
>
flowlimitEntityArrayList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
bllcMap
:
bllcMapList
)
{
MatterFlowlimitEntity
matterFlowlimitEntity
=
new
MatterFlowlimitEntity
();
...
...
@@ -1238,7 +1253,12 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
});
flowlimitEntityArrayList
.
add
(
matterFlowlimitEntity
);
}
matterFlowlimitService
.
save
(
flowlimitEntityArrayList
);
if
(!
ObjectUtils
.
isEmpty
(
flowlimitEntityArrayList
))
{
matterFlowlimitService
.
deleteByMatterId
(
matterEntity
.
getId
(),
context
);
matterFlowlimitService
.
save
(
flowlimitEntityArrayList
);
}
}
private
void
saveSltjInfo
(
MatterEntity
matterEntity
,
Context
context
,
Document
dom
)
{
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteMatterService.java
View file @
25a92094
package
com.mortals.xhx.module.site.service
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.site.dao.SiteMatterDao
;
import
com.mortals.xhx.module.site.model.SiteEntity
;
import
com.mortals.xhx.module.site.model.SiteMatterEntity
;
/**
...
...
@@ -17,5 +19,8 @@ public interface SiteMatterService extends ICRUDService<SiteMatterEntity, Long>
SiteMatterDao
getDao
();
Rest
<
String
>
doSyncSiteMatter
(
SiteEntity
siteEntity
,
Context
context
);
void
deleteBysiteIdAndSource
(
Long
siteId
,
Integer
source
,
Context
context
);
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteMatterServiceImpl.java
View file @
25a92094
package
com.mortals.xhx.module.site.service.impl
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.common.code.SourceEnum
;
import
com.mortals.xhx.module.matter.model.MatterEntity
;
import
com.mortals.xhx.module.matter.model.MatterQuery
;
import
com.mortals.xhx.module.matter.service.MatterService
;
import
com.mortals.xhx.module.site.model.
SiteThemeMatterEntity
;
import
com.mortals.xhx.module.site.
model.SiteThemeMatterQuery
;
import
com.mortals.xhx.module.site.model.
*
;
import
com.mortals.xhx.module.site.
service.SiteService
;
import
com.mortals.xhx.module.site.service.SiteThemeMatterService
;
import
com.mortals.xhx.module.site.service.SiteThemeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.module.site.dao.SiteMatterDao
;
import
com.mortals.xhx.module.site.model.SiteMatterEntity
;
import
com.mortals.xhx.module.site.service.SiteMatterService
;
import
org.springframework.util.ObjectUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -31,12 +34,15 @@ import java.util.stream.Collectors;
* @date 2022-01-12
*/
@Service
(
"siteMatterService"
)
@Slf4j
public
class
SiteMatterServiceImpl
extends
AbstractCRUDServiceImpl
<
SiteMatterDao
,
SiteMatterEntity
,
Long
>
implements
SiteMatterService
{
@Autowired
private
MatterService
matterService
;
@Autowired
private
SiteThemeMatterService
siteThemeMatterService
;
@Autowired
private
SiteService
siteService
;
@Override
protected
void
findAfter
(
SiteMatterEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
SiteMatterEntity
>
list
)
throws
AppException
{
...
...
@@ -109,4 +115,54 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
condition
.
put
(
"source"
,
source
);
this
.
dao
.
delete
(
condition
);
}
/**
* @param siteEntity
* @param context
* @return
*/
@Override
public
Rest
<
String
>
doSyncSiteMatter
(
SiteEntity
siteEntity
,
Context
context
)
{
List
<
MatterEntity
>
matterList
=
matterService
.
getDao
().
getMatterListByAreaCode
(
new
MatterQuery
().
areaCode
(
siteEntity
.
getAreaCode
()).
source
(
SourceEnum
.
政务网
.
getValue
()));
//查询站点事项相关
SiteEntity
site
=
siteService
.
selectOne
(
new
SiteQuery
().
areaCode
(
siteEntity
.
getAreaCode
()));
if
(!
ObjectUtils
.
isEmpty
(
site
))
{
log
.
info
(
"同步站点事项到站点....."
);
SiteMatterQuery
siteMatterQuery
=
new
SiteMatterQuery
();
siteMatterQuery
.
setSiteId
(
site
.
getId
());
siteMatterQuery
.
setSource
(
SourceEnum
.
政务网
.
getValue
());
List
<
SiteMatterEntity
>
localList
=
this
.
getDao
().
getList
(
siteMatterQuery
);
log
.
info
(
"本地站点事项数量.....{}"
,
localList
.
size
());
//找到差集 然后添加
Set
<
Long
>
existSiteMatterIdSet
=
localList
.
parallelStream
().
map
(
i
->
i
.
getMatterId
()).
collect
(
Collectors
.
toSet
());
List
<
MatterEntity
>
subList
=
matterList
.
parallelStream
().
filter
(
f
->
!
existSiteMatterIdSet
.
contains
(
f
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
subList
)){
//需要新增的站点事项
log
.
info
(
"需要新增的站点事项数量.....{}"
,
subList
.
size
());
List
<
SiteMatterEntity
>
siteMatterList
=
subList
.
parallelStream
()
.
map
(
item
->
matterService
.
switchMatterToSiteMatter
(
item
,
site
,
null
).
getData
())
.
filter
(
f
->
f
!=
null
)
.
collect
(
Collectors
.
toList
());
this
.
save
(
siteMatterList
);
}
/*
//判断是否已经有站点事项,如果有则不添加
Boolean bool = checkSiteMatter(site);
if (!bool) {
//添加站点事项 批量添加
List<SiteMatterEntity> siteMatterList = matterList.stream().map(item -> {
return matterService.switchMatterToSiteMatter(item, site, null).getData();
}).filter(f -> f != null).collect(Collectors.toList());
this.save(siteMatterList);
}
*/
log
.
info
(
"同步站点事项到站点完成....."
);
}
return
Rest
.
ok
();
}
}
\ No newline at end of file
base-manager/src/main/resources/sqlmap/module/matter/MatterMapperExt.xml
View file @
25a92094
...
...
@@ -65,9 +65,37 @@
</trim>
</select>
<select
id=
"getMatterListByAreaCodeCount"
parameterType=
"paramDto"
resultType=
"int"
>
select
count( 1 )
FROM
mortals_sys_matter AS a
where
<trim
prefixOverrides=
"and"
prefix=
""
>
<if
test=
"condition.areaCode!=null and condition.areaCode!=''"
>
and a.areaCode = #{condition.areaCode,jdbcType=VARCHAR}
</if>
</trim>
<if
test=
"condition.source!=null and condition.source!=''"
>
and a.source = #{condition.source,jdbcType=INTEGER}
</if>
</select>
<select
id=
"getMatterListByAreaCode"
parameterType=
"paramDto"
resultMap=
"MatterEntity-Map"
>
select
a.matterNo
a.id,
a.matterNo,
a.matterName,
a.deptCode,
a.source,
a.url,
a.matterEdition,
a.eventTypeShow
FROM
mortals_sys_matter AS a
where
...
...
@@ -76,6 +104,11 @@
and a.areaCode = #{condition.areaCode,jdbcType=VARCHAR}
</if>
</trim>
<if
test=
"condition.source!=null and condition.source!=''"
>
and a.source = #{condition.source,jdbcType=INTEGER}
</if>
</select>
</mapper>
\ No newline at end of file
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