Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
e4ebf027
Commit
e4ebf027
authored
Aug 18, 2020
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faet:[none]listAppletNews
parent
f4b2cf30
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
67 deletions
+66
-67
AppletNewsBizImpl.java
...va/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
+38
-29
AppletNews.xml
...vice-book/src/main/resources/mapper/applet/AppletNews.xml
+26
-36
AppletNewsCategory.xml
...k/src/main/resources/mapper/applet/AppletNewsCategory.xml
+2
-2
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
View file @
e4ebf027
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
...
@@ -43,7 +43,6 @@ import com.pcloud.book.book.entity.BookLabel;
...
@@ -43,7 +43,6 @@ import com.pcloud.book.book.entity.BookLabel;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.es.entity.ESBookAndAdviser
;
import
com.pcloud.book.push.dao.PersonalAppletsDao
;
import
com.pcloud.book.push.dao.PersonalAppletsDao
;
import
com.pcloud.book.push.entity.PersonalApplets
;
import
com.pcloud.book.push.entity.PersonalApplets
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
...
@@ -52,10 +51,10 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -52,10 +51,10 @@ import com.pcloud.common.exceptions.BizException;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -64,7 +63,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -64,7 +63,6 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Iterator
;
...
@@ -73,6 +71,8 @@ import java.util.Map;
...
@@ -73,6 +71,8 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
/**
/**
* 小程序资讯
* 小程序资讯
*/
*/
...
@@ -289,8 +289,11 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -289,8 +289,11 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap
.
put
(
"showState"
,
showState
);
paramMap
.
put
(
"showState"
,
showState
);
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
paramMap
.
put
(
"newsClassifyId"
,
newsClassifyId
);
paramMap
.
put
(
"customTagId"
,
customTagId
);
paramMap
.
put
(
"customTagId"
,
customTagId
);
//是否有分类筛选
Boolean
classifySelect
=
false
;
//处理分类
//处理分类
if
(
null
!=
firstClassify
){
if
(
null
!=
firstClassify
){
classifySelect
=
true
;
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
classify
.
setFirstClassify
(
firstClassify
);
classify
.
setFirstClassify
(
firstClassify
);
classify
.
setSecondClassify
(
secondClassify
);
classify
.
setSecondClassify
(
secondClassify
);
...
@@ -304,17 +307,18 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -304,17 +307,18 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
else
{
}
else
{
paramMap
.
put
(
"gradeLabelId"
,
gradeLabelId
);
paramMap
.
put
(
"gradeLabelId"
,
gradeLabelId
);
paramMap
.
put
(
"subjectLabelId"
,
subjectLabelId
);
paramMap
.
put
(
"subjectLabelId"
,
subjectLabelId
);
if
(
null
!=
gradeLabelId
||
null
!=
subjectLabelId
)
{
classifySelect
=
true
;
}
}
}
paramMap
.
put
(
"classifySelect"
,
classifySelect
);
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
appletNewsDao
.
listPageNew
(
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listAppletNews"
,
"listAppletNewsCount"
);
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listAppletNews"
,
"listAppletNewsCount"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
}
fillLabel
(
pageBeanNew
.
getRecordList
());
setLabelContent
(
pageBeanNew
.
getRecordList
());
//填充咨询分类
//填充咨询分类
fillCategory
(
pageBeanNew
.
getRecordList
());
fillCategory
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
return
pageBeanNew
;
}
}
...
@@ -548,41 +552,46 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -548,41 +552,46 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
}
private
void
fillCategory
(
List
<
AppletNewsDTO
>
appletNewsDTOList
)
{
private
void
fillCategory
(
List
<
AppletNewsDTO
>
appletNewsDTOList
)
{
if
(
ListUtils
.
isEmpty
(
appletNewsDTOList
))
{
if
(
ListUtils
.
isEmpty
(
appletNewsDTOList
))
{
return
;
return
;
}
}
List
<
Long
>
classifyIds
=
new
ArrayList
<>();
for
(
AppletNewsDTO
newsDTO
:
appletNewsDTOList
)
{
for
(
AppletNewsDTO
newsDTO
:
appletNewsDTOList
)
{
Long
newsId
=
newsDTO
.
getId
();
Long
newsId
=
newsDTO
.
getId
();
List
<
AppletNewsCategoryDTO
>
newsCategoryDTOList
=
appletNewsCategoryDao
.
getByNewsId
(
newsId
);
List
<
AppletNewsCategoryDTO
>
newsCategoryDTOList
=
appletNewsCategoryDao
.
getByNewsId
(
newsId
);
if
(
ListUtils
.
isEmpty
(
newsCategoryDTOList
))
{
if
(
ListUtils
.
isEmpty
(
newsCategoryDTOList
))
{
continue
;
continue
;
}
}
for
(
AppletNewsCategoryDTO
appletNewsCategoryDTO
:
newsCategoryDTOList
)
{
List
<
Long
>
firstClassifyIds
=
newsCategoryDTOList
.
stream
().
map
(
AppletNewsCategoryDTO:
:
getFirstClassify
)
if
(
null
!=
appletNewsCategoryDTO
.
getFirstClassify
()
&&
!
classifyIds
.
contains
(
appletNewsCategoryDTO
.
getFirstClassify
()))
{
.
collect
(
classifyIds
.
add
(
appletNewsCategoryDTO
.
getFirstClassify
());
Collectors
.
toList
());
List
<
Long
>
secondClassifyIds
=
newsCategoryDTOList
.
stream
().
map
(
AppletNewsCategoryDTO:
:
getSecondClassify
)
.
collect
(
Collectors
.
toList
());
List
<
Long
>
classifyIds
=
firstClassifyIds
;
classifyIds
.
addAll
(
secondClassifyIds
);
classifyIds
.
removeAll
(
Collections
.
singleton
(
null
));
Map
<
Long
,
AssistTempletDTO
>
classifyMap
=
assistTempletConsr
.
mapByIds4Classify
(
classifyIds
);
for
(
AppletNewsCategoryDTO
categoryDTO
:
newsCategoryDTOList
)
{
AssistTempletDTO
templetDTO
=
classifyMap
.
get
(
categoryDTO
.
getFirstClassify
());
if
(
templetDTO
!=
null
)
{
categoryDTO
.
setFirstClassifyName
(
templetDTO
.
getTempletName
());
}
}
templetDTO
=
classifyMap
.
get
(
categoryDTO
.
getSecondClassify
());
if
(
null
!=
appletNewsCategoryDTO
.
getSecondClassify
()
&&
!
classifyIds
.
contains
(
appletNewsCategoryDTO
.
getSecondClassify
()))
{
if
(
templetDTO
!=
null
)
{
classifyIds
.
add
(
appletNewsCategoryDTO
.
getSecondClassify
());
categoryDTO
.
setSecondClassifyName
(
templetDTO
.
getTempletName
());
}
}
}
}
newsDTO
.
setCategoryList
(
newsCategoryDTOList
);
newsDTO
.
setCategoryList
(
newsCategoryDTOList
);
}
}
Map
<
Long
,
AssistTempletDTO
>
classifyMap
=
assistTempletConsr
.
mapByIds4Classify
(
classifyIds
);
if
(
MapUtils
.
isEmpty
(
classifyMap
))
{
return
;
}
for
(
AppletNewsDTO
newsDTO
:
appletNewsDTOList
)
{
if
(
ListUtils
.
isEmpty
(
newsDTO
.
getCategoryList
())){
continue
;
}
for
(
AppletNewsCategoryDTO
categoryDTO
:
newsDTO
.
getCategoryList
())
{
if
(
null
==
categoryDTO
){
continue
;
}
if
(
classifyMap
.
containsKey
(
categoryDTO
.
getFirstClassify
()))
{
categoryDTO
.
setFirstClassifyName
(
classifyMap
.
get
(
categoryDTO
.
getFirstClassify
()).
getTempletName
());
}
if
(
classifyMap
.
containsKey
(
categoryDTO
.
getSecondClassify
()))
{
categoryDTO
.
setSecondClassifyName
(
classifyMap
.
get
(
categoryDTO
.
getSecondClassify
()).
getTempletName
());
}
}
}
}
}
private
void
fillBusinessCard
(
AppletNewsDTO
appletNewsDTO
)
{
private
void
fillBusinessCard
(
AppletNewsDTO
appletNewsDTO
)
{
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletNews.xml
View file @
e4ebf027
...
@@ -159,10 +159,9 @@
...
@@ -159,10 +159,9 @@
<select
id=
"listAppletNewsCount"
parameterType=
"map"
resultType=
"integer"
>
<select
id=
"listAppletNewsCount"
parameterType=
"map"
resultType=
"integer"
>
SELECT count(DISTINCT n.id)
SELECT count(DISTINCT n.id)
FROM applet_news n
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
<if
test=
"classifySelect == 1"
>
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
LEFT JOIN applet_news_category category on n.id = category.applet_news_id
LEFT JOIN applet_news_category category on n.id = category.applet_news_id
</if>
WHERE 1=1
WHERE 1=1
<if
test=
"name != null"
>
<if
test=
"name != null"
>
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
...
@@ -173,6 +172,16 @@
...
@@ -173,6 +172,16 @@
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
AND n.show_state = #{showState}
AND n.show_state = #{showState}
</if>
</if>
<if
test=
"rightsClassifyId!=null"
>
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if
test=
"source != null"
>
AND n.source = #{source}
</if>
<if
test=
"customTagId != null"
>
AND n.custom_tag_id = #{customTagId}
</if>
<if
test=
"classifySelect == 1"
>
<if
test=
"firstClassify!=null"
>
<if
test=
"firstClassify!=null"
>
AND category.first_classify =#{firstClassify}
AND category.first_classify =#{firstClassify}
</if>
</if>
...
@@ -185,41 +194,19 @@
...
@@ -185,41 +194,19 @@
<if
test=
"subjectLabelId != null"
>
<if
test=
"subjectLabelId != null"
>
AND category.subject_label_id = #{subjectLabelId}
AND category.subject_label_id = #{subjectLabelId}
</if>
</if>
<if
test=
"rightsClassifyId!=null"
>
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if
test=
"source != null"
>
AND n.source = #{source}
</if>
<if
test=
"customTagId != null"
>
AND n.custom_tag_id = #{customTagId}
</if>
</if>
ORDER BY n.update_time DESC
</select>
</select>
<select
id=
"listAppletNews"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsDTO"
>
<select
id=
"listAppletNews"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsDTO"
>
SELECT
DISTINCT
SELECT
n.id,
n.id,
n.news_name newsName,
n.news_name newsName,
n.source,
n.source,
n.news_classify_id newsClassifyId,
n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId,
n.dep_label_id depLabelId,
n.pur_label_id purLabelId,
n.type,
n.digest,
n.pic1,
n.pic2,
n.pic3,
n.content,
n.show_state showState,
n.show_state showState,
c.news_classify newsClassify,
c.news_classify newsClassify,
n.create_time createTime,
n.create_time createTime,
n.update_time updateTime,
n.update_time updateTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId,
n.rights_classify_id rightsClassifyId,
d.classify rightsClassifyContent,
d.classify rightsClassifyContent,
n.jump_type jumpType,
n.jump_type jumpType,
...
@@ -227,14 +214,14 @@
...
@@ -227,14 +214,14 @@
n.url_number urlNumber,
n.url_number urlNumber,
n.custom_tag_id customTagId,
n.custom_tag_id customTagId,
t.custom_tag customTag,
t.custom_tag customTag,
n.show_source showSource,
n.show_link showLink,
IF(n.business_card_id is null,2,n.business_card_isOpen) businessCardIsOpen
IF(n.business_card_id is null,2,n.business_card_isOpen) businessCardIsOpen
FROM applet_news n
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
<if
test=
"classifySelect == 1"
>
LEFT JOIN applet_news_category category on n.id = category.applet_news_id
LEFT JOIN applet_news_category category on n.id = category.applet_news_id
</if>
WHERE 1=1
WHERE 1=1
<if
test=
"name != null"
>
<if
test=
"name != null"
>
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
...
@@ -245,6 +232,16 @@
...
@@ -245,6 +232,16 @@
<if
test=
"showState != null"
>
<if
test=
"showState != null"
>
AND n.show_state = #{showState}
AND n.show_state = #{showState}
</if>
</if>
<if
test=
"rightsClassifyId!=null"
>
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if
test=
"source != null"
>
AND n.source = #{source}
</if>
<if
test=
"customTagId != null"
>
AND n.custom_tag_id = #{customTagId}
</if>
<if
test=
"classifySelect == 1"
>
<if
test=
"firstClassify!=null"
>
<if
test=
"firstClassify!=null"
>
AND category.first_classify =#{firstClassify}
AND category.first_classify =#{firstClassify}
</if>
</if>
...
@@ -257,14 +254,7 @@
...
@@ -257,14 +254,7 @@
<if
test=
"subjectLabelId != null"
>
<if
test=
"subjectLabelId != null"
>
AND category.subject_label_id = #{subjectLabelId}
AND category.subject_label_id = #{subjectLabelId}
</if>
</if>
<if
test=
"rightsClassifyId!=null"
>
GROUP BY n.id
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if
test=
"source != null"
>
AND n.source = #{source}
</if>
<if
test=
"customTagId != null"
>
AND n.custom_tag_id = #{customTagId}
</if>
</if>
ORDER BY n.update_time DESC
ORDER BY n.update_time DESC
</select>
</select>
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletNewsCategory.xml
View file @
e4ebf027
...
@@ -66,8 +66,8 @@
...
@@ -66,8 +66,8 @@
label.name gradeLabelName,
label.name gradeLabelName,
label2.name subjectLabelName
label2.name subjectLabelName
from applet_news_category category
from applet_news_category category
LEFT JOIN book_label label ON category.grade_label_id = label.id
LEFT JOIN book_label label ON category.grade_label_id = label.id
AND label.type=1
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id
AND label2.type=2
where applet_news_id=#{appletNewId}
where applet_news_id=#{appletNewId}
</select>
</select>
...
...
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