Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
f3b1eb4a
Commit
f3b1eb4a
authored
Dec 09, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/luck_draw_feature' into luck_draw_feature
parents
3b5b9249
294be177
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
87 deletions
+88
-87
ActivityPopularizeBiz.java
...com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
+88
-87
No files found.
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
View file @
f3b1eb4a
...
@@ -67,102 +67,103 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
...
@@ -67,102 +67,103 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
public
void
handleRegister
(
RegisterQueueDTO
registerQueueDTO
)
{
public
void
handleRegister
(
RegisterQueueDTO
registerQueueDTO
)
{
String
activityCode
=
registerQueueDTO
.
getInParamDTO
().
getActivityCode
().
replace
(
PREFIX
,
""
);
if
(
StringUtils
.
isNotBlank
(
registerQueueDTO
.
getInParamDTO
().
getActivityCode
()))
{
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
registerQueueDTO
.
getAppUserId
()).
getData
(
);
String
activityCode
=
registerQueueDTO
.
getInParamDTO
().
getActivityCode
().
replace
(
PREFIX
,
""
);
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
registerQueueDTO
.
getAppUserId
()).
getData
();
//获取活动code,并且注册来源是app 并且 非普通登录
//获取活动code,并且注册来源是app 并且 非普通登录
if
(!
RegisterQueueDTO
.
SIGN_LOGIN
.
equals
(
registerQueueDTO
.
getSign
()
))
{
if
(!
RegisterQueueDTO
.
SIGN_LOGIN
.
equals
(
registerQueueDTO
.
getSign
())
&&
StringUtils
.
isNotBlank
(
activityCode
))
{
//查询出活动
//查询出活动
ActivityPopularize
activityPopularize
=
popularizeBiz
.
selectOne
(
new
ActivityPopularize
(){{
ActivityPopularize
activityPopularize
=
popularizeBiz
.
selectOne
(
new
ActivityPopularize
(){{
setCode
(
activityCode
);
setCode
(
activityCode
);
}});
}});
if
(
activityPopularize
!=
null
)
{
if
(
activityPopularize
!=
null
)
{
List
<
ActivityPopularizeItem
>
activityPopularizeItems
=
activityPopularizeItemBiz
.
selectByPopularizeId
(
activityPopularize
.
getId
());
List
<
ActivityPopularizeItem
>
activityPopularizeItems
=
activityPopularizeItemBiz
.
selectByPopularizeId
(
activityPopularize
.
getId
());
ActivityPopularizeItem
activityPopularizeItem
=
activityPopularizeItems
.
get
(
activityPopularizeItems
.
size
()
-
1
);
ActivityPopularizeItem
activityPopularizeItem
=
activityPopularizeItems
.
get
(
activityPopularizeItems
.
size
()
-
1
);
Date
now
=
DateUtil
.
date
();
Date
now
=
DateUtil
.
date
();
Date
start
=
DateUtil
.
date
(
activityPopularize
.
getStartTime
());
Date
start
=
DateUtil
.
date
(
activityPopularize
.
getStartTime
());
Date
end
=
DateUtil
.
date
(
activityPopularize
.
getEndTime
());
Date
end
=
DateUtil
.
date
(
activityPopularize
.
getEndTime
());
//判断是否活动超时
//判断是否活动超时
if
(
now
.
before
(
start
)
||
now
.
after
(
end
))
{
if
(
now
.
before
(
start
)
||
now
.
after
(
end
))
{
log
.
error
(
"不在活动范围内 入参Json:"
+
JSONUtil
.
toJsonStr
(
registerQueueDTO
));
log
.
error
(
"不在活动范围内 入参Json:"
+
JSONUtil
.
toJsonStr
(
registerQueueDTO
));
return
;
return
;
}
}
Integer
majorUserId
=
Integer
.
valueOf
(
appUserDTO
.
getInviterAccount
());
Integer
majorUserId
=
Integer
.
valueOf
(
appUserDTO
.
getInviterAccount
());
ActivityPopularizeRelation
activityPopularizeRelation
=
new
ActivityPopularizeRelation
(){{
ActivityPopularizeRelation
activityPopularizeRelation
=
new
ActivityPopularizeRelation
(){{
setMajorUserId
(
majorUserId
);
setMajorUserId
(
majorUserId
);
setPopularizeId
(
activityPopularize
.
getId
());
setPopularizeId
(
activityPopularize
.
getId
());
}};
}};
//新增第几个邀请人和邀请金额字段
//新增第几个邀请人和邀请金额字段
Integer
num
=
relationBiz
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
Integer
num
=
relationBiz
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
BigDecimal
amount
=
new
BigDecimal
(
0
);
BigDecimal
amount
=
new
BigDecimal
(
0
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
activityPopularizeItem
.
getDetail
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
activityPopularizeItem
.
getDetail
());
if
(
jsonObject
!=
null
&&
StringUtils
.
isNotBlank
(
jsonObject
.
getString
(
"detail"
)))
{
if
(
jsonObject
!=
null
&&
StringUtils
.
isNotBlank
(
jsonObject
.
getString
(
"detail"
)))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
jsonObject
.
getString
(
"detail"
));
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
jsonObject
.
getString
(
"detail"
));
if
(
jsonArray
!=
null
)
{
if
(
jsonArray
!=
null
)
{
JSONObject
jsonObject1
=
jsonArray
.
getJSONObject
(
num
-
1
);
JSONObject
jsonObject1
=
jsonArray
.
getJSONObject
(
num
-
1
);
if
(
jsonObject1
!=
null
)
{
if
(
jsonObject1
!=
null
)
{
String
amountString
=
jsonObject1
.
getString
(
"amount"
);
String
amountString
=
jsonObject1
.
getString
(
"amount"
);
amount
.
add
(
new
BigDecimal
(
amountString
));
amount
.
add
(
new
BigDecimal
(
amountString
));
}
}
}
}
}
}
//添加活动关系
//添加活动关系
relationBiz
.
insertSelective
(
new
ActivityPopularizeRelation
(){{
relationBiz
.
insertSelective
(
new
ActivityPopularizeRelation
(){{
setPopularizeId
(
activityPopularize
.
getId
());
setPopularizeId
(
activityPopularize
.
getId
());
setMajorUserId
(
majorUserId
);
setMajorUserId
(
majorUserId
);
setMinorUserId
(
appUserDTO
.
getUserid
());
setMinorUserId
(
appUserDTO
.
getUserid
());
setNum
(
num
);
setNum
(
num
);
setAmount
(
amount
);
setAmount
(
amount
);
}});
}});
ApLogDTO
apLogDTO
=
popularizeLogBiz
.
selectOneApLogDTO
(
new
ActivityPopularizeLog
(){{
setUserId
(
majorUserId
);
setItemId
(
activityPopularizeItem
.
getId
());
}});
//生成任务项
ApLogDTO
apLogDTO
=
popularizeLogBiz
.
selectOneApLogDTO
(
new
ActivityPopularizeLog
(){{
if
(
null
==
apLogDTO
){
setUserId
(
majorUserId
);
popularizeLogBiz
.
insertSelectiveRe
(
new
ActivityPopularizeLog
(){{
setItemId
(
activityPopularizeItem
.
getId
());
setItemId
(
activityPopularizeItem
.
getId
());
}});
//生成任务项
if
(
null
==
apLogDTO
){
popularizeLogBiz
.
insertSelectiveRe
(
new
ActivityPopularizeLog
(){{
setItemId
(
activityPopularizeItem
.
getId
());
setUserId
(
majorUserId
);
setStatus
(
SYS_FALSE
);
setPopularizeId
(
activityPopularize
.
getId
());
}});
}
//查出majorUser参与活动信息
ActivityPopularizeUser
activityPopularizeUser
=
popularizeUserBiz
.
selectOne
(
new
ActivityPopularizeUser
(){{
setUserId
(
majorUserId
);
setUserId
(
majorUserId
);
setStatus
(
SYS_FALSE
);
setPopularizeId
(
activityPopularize
.
getId
());
setPopularizeId
(
activityPopularize
.
getId
());
}});
}});
}
//修改当前进度
activityPopularizeUser
.
setCurrentProgress
(
activityPopularizeUser
.
getCurrentProgress
().
add
(
amount
));
//查出majorUser参与活动信息
//任务没有完成
ActivityPopularizeUser
activityPopularizeUser
=
popularizeUserBiz
.
selectOne
(
new
ActivityPopularizeUser
(){{
if
(!
SYS_TRUE
.
equals
(
activityPopularizeUser
.
getStatus
()))
{
setUserId
(
majorUserId
);
setPopularizeId
(
activityPopularize
.
getId
());
}});
//修改当前进度
activityPopularizeUser
.
setCurrentProgress
(
activityPopularizeUser
.
getCurrentProgress
().
add
(
amount
));
//任务没有完成
if
(!
SYS_TRUE
.
equals
(
activityPopularizeUser
.
getStatus
()))
{
// AwardDTO awardDTO = JSONUtil.toBean(activityPopularize.getValue(), AwardDTO.class);
// AwardDTO awardDTO = JSONUtil.toBean(activityPopularize.getValue(), AwardDTO.class);
//检查是否满足奖励
//检查是否满足奖励
if
(
relationBiz
.
selectList
(
new
ActivityPopularizeRelation
(){{
if
(
relationBiz
.
selectList
(
new
ActivityPopularizeRelation
(){{
setMajorUserId
(
majorUserId
);
setMajorUserId
(
majorUserId
);
setPopularizeId
(
activityPopularize
.
getId
());
setPopularizeId
(
activityPopularize
.
getId
());
}}).
size
()
>=
2
)
{
}}).
size
()
>=
2
)
{
apLogDTO
.
setStatus
(
SYS_TRUE
);
apLogDTO
.
setStatus
(
SYS_TRUE
);
popularizeLogBiz
.
updateSelectiveById
(
BeanUtil
.
toBean
(
apLogDTO
,
ActivityPopularizeLog
.
class
));
popularizeLogBiz
.
updateSelectiveById
(
BeanUtil
.
toBean
(
apLogDTO
,
ActivityPopularizeLog
.
class
));
activityPopularizeUser
.
setStatus
(
SYS_TRUE
);
activityPopularizeUser
.
setStatus
(
SYS_TRUE
);
activityPopularizeUser
.
setCurrentProgress
(
new
BigDecimal
(
apLogDTO
.
getItem
().
getProgress
()));
activityPopularizeUser
.
setCurrentProgress
(
new
BigDecimal
(
apLogDTO
.
getItem
().
getProgress
()));
popularizeUserBiz
.
updateSelectiveById
(
activityPopularizeUser
);
popularizeUserBiz
.
updateSelectiveById
(
activityPopularizeUser
);
mqSenderFeign
.
sendMessage
(
RabbitConstant
.
ADMIN_TOPIC
,
RabbitConstant
.
KEY_WALLET_ADD
,
JSONUtil
.
toJsonStr
(
new
MyWalletDetail
(){{
mqSenderFeign
.
sendMessage
(
RabbitConstant
.
ADMIN_TOPIC
,
RabbitConstant
.
KEY_WALLET_ADD
,
JSONUtil
.
toJsonStr
(
new
MyWalletDetail
(){{
setAmount
(
new
BigDecimal
(
"50"
));
setAmount
(
new
BigDecimal
(
"50"
));
setSource
(
SOURCE_ACTIVITY
);
setSource
(
SOURCE_ACTIVITY
);
setUserId
(
majorUserId
);
setUserId
(
majorUserId
);
setActivityId
(
activityPopularize
.
getId
());
setActivityId
(
activityPopularize
.
getId
());
setActivityName
(
activityPopularize
.
getName
());
setActivityName
(
activityPopularize
.
getName
());
setType
(
TYPE_POPULARIZE
);
setType
(
TYPE_POPULARIZE
);
setItype
(
ITYPE_IN
);
setItype
(
ITYPE_IN
);
}}));
}}));
}
}
}
}
}
}
}
...
...
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