Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
a1507fc5
...
a1507fc56ee5aa85848e03ceca241a6e2de62859
authored
2021-11-17 12:45:17 +0800
by
xianghan@topdraw.cn
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update
1 parent
f80260a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
56 deletions
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/CouponOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/RightsOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
member-service-impl/src/test/java/com/topdraw/test/business/process/rest/TaskOperationControllerTest.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/CouponOperationServiceImpl.java
View file @
a1507fc
...
...
@@ -51,8 +51,6 @@ public class CouponOperationServiceImpl implements CouponOperationService {
// 过期阀值(默认一个月)
private
static
final
Integer
EXPIRE_FACTOR_DAY
=
30
;
@Override
public
void
grantCouponThroughTempCoupon
(
List
<
TempCoupon
>
tempCouponList
)
{
// 优惠券领取、使用历史记录表
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/RightsOperationServiceImpl.java
View file @
a1507fc
package
com
.
topdraw
.
business
.
process
.
service
.
impl
;
import
com.topdraw.business.basicdata.coupon.service.CouponService
;
import
com.topdraw.business.basicdata.coupon.service.dto.CouponDTO
;
import
com.topdraw.business.basicdata.rights.history.domain.RightsHistory
;
import
com.topdraw.business.basicdata.rights.history.service.RightsHistoryService
;
import
com.topdraw.business.basicdata.rights.service.RightsService
;
...
...
@@ -19,8 +21,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.concurrent.*
;
...
...
@@ -46,6 +46,8 @@ public class RightsOperationServiceImpl implements RightsOperationService {
ExpOperationService
expOperationService
;
@Autowired
PointsOperationService
pointsOperationService
;
@Autowired
CouponService
couponService
;
// @Autowired
// ThreadPoolTaskExecutor threadPoolTaskExecutor;
...
...
@@ -107,7 +109,6 @@ public class RightsOperationServiceImpl implements RightsOperationService {
return
rightsHistoryList
;
}
/**
* 成长值发放,基于已获得的权益
* @param tempExpList 权益列表
...
...
@@ -117,7 +118,6 @@ public class RightsOperationServiceImpl implements RightsOperationService {
this
.
expOperationService
.
grantPointsThroughTempExp
(
tempExpList
);
}
/**
* 发放积分,基于已获得的权益
*
...
...
@@ -130,7 +130,6 @@ public class RightsOperationServiceImpl implements RightsOperationService {
this
.
pointsOperationService
.
grantPointsThroughTempRightsList
(
tempPointsList
);
}
/**
* 发放优惠券,基于已获得的权益
*
...
...
@@ -142,8 +141,6 @@ public class RightsOperationServiceImpl implements RightsOperationService {
this
.
couponOperationService
.
grantCouponThroughTempCoupon
(
tempCouponList
);
}
/**
* 权益发放
* @param tempRightsMap
...
...
@@ -229,8 +226,6 @@ public class RightsOperationServiceImpl implements RightsOperationService {
// 优惠券
List
<
TempCoupon
>
tempCouponList
=
new
ArrayList
<>();
List
<
TempExp
>
tempExpList
=
new
ArrayList
<>();
List
<
TempPoints
>
tempPointsList
=
new
ArrayList
<>();
for
(
RightsHistory
right
:
rightsList
)
{
Long
rightId
=
right
.
getRightsId
();
...
...
@@ -240,63 +235,55 @@ public class RightsOperationServiceImpl implements RightsOperationService {
RightsDTO
rightsDTO
=
this
.
getRights
(
rightId
);
// 权益的实体类型 1:积分;2成长值;3优惠券
String
type
=
rightsDTO
.
getEntityType
();
// String code = rightsDTO.getCode();
Long
expireTime
=
rightsDTO
.
getExpireTime
();
// Timestamp validTime = rightsDTO.getValidTime();
switch
(
type
)
{
// 优惠券
case
"3"
:
TempCoupon
tempCoupon
=
new
TempCoupon
();
tempCoupon
.
setId
(
rightId
);
tempCoupon
.
setMemberId
(
memberId
);
tempCoupon
.
setUserId
(
userId
);
tempCoupon
.
setRightsAmount
(
1
);
tempCoupon
.
setRightsSendStrategy
(
0
);
if
(
Objects
.
nonNull
(
expireTime
))
tempCoupon
.
setExpireTime
(
TimestampUtil
.
long2Timestamp
(
expireTime
));
tempCouponList
.
add
(
tempCoupon
);
case
"1"
:
Long
entityId
=
rightsDTO
.
getEntityId
();
CouponDTO
couponDTO
=
this
.
findCouponById
(
entityId
);
if
(
Objects
.
nonNull
(
couponDTO
))
{
TempCoupon
tempCoupon
=
new
TempCoupon
();
tempCoupon
.
setId
(
couponDTO
.
getId
());
tempCoupon
.
setMemberId
(
memberId
);
tempCoupon
.
setUserId
(
userId
);
tempCoupon
.
setRightsAmount
(
1
);
tempCoupon
.
setRightsSendStrategy
(
0
);
tempCoupon
.
setCode
(
couponDTO
.
getCode
());
if
(
Objects
.
nonNull
(
expireTime
))
tempCoupon
.
setExpireTime
(
TimestampUtil
.
long2Timestamp
(
expireTime
));
tempCouponList
.
add
(
tempCoupon
);
}
break
;
//
成长值
//
观影券
case
"2"
:
TempExp
tempExp
=
new
TempExp
();
tempExp
.
setId
(
rightId
);
tempExp
.
setMemberId
(
memberId
);
tempExp
.
setUserId
(
userId
);
tempExp
.
setRightsAmount
(
1
);
tempExp
.
setRightsSendStrategy
(
0
);
tempExpList
.
add
(
tempExp
);
break
;
// 积分
case
"1"
:
TempPoints
tempPoints
=
new
TempPoints
();
tempPoints
.
setId
(
rightId
);
tempPoints
.
setMemberId
(
memberId
);
tempPoints
.
setUserId
(
userId
);
tempPoints
.
setRightsAmount
(
1
);
tempPoints
.
setRightsSendStrategy
(
0
);
tempPointsList
.
add
(
tempPoints
);
// 活动参与机会
case
"3"
:
break
;
default
:
break
;
}
}
// TODO 其他
// 优惠券
if
(!
CollectionUtils
.
isEmpty
(
tempCouponList
))
map
.
put
(
RightType
.
COUPON
,
tempCouponList
);
// 成长值
/* if (!CollectionUtils.isEmpty(tempExpList))
map.put(RightType.EXP,tempExpList);*/
// 积分
/* if (!CollectionUtils.isEmpty(tempPointsList))
map.put(RightType.POINTS,tempPointsList);
*/
return
map
;
}
/**
* 获取优惠券信息
* @param id
* @return
*/
private
CouponDTO
findCouponById
(
Long
id
)
{
CouponDTO
couponDTO
=
this
.
couponService
.
findById
(
id
);
return
couponDTO
;
}
/**
* 权益详情
* @param rightsId
* @return
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
View file @
a1507fc
package
com
.
topdraw
.
business
.
process
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.topdraw.business.basicdata.coupon.service.CouponService
;
import
com.topdraw.business.basicdata.coupon.service.dto.CouponDTO
;
import
com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService
;
import
com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO
;
import
com.topdraw.business.basicdata.rights.service.RightsService
;
...
...
@@ -64,6 +66,8 @@ public class TaskOperationServiceImpl implements TaskOperationService {
TrTaskProgressService
trTaskProgressService
;
@Autowired
PermanentRightsService
permanentRightsService
;
@Autowired
CouponService
couponService
;
private
static
final
Integer
TASK_FINISH_STATUS
=
1
;
private
static
final
Integer
TASK_UNFINISH_STATUS
=
2
;
...
...
@@ -330,9 +334,10 @@ public class TaskOperationServiceImpl implements TaskOperationService {
* @param rightsSendStrategy
* @return
*/
private
TempCoupon
tempCouponBuild
(
Long
memberId
,
Integer
rightsAmount
,
Integer
rightsSendStrategy
,
TempRights
tempRights
,
String
nickname
){
private
TempCoupon
tempCouponBuild
(
Long
memberId
,
Integer
rightsAmount
,
Integer
rightsSendStrategy
,
CouponDTO
couponDTO
,
String
nickname
){
TempCoupon
tempCoupon
=
new
TempCoupon
();
BeanUtils
.
copyProperties
(
tempRights
,
tempCoupon
);
BeanUtils
.
copyProperties
(
couponDTO
,
tempCoupon
);
tempCoupon
.
setCode
(
couponDTO
.
getCode
());
tempCoupon
.
setMemberId
(
memberId
);
tempCoupon
.
setRightsAmount
(
rightsAmount
);
tempCoupon
.
setRightsSendStrategy
(
Objects
.
isNull
(
rightsSendStrategy
)
?
0
:
rightsSendStrategy
);
...
...
@@ -426,9 +431,15 @@ public class TaskOperationServiceImpl implements TaskOperationService {
String
type
=
rightsDTO
.
getEntityType
();
switch
(
type
)
{
case
"1"
:
// 优惠券
TempCoupon
tempCoupon
=
this
.
tempCouponBuild
(
memberId
,
rightsAmount
,
rightsSendStrategy
,
tempRights
,
nickname
);
tempCouponList
.
add
(
tempCoupon
);
Long
entityId
=
rightsDTO
.
getEntityId
();
if
(
Objects
.
nonNull
(
entityId
))
{
CouponDTO
couponDTO
=
this
.
findCouponById
(
entityId
);
if
(
Objects
.
nonNull
(
couponDTO
))
{
// 优惠券
TempCoupon
tempCoupon
=
this
.
tempCouponBuild
(
memberId
,
rightsAmount
,
rightsSendStrategy
,
couponDTO
,
nickname
);
tempCouponList
.
add
(
tempCoupon
);
}
}
break
;
default
:
break
;
...
...
@@ -437,6 +448,16 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
/**
* 获取优惠券信息
* @param id
* @return
*/
private
CouponDTO
findCouponById
(
Long
id
)
{
CouponDTO
couponDTO
=
this
.
couponService
.
findById
(
id
);
return
couponDTO
;
}
/**
*
* @param rightsId
* @return
...
...
member-service-impl/src/test/java/com/topdraw/test/business/process/rest/TaskOperationControllerTest.java
View file @
a1507fc
...
...
@@ -29,7 +29,7 @@ public class TaskOperationControllerTest extends BaseTest {
DataSyncMsg
dataSyncMsg
=
new
DataSyncMsg
();
dataSyncMsg
.
setEventType
(
EventType
.
VIEWING
.
name
());
DataSyncMsg
.
MsgData
msgData
=
new
DataSyncMsg
.
MsgData
();
msgData
.
setEvent
(
2
);
msgData
.
setEvent
(
6
);
msgData
.
setRemarks
(
"remark"
);
msgData
.
setMemberId
(
3L
);
msgData
.
setDeviceType
(
2
);
...
...
Please
register
or
sign in
to post a comment