Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fill-system
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
廖旭伟
fill-system
Commits
a2724d90
Commit
a2724d90
authored
Dec 08, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改热门词汇
parent
bc92650f
Pipeline
#2412
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
fill-manager/src/main/java/com/mortals/xhx/module/baseset/service/impl/BasesetServiceImpl.java
...s/xhx/module/baseset/service/impl/BasesetServiceImpl.java
+15
-7
fill-manager/src/main/java/com/mortals/xhx/module/baseset/web/BasesetController.java
...com/mortals/xhx/module/baseset/web/BasesetController.java
+16
-5
No files found.
fill-manager/src/main/java/com/mortals/xhx/module/baseset/service/impl/BasesetServiceImpl.java
View file @
a2724d90
...
@@ -45,13 +45,24 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base
...
@@ -45,13 +45,24 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base
@Override
@Override
protected
void
saveAfter
(
BasesetEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
BasesetEntity
entity
,
Context
context
)
throws
AppException
{
updateAndSaveHotWords
(
entity
,
context
);
super
.
saveAfter
(
entity
,
context
);
}
@Override
protected
void
updateAfter
(
BasesetEntity
entity
,
Context
context
)
throws
AppException
{
updateAndSaveHotWords
(
entity
,
context
);
super
.
updateAfter
(
entity
,
context
);
}
private
void
updateAndSaveHotWords
(
BasesetEntity
entity
,
Context
context
)
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getHotwordList
())){
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getHotwordList
())){
//更新新增热门词汇,差集删除不在列表中的
//更新新增热门词汇,差集删除不在列表中的
List
<
HotwordEntity
>
allHotWords
=
hotwordService
.
find
(
new
HotwordQuery
().
siteId
(
entity
.
getSiteId
()));
List
<
HotwordEntity
>
allHotWords
=
hotwordService
.
find
(
new
HotwordQuery
().
siteId
(
entity
.
getSiteId
()));
//求差集 删除
//求差集 删除
List
<
HotwordEntity
>
delList
=
this
.
subList
(
allHotWords
,
entity
.
getHotwordList
());
List
<
HotwordEntity
>
delList
=
this
.
subList
(
allHotWords
,
entity
.
getHotwordList
());
if
(!
ObjectUtils
.
isEmpty
(
delList
)){
if
(!
ObjectUtils
.
isEmpty
(
delList
)){
hotwordService
.
removeList
(
delList
,
context
);
hotwordService
.
removeList
(
delList
,
context
);
}
}
entity
.
getHotwordList
().
forEach
(
item
->
{
entity
.
getHotwordList
().
forEach
(
item
->
{
HotwordEntity
hotwordEntity
=
hotwordService
.
selectOne
(
new
HotwordQuery
().
siteId
(
item
.
getSiteId
()).
hotwords
(
item
.
getHotwords
()));
HotwordEntity
hotwordEntity
=
hotwordService
.
selectOne
(
new
HotwordQuery
().
siteId
(
item
.
getSiteId
()).
hotwords
(
item
.
getHotwords
()));
...
@@ -59,21 +70,18 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base
...
@@ -59,21 +70,18 @@ public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, Base
item
.
setId
(
hotwordEntity
.
getId
());
item
.
setId
(
hotwordEntity
.
getId
());
item
.
setSearchCount
(
hotwordEntity
.
getSearchCount
());
item
.
setSearchCount
(
hotwordEntity
.
getSearchCount
());
item
.
setUpdateTime
(
new
Date
());
item
.
setUpdateTime
(
new
Date
());
hotwordService
.
update
(
item
,
context
);
hotwordService
.
update
(
item
,
context
);
}
else
{
}
else
{
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
item
.
setCreateTime
(
new
Date
());
item
.
setCreateTime
(
new
Date
());
hotwordService
.
save
(
item
,
context
);
hotwordService
.
save
(
item
,
context
);
}
}
});
});
}
}
super
.
saveAfter
(
entity
,
context
);
}
}
public
List
<
HotwordEntity
>
subList
(
List
<
HotwordEntity
>
firstList
,
List
<
HotwordEntity
>
secondList
)
{
public
List
<
HotwordEntity
>
subList
(
List
<
HotwordEntity
>
firstList
,
List
<
HotwordEntity
>
secondList
)
{
Set
<
String
>
secondSet
=
secondList
.
parallelStream
().
map
(
e
->
e
.
getHotwords
()).
collect
(
Collectors
.
toSet
());
Set
<
String
>
secondSet
=
secondList
.
parallelStream
().
map
(
e
->
e
.
getHotwords
()).
collect
(
Collectors
.
toSet
());
return
firstList
.
parallelStream
().
filter
(
item
->
!
secondSet
.
contains
(
item
.
getHotwords
())).
collect
(
Collectors
.
toList
());
return
firstList
.
parallelStream
().
filter
(
item
->
!
secondSet
.
contains
(
item
.
getHotwords
())).
collect
(
Collectors
.
toList
());
...
...
fill-manager/src/main/java/com/mortals/xhx/module/baseset/web/BasesetController.java
View file @
a2724d90
package
com.mortals.xhx.module.baseset.web
;
package
com.mortals.xhx.module.baseset.web
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.code.NewsSourceEnum
;
import
com.mortals.xhx.common.code.NewsSourceEnum
;
import
com.mortals.xhx.module.baseset.model.BasesetQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -18,15 +21,11 @@ import com.mortals.xhx.module.baseset.service.BasesetService;
...
@@ -18,15 +21,11 @@ import com.mortals.xhx.module.baseset.service.BasesetService;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -53,4 +52,16 @@ public class BasesetController extends BaseCRUDJsonBodyMappingController<Baseset
...
@@ -53,4 +52,16 @@ public class BasesetController extends BaseCRUDJsonBodyMappingController<Baseset
}
}
@Override
protected
void
saveBefore
(
BasesetEntity
entity
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
BasesetEntity
basesetEntity
=
this
.
service
.
selectOne
(
new
BasesetQuery
().
siteId
(
entity
.
getSiteId
()));
if
(!
ObjectUtils
.
isEmpty
(
basesetEntity
)){
entity
.
setId
(
basesetEntity
.
getId
());
entity
.
setUpdateTime
(
new
Date
());
}
super
.
saveBefore
(
entity
,
model
,
context
);
}
}
}
\ 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