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
41ee7950
Commit
41ee7950
authored
Jan 25, 2021
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [none] 首页奖券包
parent
a818edca
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
0 deletions
+53
-0
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+13
-0
GiftReceiveDao.java
...n/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
+3
-0
GiftReceiveDaoImpl.java
...m/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
+8
-0
GiftPackageDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
+5
-0
GiftReceiveDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/GiftReceiveDTO.java
+6
-0
GiftReceiveDao.xml
...k/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
+18
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
41ee7950
...
...
@@ -67,6 +67,8 @@ import java.util.Random;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollectionUtil
;
import
static
com
.
pcloud
.
book
.
util
.
common
.
ThreadPoolUtils
.
RMALL_SIGN_IN
;
@Component
(
"giftCouponPackageBiz"
)
...
...
@@ -679,11 +681,22 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
List
<
Long
>
packageIds
=
list
.
stream
().
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
receivedIds
=
ListUtils
.
isEmpty
(
packageIds
)
?
new
ArrayList
<>()
:
giftReceiveDao
.
getReceivedIds
(
packageIds
,
wechatUserId
);
List
<
GiftReceiveDTO
>
listReceived
=
giftReceiveDao
.
getReceivedCount
(
packageIds
,
wechatUserId
);
Map
<
Long
,
GiftReceiveDTO
>
receiveDTOMap
=
CollectionUtil
.
isEmpty
(
listReceived
)
?
new
HashMap
<>()
:
listReceived
.
stream
().
collect
(
Collectors
.
toMap
(
a
->
a
.
getGiftPackageId
(),
Function
.
identity
()));
for
(
GiftPackageDTO
giftPackageDTO
:
list
)
{
giftPackageDTO
.
setHasReceived
(
false
);
if
(!
ListUtils
.
isEmpty
(
receivedIds
)
&&
receivedIds
.
contains
(
giftPackageDTO
.
getId
())){
giftPackageDTO
.
setHasReceived
(
true
);
}
giftPackageDTO
.
setReceiveNum
(
0
);
giftPackageDTO
.
setFailureNum
(
0
);
if
(
CollectionUtil
.
isNotEmpty
(
receiveDTOMap
)
&&
receiveDTOMap
.
containsKey
(
giftPackageDTO
.
getId
())){
GiftReceiveDTO
giftReceiveDTO1
=
receiveDTOMap
.
get
(
giftPackageDTO
.
getId
());
if
(
null
!=
giftReceiveDTO1
){
giftPackageDTO
.
setReceiveNum
(
giftReceiveDTO1
.
getReceiveNum
());
giftPackageDTO
.
setFailureNum
(
giftReceiveDTO1
.
getFailureNum
());
}
}
giftPackageDTO
.
setDesc
(
StringUtils
.
isEmpty
(
giftPackageDTO
.
getResourceDesc
())
?
new
ArrayList
<>()
:
Arrays
.
stream
(
giftPackageDTO
.
getResourceDesc
().
split
(
","
)).
collect
(
Collectors
.
toList
()));
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
View file @
41ee7950
...
...
@@ -39,4 +39,6 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
Integer
getGiftAllReceiveCount
(
Long
wechatUserId
);
List
<
Long
>
getReceivedIds
(
List
<
Long
>
packageIds
,
Long
wechatUserId
);
List
<
GiftReceiveDTO
>
getReceivedCount
(
List
<
Long
>
packageIds
,
Long
wechatUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
View file @
41ee7950
...
...
@@ -83,4 +83,12 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
map
.
put
(
"giftPackageIds"
,
packageIds
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getReceivedIds"
),
map
);
}
@Override
public
List
<
GiftReceiveDTO
>
getReceivedCount
(
List
<
Long
>
packageIds
,
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"giftPackageIds"
,
packageIds
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getReceivedCount"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
View file @
41ee7950
...
...
@@ -62,6 +62,11 @@ public class GiftPackageDTO{
private
Integer
receiveNum
;
/**
* 失效/已使用总数
*/
private
Integer
failureNum
;
/**
* 未使用数量
*/
private
Integer
notUsedNum
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftReceiveDTO.java
View file @
41ee7950
...
...
@@ -24,5 +24,10 @@ public class GiftReceiveDTO {
*/
private
Long
receiveId
;
/**
* 失效/已使用总数
*/
private
Integer
failureNum
;
}
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
View file @
41ee7950
...
...
@@ -234,4 +234,21 @@
</foreach>
</select>
<select
id=
"getReceivedCount"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftReceiveDTO"
>
select
gift_package_id giftPackageId,
count(1) receiveNum,
sum(if((a.use_time is not null or now() > b.valid_date_end),1,0)) failureNum
from gift_receive a
LEFT JOIN gift_coupon_package b
on a.gift_package_id=b.id
where
a.wechat_user_id=#{wechatUserId}
and a.gift_package_id in
<foreach
collection=
"giftPackageIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
GROUP BY a.gift_package_id;
</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