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
3bb1d77a
Commit
3bb1d77a
authored
Dec 12, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/luck_draw_feature' into luck_draw_feature
parents
082e9ce3
5c3bb949
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
27 deletions
+39
-27
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+9
-3
ActivityPopularizeBiz.java
...com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
+28
-22
ActivityPopularizeRelationBiz.java
.../platform/activity/biz/ActivityPopularizeRelationBiz.java
+2
-2
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
3bb1d77a
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rpc
.
service
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rpc
.
service
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.ace.cache.annotation.CacheClear
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.biz.*
;
import
com.github.wxiaoqi.security.admin.biz.*
;
import
com.github.wxiaoqi.security.admin.constant.RedisKey
;
import
com.github.wxiaoqi.security.admin.constant.RedisKey
;
...
@@ -249,8 +248,15 @@ public class AppPermissionService {
...
@@ -249,8 +248,15 @@ public class AppPermissionService {
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
}
if
(
StringUtils
.
isNotBlank
(
code
)&&
appUserDetailBiz
.
getUserByCode
(
code
)==
0
){
if
(
StringUtils
.
isNotBlank
(
code
)){
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"邀请人不存在"
);
//判断处理活动关键字
String
[]
codes
=
code
.
split
(
"_"
);
if
(
codes
.
length
>
1
)
{
String
userCode
=
codes
[
0
];
if
(
appUserDetailBiz
.
getUserByCode
(
userCode
)==
0
)
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NOTEXIST_CODE
,
"邀请人不存在"
);
}
}
}
}
String
redisLockKey
=
RedisKey
.
CONSTANT_CODE_PREFIX
+
username
+
mobilecode
;
String
redisLockKey
=
RedisKey
.
CONSTANT_CODE_PREFIX
+
username
+
mobilecode
;
String
mobilecodeRedis
=
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
String
mobilecodeRedis
=
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
)
==
null
?
""
:
userRedisTemplate
.
opsForValue
().
get
(
redisLockKey
).
toString
();
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
View file @
3bb1d77a
...
@@ -36,7 +36,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR
...
@@ -36,7 +36,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR
*/
*/
@Service
@Service
@Slf4j
@Slf4j
public
class
ActivityPopularizeBiz
extends
BaseBiz
<
ActivityPopularizeMapper
,
ActivityPopularize
>
{
public
class
ActivityPopularizeBiz
extends
BaseBiz
<
ActivityPopularizeMapper
,
ActivityPopularize
>
{
@Autowired
@Autowired
ActivityPopularizeRelationBiz
relationBiz
;
ActivityPopularizeRelationBiz
relationBiz
;
...
@@ -68,12 +68,12 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
...
@@ -68,12 +68,12 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
public
void
handleRegister
(
RegisterQueueDTO
registerQueueDTO
)
{
public
void
handleRegister
(
RegisterQueueDTO
registerQueueDTO
)
{
log
.
info
(
"活动码注册成功:registerQueueDTO = {}"
,
registerQueueDTO
.
toString
());
log
.
info
(
"活动码注册成功:registerQueueDTO = {}"
,
registerQueueDTO
.
toString
());
if
(
StringUtils
.
isNotBlank
(
registerQueueDTO
.
getInParamDTO
().
getActivityCode
()))
{
if
(
StringUtils
.
isNotBlank
(
registerQueueDTO
.
getInParamDTO
().
getActivityCode
()))
{
String
activityCode
=
registerQueueDTO
.
getInParamDTO
().
getActivityCode
().
replace
(
PREFIX
,
""
);
String
activityCode
=
registerQueueDTO
.
getInParamDTO
().
getActivityCode
().
replace
(
PREFIX
,
""
)
.
replace
(
"p"
,
""
)
;
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
registerQueueDTO
.
getAppUserId
()).
getData
();
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
registerQueueDTO
.
getAppUserId
()).
getData
();
//获取活动code,并且注册来源是app 并且 非普通登录
//获取活动code,并且注册来源是app 并且 非普通登录
if
(!
RegisterQueueDTO
.
SIGN_LOGIN
.
equals
(
registerQueueDTO
.
getSign
())
&&
StringUtils
.
isNotBlank
(
activityCode
))
{
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
);
}});
}});
log
.
info
(
"活动邀请注册:activityPopularize = {}"
,
activityPopularize
.
toString
());
log
.
info
(
"活动邀请注册:activityPopularize = {}"
,
activityPopularize
.
toString
());
...
@@ -85,13 +85,13 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
...
@@ -85,13 +85,13 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
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
());
}};
}};
...
@@ -99,35 +99,36 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
...
@@ -99,35 +99,36 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
//新增第几个邀请人和邀请金额字段
//新增第几个邀请人和邀请金额字段
Integer
num
=
relationBiz
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
Integer
num
=
relationBiz
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
BigDecimal
amount
=
new
BigDecimal
(
0
)
;
Integer
amount
=
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"
);
Integer
amountString
=
jsonObject1
.
getInteger
(
"amount"
);
amount
.
add
(
new
BigDecimal
(
amountString
))
;
amount
=
amount
+
amountString
;
}
}
}
}
}
}
Integer
a
=
amount
;
//添加活动关系
//添加活动关系
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
(
new
BigDecimal
(
a
)
);
}});
}});
ApLogDTO
apLogDTO
=
popularizeLogBiz
.
selectOneApLogDTO
(
new
ActivityPopularizeLog
(){{
ApLogDTO
apLogDTO
=
popularizeLogBiz
.
selectOneApLogDTO
(
new
ActivityPopularizeLog
()
{{
setUserId
(
majorUserId
);
setUserId
(
majorUserId
);
setItemId
(
activityPopularizeItem
.
getId
());
setItemId
(
activityPopularizeItem
.
getId
());
}});
}});
//生成任务项
//生成任务项
if
(
null
==
apLogDTO
)
{
if
(
null
==
apLogDTO
)
{
popularizeLogBiz
.
insertSelectiveRe
(
new
ActivityPopularizeLog
(){{
popularizeLogBiz
.
insertSelectiveRe
(
new
ActivityPopularizeLog
()
{{
setItemId
(
activityPopularizeItem
.
getId
());
setItemId
(
activityPopularizeItem
.
getId
());
setUserId
(
majorUserId
);
setUserId
(
majorUserId
);
setStatus
(
SYS_FALSE
);
setStatus
(
SYS_FALSE
);
...
@@ -136,26 +137,31 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
...
@@ -136,26 +137,31 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper,Acti
}
}
//查出majorUser参与活动信息
//查出majorUser参与活动信息
ActivityPopularizeUser
activityPopularizeUser
=
popularizeUserBiz
.
selectOne
(
new
ActivityPopularizeUser
(){{
ActivityPopularizeUser
activityPopularizeUser
=
popularizeUserBiz
.
selectOne
(
new
ActivityPopularizeUser
()
{{
setUserId
(
majorUserId
);
setUserId
(
majorUserId
);
setPopularizeId
(
activityPopularize
.
getId
());
setPopularizeId
(
activityPopularize
.
getId
());
}});
}});
double
currentProgress
=
activityPopularizeUser
.
getCurrentProgress
().
doubleValue
();
log
.
info
(
"用户原活动进度:currentProgress = {}"
,
currentProgress
);
currentProgress
+=
Double
.
parseDouble
(
a
+
""
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
currentProgress
);
log
.
info
(
"用户现活动进度:newCurrentProgress = {}"
,
currentProgress
);
//修改当前进度
//修改当前进度
activityPopularizeUser
.
setCurrentProgress
(
activityPopularizeUser
.
getCurrentProgress
().
add
(
amount
));
activityPopularizeUser
.
setCurrentProgress
(
bigDecimal
);
popularizeUserBiz
.
updateSelectiveById
(
activityPopularizeUser
);
//任务没有完成
//任务没有完成
if
(!
SYS_TRUE
.
equals
(
activityPopularizeUser
.
getStatus
()))
{
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
()
>=
10
)
{
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
()));
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
);
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeRelationBiz.java
View file @
3bb1d77a
...
@@ -30,7 +30,7 @@ public class ActivityPopularizeRelationBiz extends BaseBiz<ActivityPopularizeRel
...
@@ -30,7 +30,7 @@ public class ActivityPopularizeRelationBiz extends BaseBiz<ActivityPopularizeRel
}
}
public
Integer
getByUserIdAndPopularizeId
(
ActivityPopularizeRelation
activityPopularizeRelation
)
{
public
Integer
getByUserIdAndPopularizeId
(
ActivityPopularizeRelation
activityPopularizeRelation
)
{
Integer
num
=
mapper
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
Integer
num
=
mapper
.
getByUserIdAndPopularizeId
(
activityPopularizeRelation
);
return
num
==
null
?
1
:
num
;
return
num
==
null
?
1
:
num
+
1
;
}
}
}
}
\ 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