记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
9571ee5c
Commit
9571ee5c
authored
Dec 15, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 领取 bindType3券
parent
823cdbfe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
8 deletions
+87
-8
ICandyCouponService.java
.../liquidnet/service/candy/service/ICandyCouponService.java
+2
-0
CandyCouponController.java
...idnet/service/candy/controller/CandyCouponController.java
+10
-0
CandyCouponServiceImpl.java
...et/service/candy/service/impl/CandyCouponServiceImpl.java
+45
-5
CouponBaseUtil.java
...java/com/liquidnet/service/candy/util/CouponBaseUtil.java
+27
-3
sqlmap.properties
...t-service-candy-impl/src/main/resources/sqlmap.properties
+3
-0
No files found.
liquidnet-bus-api/liquidnet-service-candy-api/src/main/java/com/liquidnet/service/candy/service/ICandyCouponService.java
View file @
9571ee5c
...
...
@@ -49,4 +49,6 @@ public interface ICandyCouponService {
ResponseDto
<
CandyCouponVo
>
receiveCouponDetails
(
String
ccode
);
ResponseDto
<
List
<
CandyCouponVo
>>
couponListById
(
String
uCouponIds
);
ResponseDto
<
Boolean
>
receiveBindType3
(
String
uCouponId
);
}
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/controller/CandyCouponController.java
View file @
9571ee5c
...
...
@@ -340,4 +340,14 @@ public class CandyCouponController {
// return ResponseDto.failure();
// }
}
//根据券id领取bindType3券
@PostMapping
(
"receive/bindType3"
)
@ApiOperation
(
"根据券id领取bindType3券"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"form"
,
dataType
=
"String"
,
name
=
"uCouponIds"
,
value
=
"券id(逗号隔开的字符串)"
,
required
=
true
),
})
public
ResponseDto
<
Boolean
>
receiveBindType3
(
@RequestParam
(
"uCouponIds"
)
@NotNull
@NotBlank
String
uCouponIds
)
{
return
candyCouponService
.
receiveBindType3
(
uCouponIds
);
}
}
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/service/impl/CandyCouponServiceImpl.java
View file @
9571ee5c
...
...
@@ -61,7 +61,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getBaseCouponUserVo
(
dtoItem
);
if
(
baseVo
==
null
)
{
if
(
baseVo
==
null
)
{
continue
;
}
if
(
type
==
1
)
{
...
...
@@ -73,7 +73,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
continue
;
}
}
if
(
baseVo
.
getBindType
().
equals
(
"3"
))
{
if
(
baseVo
.
getBindType
().
equals
(
"3"
))
{
}
if
(
dtoItem
.
getExclusive
().
equals
(
1
))
{
//会员券
...
...
@@ -127,7 +127,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
continue
;
}
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getBaseCouponUserVo
(
dtoItem
);
if
(
baseVo
==
null
)
{
if
(
baseVo
==
null
)
{
continue
;
}
if
(
dtoItem
.
getExclusive
().
equals
(
1
))
{
//会员券
...
...
@@ -316,7 +316,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
if
(
dto
==
null
)
{
return
null
;
//券不存在
}
return
CouponBaseUtil
.
getCouponState
(
LocalDateTime
.
now
(),
dto
.
getDuedAt
(),
dto
.
getBindAt
(),
dto
.
getState
(),
dto
.
getBindType
());
return
CouponBaseUtil
.
getCouponState
(
LocalDateTime
.
now
(),
dto
.
getDuedAt
(),
dto
.
getBindAt
(),
dto
.
getState
(),
dto
.
getBindType
());
}
@Override
...
...
@@ -547,7 +547,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
if
(
uCouponIdList
.
contains
(
dtoItem
.
getUcouponId
()))
{
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getBaseCouponUserVo
(
dtoItem
);
if
(
baseVo
==
null
)
{
if
(
baseVo
==
null
)
{
continue
;
}
vo
.
add
(
baseVo
);
...
...
@@ -557,4 +557,44 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
return
ResponseDto
.
success
(
vo
);
}
@Override
public
ResponseDto
<
Boolean
>
receiveBindType3
(
String
uCouponId
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
LocalDateTime
userCreateTime
;
LocalDateTime
now
=
LocalDateTime
.
now
();
String
mobile
=
(
String
)
CurrentUtil
.
getTokenClaims
().
get
(
CurrentUtil
.
TOKEN_MOBILE
);
try
{
userCreateTime
=
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
.
parse
(
CurrentUtil
.
getTokenClaims
().
get
(
CurrentUtil
.
TOKEN_UCREATED
).
toString
());
}
catch
(
Exception
e
)
{
userCreateTime
=
null
;
}
List
<
CandyUserCouponBasicDto
>
dtoList
=
redisDataUtils
.
getCouponByUid
(
uid
,
userCreateTime
);
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
if
(
uCouponId
.
equals
(
dtoItem
.
getUcouponId
()))
{
CandyCouponVo
baseVo
=
CouponBaseUtil
.
getBaseCouponUserVo
(
dtoItem
);
if
(
baseVo
==
null
)
{
return
ResponseDto
.
failure
();
}
else
if
(!
baseVo
.
getBindType
().
equals
(
3
))
{
return
ResponseDto
.
failure
(
"券类型错误"
);
}
else
if
(
baseVo
.
getBindType
().
equals
(
3
)
&&
baseVo
.
getBindType
()
==
null
)
{
return
ResponseDto
.
failure
(
"该券已领取"
);
}
else
{
LocalDateTime
dued_at
=
now
.
plusDays
(
dtoItem
.
getValidity
()).
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
);
dtoList
=
CouponBaseUtil
.
receiveBindType3Coupon
(
dtoList
,
uCouponId
,
now
,
dued_at
);
//REDIS
redisDataUtils
.
setCouponByUid
(
uid
,
dtoList
);
//MYSQL
queueUtils
.
sendMsgByRedis
(
MQConst
.
CandyQueue
.
COUPON_RECEIVE
.
getKey
(),
SqlMapping
.
get
(
"candy_coupon.get_bindType3"
,
now
,
dued_at
,
now
,
mobile
,
uCouponId
)
);
return
ResponseDto
.
success
();
}
}
}
return
ResponseDto
.
failure
();
}
}
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/java/com/liquidnet/service/candy/util/CouponBaseUtil.java
View file @
9571ee5c
...
...
@@ -56,9 +56,6 @@ public class CouponBaseUtil {
}
else
{
vo
.
setCouType
(
dtoItem
.
getCouType
());
}
if
(
dtoItem
.
getDuedAt
()
==
null
)
{
return
null
;
}
vo
.
setState
(
getCouponState
(
now
,
dtoItem
.
getDuedAt
(),
dtoItem
.
getBindAt
(),
dtoItem
.
getState
(),
dtoItem
.
getBindType
()));
vo
.
setUseRules
(
rulesVoList
);
return
vo
;
...
...
@@ -361,6 +358,33 @@ public class CouponBaseUtil {
return
dtoList
;
}
/**
* 使用券
*
* @param dtoList CouponBaseDtoList
* @param uCouponId 券唯一id
* @return List<CandyUserCouponBasicDto>
*/
public
static
List
<
CandyUserCouponBasicDto
>
receiveBindType3Coupon
(
List
<
CandyUserCouponBasicDto
>
dtoList
,
String
uCouponId
,
LocalDateTime
bindAt
,
LocalDateTime
dueAt
)
{
boolean
isHas
=
false
;
for
(
CandyUserCouponBasicDto
dtoItem
:
dtoList
)
{
if
(
dtoItem
.
getUcouponId
().
equals
(
uCouponId
))
{
if
(
dtoItem
.
getBindType
().
equals
(
3
))
{
dtoItem
.
setBindAt
(
bindAt
);
dtoItem
.
setDuedAt
(
dueAt
);
isHas
=
true
;
//券存在
}
else
{
return
null
;
//券不可用
}
break
;
}
}
if
(!
isHas
)
{
return
null
;
//券不存在
}
return
dtoList
;
}
/**
* 判断券是否在可兑换时间范围
*
...
...
liquidnet-bus-service/liquidnet-service-candy/liquidnet-service-candy-impl/src/main/resources/sqlmap.properties
View file @
9571ee5c
...
...
@@ -7,3 +7,6 @@ candy_coupon.back=UPDATE candy_user_coupon SET state = 1 WHERE uid = ? AND ucoup
# -- 领取券 --
candy_coupon.receive
=
INSERT INTO candy_user_coupon (ucoupon_id , uid , state , coupon_id , ccode , bind_at , created_at , dued_at) VALUE ( ? , ? , ? , ? , ? , ? , ? , ?)
candy_coupon_code.receive
=
UPDATE candy_coupon_code SET state=?,ucoupon_id=?,redeem_uid=?,redeem_mobile=?,redeem_at=?,updated_at=? WHERE coupon_id=? AND ccode=?
# BindType == 3 领取券 bind_at, dued_at
candy_coupon.get_bindType3
=
UPDATE candy_user_coupon set bind_at = ? , dued_at = ? , updated_at = ? , operator = ? where ucoupon_id = ?
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