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
b0c52e3b
Commit
b0c52e3b
authored
Mar 03, 2020
by
阮思源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口优化
parent
dddc4adf
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
10 deletions
+100
-10
SelfPushBizImpl.java
...n/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
+38
-10
SelfPushItemDao.java
...c/main/java/com/pcloud/book/push/dao/SelfPushItemDao.java
+2
-0
SelfPushUserDao.java
...c/main/java/com/pcloud/book/push/dao/SelfPushUserDao.java
+3
-0
SelfPushItemDaoImpl.java
...va/com/pcloud/book/push/dao/impl/SelfPushItemDaoImpl.java
+7
-0
SelfPushUserDaoImpl.java
...va/com/pcloud/book/push/dao/impl/SelfPushUserDaoImpl.java
+10
-0
UserCountAndPushDTO.java
...in/java/com/pcloud/book/push/dto/UserCountAndPushDTO.java
+15
-0
SelfPushItemMapper.xml
...ook/src/main/resources/mapper/push/SelfPushItemMapper.xml
+10
-0
SelfPushUserMapper.xml
...ook/src/main/resources/mapper/push/SelfPushUserMapper.xml
+15
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
View file @
b0c52e3b
...
@@ -28,6 +28,7 @@ import com.pcloud.book.push.dao.SelfPushItemDao;
...
@@ -28,6 +28,7 @@ import com.pcloud.book.push.dao.SelfPushItemDao;
import
com.pcloud.book.push.dao.SelfPushUserDao
;
import
com.pcloud.book.push.dao.SelfPushUserDao
;
import
com.pcloud.book.push.dto.SelfPushAddParamDTO
;
import
com.pcloud.book.push.dto.SelfPushAddParamDTO
;
import
com.pcloud.book.push.dto.SelfPushRecordDTO
;
import
com.pcloud.book.push.dto.SelfPushRecordDTO
;
import
com.pcloud.book.push.dto.UserCountAndPushDTO
;
import
com.pcloud.book.push.entity.SelfPush
;
import
com.pcloud.book.push.entity.SelfPush
;
import
com.pcloud.book.push.entity.SelfPushItem
;
import
com.pcloud.book.push.entity.SelfPushItem
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.book.push.entity.SelfPushUser
;
...
@@ -530,11 +531,8 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -530,11 +531,8 @@ public class SelfPushBizImpl implements SelfPushBiz {
}
else
{
}
else
{
dto
.
setRealSendTime
(
DateUtils
.
formatDate
(
dto
.
getSendTime
(),
"yyyy-MM-dd HH:mm:ss"
));
dto
.
setRealSendTime
(
DateUtils
.
formatDate
(
dto
.
getSendTime
(),
"yyyy-MM-dd HH:mm:ss"
));
}
}
List
<
SelfPushItem
>
selfPushItemList
=
selfPushItemDao
.
getByPushId
(
dto
.
getPushId
());
this
.
fillItem
(
selfPushItemList
);
dto
.
setSelfPushItemList
(
selfPushItemList
);
}
}
fillPushItemsAndBookName
(
pageBeanNew
.
getRecordList
());
List
<
String
>
wxIds
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
!
StringUtil
.
isEmpty
(
s
.
getAltId
())).
map
(
SelfPushRecordDTO:
:
getAltId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
wxIds
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
!
StringUtil
.
isEmpty
(
s
.
getAltId
())).
map
(
SelfPushRecordDTO:
:
getAltId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
String
,
GroupUserDTO
>
robotMap
=
new
HashMap
<>();
Map
<
String
,
GroupUserDTO
>
robotMap
=
new
HashMap
<>();
Map
<
String
,
RobotClassifyDTO
>
robotClassifyDTOMap
=
new
HashMap
<>();
Map
<
String
,
RobotClassifyDTO
>
robotClassifyDTOMap
=
new
HashMap
<>();
...
@@ -555,8 +553,6 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -555,8 +553,6 @@ public class SelfPushBizImpl implements SelfPushBiz {
}
}
}
}
for
(
SelfPushRecordDTO
dto
:
pageBeanNew
.
getRecordList
())
{
for
(
SelfPushRecordDTO
dto
:
pageBeanNew
.
getRecordList
())
{
Integer
userCount
=
selfPushUserDao
.
getCountByPushId
(
dto
.
getPushId
());
dto
.
setUserCount
(
userCount
);
if
(!
MapUtils
.
isEmpty
(
robotMap
)
&&
!
StringUtil
.
isEmpty
(
dto
.
getAltId
())
&&
robotMap
.
containsKey
(
dto
.
getAltId
()))
{
if
(!
MapUtils
.
isEmpty
(
robotMap
)
&&
!
StringUtil
.
isEmpty
(
dto
.
getAltId
())
&&
robotMap
.
containsKey
(
dto
.
getAltId
()))
{
GroupUserDTO
userDTO
=
robotMap
.
get
(
dto
.
getAltId
());
GroupUserDTO
userDTO
=
robotMap
.
get
(
dto
.
getAltId
());
dto
.
setRobotName
(
userDTO
.
getNickName
());
dto
.
setRobotName
(
userDTO
.
getNickName
());
...
@@ -567,10 +563,6 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -567,10 +563,6 @@ public class SelfPushBizImpl implements SelfPushBiz {
dto
.
setClassifyName
(
null
!=
robotClassifyDTO
?
robotClassifyDTO
.
getClassifyName
():
null
);
dto
.
setClassifyName
(
null
!=
robotClassifyDTO
?
robotClassifyDTO
.
getClassifyName
():
null
);
dto
.
setUniqueNumber
(
null
!=
robotClassifyDTO
?
robotClassifyDTO
.
getUniqueNumber
():
null
);
dto
.
setUniqueNumber
(
null
!=
robotClassifyDTO
?
robotClassifyDTO
.
getUniqueNumber
():
null
);
}
}
if
(
null
!=
dto
.
getBookGroupId
()){
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getBookBaseInfoById
(
dto
.
getBookGroupId
());
dto
.
setBookName
(
bookGroupDTO
.
getBookName
());
}
if
(!
StringUtil
.
isEmpty
(
dto
.
getAltId
())){
//平台端登录账号
if
(!
StringUtil
.
isEmpty
(
dto
.
getAltId
())){
//平台端登录账号
if
(
dto
.
getCreateUser
()
==
0L
){
if
(
dto
.
getCreateUser
()
==
0L
){
dto
.
setUserName
(
"pcloud"
);
dto
.
setUserName
(
"pcloud"
);
...
@@ -583,6 +575,42 @@ public class SelfPushBizImpl implements SelfPushBiz {
...
@@ -583,6 +575,42 @@ public class SelfPushBizImpl implements SelfPushBiz {
return
pageBeanNew
;
return
pageBeanNew
;
}
}
private
void
fillPushItemsAndBookName
(
List
<
SelfPushRecordDTO
>
recordList
)
{
List
<
Long
>
pushIds
=
new
ArrayList
<>();
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
for
(
SelfPushRecordDTO
dto:
recordList
)
{
if
(
null
!=
dto
.
getBookGroupId
()&&!
bookGroupIds
.
contains
(
dto
.
getBookGroupId
())){
bookGroupIds
.
add
(
dto
.
getBookGroupId
());
}
if
(
null
!=
dto
.
getPushId
()&&!
pushIds
.
contains
(
dto
.
getPushId
())){
pushIds
.
add
(
dto
.
getPushId
());
}
}
Map
<
Long
,
List
<
SelfPushItem
>>
itemMap
=
new
HashMap
<>();
Map
<
Long
,
String
>
bookNameMap
=
new
HashMap
<>();
Map
<
Long
,
Integer
>
userCountMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
pushIds
)){
List
<
SelfPushItem
>
selfPushItemList
=
selfPushItemDao
.
getByPushIds
(
pushIds
);
this
.
fillItem
(
selfPushItemList
);
itemMap
=
selfPushItemList
.
stream
().
collect
(
Collectors
.
groupingBy
(
SelfPushItem:
:
getPushId
));
List
<
UserCountAndPushDTO
>
userCountList
=
selfPushUserDao
.
getCountByPushIds
(
pushIds
);
for
(
UserCountAndPushDTO
userCountAndPushDTO:
userCountList
){
userCountMap
.
put
(
userCountAndPushDTO
.
getPushId
(),
userCountAndPushDTO
.
getUserCount
());
}
}
if
(!
ListUtils
.
isEmpty
(
bookGroupIds
)){
List
<
BookGroupDTO
>
infos
=
bookGroupDao
.
getBookBaseInfoByIds
(
bookGroupIds
);
for
(
BookGroupDTO
bookGroupDTO:
infos
){
bookNameMap
.
put
(
bookGroupDTO
.
getId
(),
bookGroupDTO
.
getBookName
());
}
}
for
(
SelfPushRecordDTO
dto:
recordList
)
{
dto
.
setSelfPushItemList
(
itemMap
.
get
(
dto
.
getPushId
()));
dto
.
setBookName
(
bookNameMap
.
get
(
dto
.
getBookGroupId
()));
dto
.
setUserCount
(
userCountMap
.
get
(
dto
.
getPushId
()));
}
}
private
void
fillItem
(
List
<
SelfPushItem
>
list
)
{
private
void
fillItem
(
List
<
SelfPushItem
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
return
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/SelfPushItemDao.java
View file @
b0c52e3b
...
@@ -30,4 +30,6 @@ public interface SelfPushItemDao extends BaseDao<SelfPushItem>{
...
@@ -30,4 +30,6 @@ public interface SelfPushItemDao extends BaseDao<SelfPushItem>{
public
void
deleteByPushId
(
Long
pushId
);
public
void
deleteByPushId
(
Long
pushId
);
Integer
getStatusByPushId
(
Long
pushId
);
Integer
getStatusByPushId
(
Long
pushId
);
List
<
SelfPushItem
>
getByPushIds
(
List
<
Long
>
pushIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/SelfPushUserDao.java
View file @
b0c52e3b
package
com
.
pcloud
.
book
.
push
.
dao
;
package
com
.
pcloud
.
book
.
push
.
dao
;
import
com.pcloud.book.push.dto.UserCountAndPushDTO
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
...
@@ -28,4 +29,6 @@ public interface SelfPushUserDao extends BaseDao<SelfPushUser>{
...
@@ -28,4 +29,6 @@ public interface SelfPushUserDao extends BaseDao<SelfPushUser>{
List
<
String
>
getUserIdListByPushId
(
Long
pushId
);
List
<
String
>
getUserIdListByPushId
(
Long
pushId
);
public
void
deleteByPushId
(
Long
pushId
);
public
void
deleteByPushId
(
Long
pushId
);
List
<
UserCountAndPushDTO
>
getCountByPushIds
(
List
<
Long
>
pushIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/impl/SelfPushItemDaoImpl.java
View file @
b0c52e3b
...
@@ -43,4 +43,11 @@ public class SelfPushItemDaoImpl extends BaseDaoImpl<SelfPushItem> implements Se
...
@@ -43,4 +43,11 @@ public class SelfPushItemDaoImpl extends BaseDaoImpl<SelfPushItem> implements Se
map
.
put
(
"pushId"
,
pushId
);
map
.
put
(
"pushId"
,
pushId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getStatusByPushId"
),
map
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getStatusByPushId"
),
map
);
}
}
@Override
public
List
<
SelfPushItem
>
getByPushIds
(
List
<
Long
>
pushIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"pushIds"
,
pushIds
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByPushIds"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/impl/SelfPushUserDaoImpl.java
View file @
b0c52e3b
package
com
.
pcloud
.
book
.
push
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
push
.
dao
.
impl
;
import
com.pcloud.book.push.dao.SelfPushUserDao
;
import
com.pcloud.book.push.dao.SelfPushUserDao
;
import
com.pcloud.book.push.dto.UserCountAndPushDTO
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.book.push.entity.SelfPushUser
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @描述:
* @描述:
...
@@ -31,4 +34,11 @@ public class SelfPushUserDaoImpl extends BaseDaoImpl<SelfPushUser>implements Sel
...
@@ -31,4 +34,11 @@ public class SelfPushUserDaoImpl extends BaseDaoImpl<SelfPushUser>implements Sel
public
void
deleteByPushId
(
Long
pushId
)
{
public
void
deleteByPushId
(
Long
pushId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByPushId"
),
pushId
);
getSessionTemplate
().
delete
(
getStatement
(
"deleteByPushId"
),
pushId
);
}
}
@Override
public
List
<
UserCountAndPushDTO
>
getCountByPushIds
(
List
<
Long
>
pushIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"pushIds"
,
pushIds
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getCountByPushIds"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dto/UserCountAndPushDTO.java
0 → 100644
View file @
b0c52e3b
package
com
.
pcloud
.
book
.
push
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
UserCountAndPushDTO
{
@ApiModelProperty
(
"群发id"
)
private
Long
pushId
;
@ApiModelProperty
(
"数量"
)
private
Integer
userCount
;
}
pcloud-service-book/src/main/resources/mapper/push/SelfPushItemMapper.xml
View file @
b0c52e3b
...
@@ -175,4 +175,13 @@
...
@@ -175,4 +175,13 @@
group by push_id
group by push_id
</select>
</select>
<select
id=
"getByPushIds"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM self_push_item
WHERE push_id in
<foreach
collection=
"pushIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/push/SelfPushUserMapper.xml
View file @
b0c52e3b
...
@@ -72,4 +72,18 @@
...
@@ -72,4 +72,18 @@
WHERE push_id = #{pushId}
WHERE push_id = #{pushId}
</delete>
</delete>
<select
id=
"getCountByPushIds"
resultType=
"com.pcloud.book.push.dto.UserCountAndPushDTO"
parameterType=
"map"
>
SELECT
COUNT(1) userCount,
push_id pushId
FROM
self_push_user
WHERE
push_id in
<foreach
collection=
"pushIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
group by push_id
</select>
</mapper>
</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