Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
7b8fd244
Commit
7b8fd244
authored
Jan 06, 2025
by
Smile
Committed by
wux
Jan 09, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员默认等级定时任务
parent
6b577fa3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
0 deletions
+170
-0
MemberUserMapper.java
.../yudao/module/member/dal/mysql/user/MemberUserMapper.java
+2
-0
userLevelDefaultDetailsTask.java
.../yudao/module/member/job/userLevelDefaultDetailsTask.java
+121
-0
MemberUserService.java
...r/yudao/module/member/service/user/MemberUserService.java
+6
-0
MemberUserServiceImpl.java
...dao/module/member/service/user/MemberUserServiceImpl.java
+5
-0
MemberUserMapper.xml
...-impl/src/main/resources/mapper/user/MemberUserMapper.xml
+36
-0
No files found.
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/user/MemberUserMapper.java
View file @
7b8fd244
...
...
@@ -35,6 +35,8 @@ public interface MemberUserMapper extends BaseMapperX<MemberUserDO> {
List
<
MemberUserDO
>
getList
(
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
MemberUserDO
>
queryWrapper
);
List
<
MemberUserDO
>
getUserByNoLevelDetail
();
long
memberUserCount
(
@Param
(
Constants
.
WRAPPER
)
Wrapper
<
MemberUserDO
>
queryWrapper
);
@ResultType
(
Integer
.
class
)
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/job/userLevelDefaultDetailsTask.java
0 → 100644
View file @
7b8fd244
package
cn
.
iocoder
.
yudao
.
module
.
member
.
job
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.util.date.DateUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery
;
import
cn.iocoder.yudao.framework.quartz.core.handler.JobHandler
;
import
cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.levelOperatLog.MemberUserLevelOperateLogDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.memberUserLevelDetail.MemberUserLevelDetailsDO
;
import
cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO
;
import
cn.iocoder.yudao.module.member.enums.MemberLevelStatusEnum
;
import
cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService
;
import
cn.iocoder.yudao.module.member.service.levelDetails.MemberUserLevelDetailsService
;
import
cn.iocoder.yudao.module.member.service.levelOperateLog.MemberUserLevelOperateLogService
;
import
cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService
;
import
cn.iocoder.yudao.module.member.service.user.MemberUserService
;
import
cn.iocoder.yudao.module.member.vo.userLevelDetails.MemberUserLevelDetailsBackVO
;
import
cn.iocoder.yudao.module.member.vo.userLevelDetails.MemberUserLevelDetailsQueryVO
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
/**
* 会员等级详情定时任务
*/
@Component
@Slf4j
public
class
userLevelDefaultDetailsTask
implements
JobHandler
{
/**
* 每天凌晨00:00AM和12:00AM 分别执行一次
* @param param 参数
* @return
* @throws Exception
*/
@Resource
private
MemberUserLevelConfigService
memberUserLevelConfigService
;
@Resource
private
MemberUserService
userService
;
@Resource
private
MemberUserLevelDetailsService
memberUserLevelDetailsService
;
@Resource
private
AdminUserApi
adminUserApi
;
@Resource
private
MemberUserLevelOperateLogService
memberUserLevelOperateService
;
@Lazy
@Resource
private
MemberUserScoreLogService
memberUserScoreLogService
;
@Override
public
String
execute
(
String
param
)
throws
Exception
{
log
.
info
(
"level default details task running"
);
//查找默认的蓝卡等级,等级为1
LambdaQuery
<
MemberUserLevelConfigDO
>
userLevelConfigDoLambdaQuery
=
new
LambdaQuery
<>();
userLevelConfigDoLambdaQuery
.
eq
(
MemberUserLevelConfigDO:
:
getStatus
,
MemberLevelStatusEnum
.
ENABLED
.
getValue
());
userLevelConfigDoLambdaQuery
.
eq
(
MemberUserLevelConfigDO:
:
getLevel
,
1
);
List
<
MemberUserLevelConfigDO
>
todoList
=
memberUserLevelConfigService
.
selectList
(
userLevelConfigDoLambdaQuery
);
log
.
info
(
"level default details task, rule count :{}"
,
todoList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
todoList
))
{
return
"success"
;
}
else
{
MemberUserLevelConfigDO
memberUserLevelConfigDO
=
todoList
.
get
(
0
);
log
.
info
(
"level default details task, rule name :{}"
,
memberUserLevelConfigDO
.
getRuleNumber
());
List
<
MemberUserDO
>
userByNoLevelDetailList
=
userService
.
getUserByNoLevelDetail
();
if
(
CollectionUtils
.
isEmpty
(
userByNoLevelDetailList
)){
return
"success"
;
}
else
{
userByNoLevelDetailList
.
stream
().
forEach
(
memberUserDO
->
{
setConfigDetails
(
memberUserDO
,
memberUserLevelConfigDO
);
});
}
log
.
info
(
"定时任务完成"
);
}
return
"success"
;
}
private
void
setConfigDetails
(
MemberUserDO
memberUserDO
,
MemberUserLevelConfigDO
memberUserLevelConfigDO
)
{
//获取用户是否有详情
MemberUserLevelDetailsQueryVO
queryVO
=
new
MemberUserLevelDetailsQueryVO
();
queryVO
.
setMemberId
(
memberUserDO
.
getId
());
PageResult
<
MemberUserLevelDetailsBackVO
>
page
=
memberUserLevelDetailsService
.
getPage
(
queryVO
);
AdminUserRespDTO
user
=
adminUserApi
.
getUser
(
1L
);
List
<
MemberUserLevelDetailsBackVO
>
list
=
page
.
getList
();
if
(
CollectionUtils
.
isEmpty
(
list
)){
//没有详情,新增一条
MemberUserLevelDetailsDO
memberUserLevelDetailsDO
=
new
MemberUserLevelDetailsDO
();
memberUserLevelDetailsDO
.
setMemberId
(
memberUserDO
.
getId
());
memberUserLevelDetailsDO
.
setLevel
(
memberUserLevelConfigDO
.
getLevel
());
memberUserLevelDetailsDO
.
setSpecificSettings
(
false
);
if
(
memberUserLevelConfigDO
.
getValidityPeriod
()
!=
null
)
{
memberUserLevelDetailsDO
.
setValidityPeriod
(
DateUtils
.
getNextNDayStart
(
new
Date
(),
memberUserLevelConfigDO
.
getValidityPeriod
()));
}
memberUserLevelDetailsDO
.
setRemarks
(
memberUserLevelConfigDO
.
getDescription
());
memberUserLevelDetailsDO
.
setConfigId
(
memberUserLevelConfigDO
.
getId
());
memberUserLevelDetailsDO
.
setCreator
(
String
.
valueOf
(
user
.
getId
()));
memberUserLevelDetailsDO
.
setUpdater
(
String
.
valueOf
(
user
.
getId
()));
memberUserLevelDetailsService
.
save
(
memberUserLevelDetailsDO
);
log
.
info
(
"设置默认等级,客户没有等级详情,增加等级详情进入升级操作,规则id:{},用户id:{}"
,
memberUserLevelConfigDO
.
getRuleNumber
(),
memberUserDO
.
getId
());
//设置用户为admin
//插入一条日志 升级日志
MemberUserLevelOperateLogDO
memberUserLevelOperateLogDo
=
MemberUserLevelOperateLogDO
.
builder
()
.
configId
(
memberUserLevelDetailsDO
.
getConfigId
())
.
configName
(
memberUserLevelConfigDO
.
getName
())
.
memberId
(
memberUserLevelDetailsDO
.
getMemberId
())
.
operator
(
user
.
getNickname
())
.
remarks
(
memberUserLevelDetailsDO
.
getRemarks
())
.
level
(
memberUserLevelDetailsDO
.
getLevel
())
.
operateType
(
1
)
.
build
();
memberUserLevelOperateService
.
save
(
memberUserLevelOperateLogDo
);
}
}
}
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
View file @
7b8fd244
...
...
@@ -128,6 +128,12 @@ public interface MemberUserService {
*/
List
<
MemberUserDO
>
getUserList
(
UserQueryVO
query
);
/**
* 获取没有等级的会员用户列表
* @return
*/
List
<
MemberUserDO
>
getUserByNoLevelDetail
();
/**
* 根据id更新用户
*
...
...
yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
View file @
7b8fd244
...
...
@@ -471,6 +471,11 @@ public class MemberUserServiceImpl implements MemberUserService {
return
memberUserMapper
.
getList
(
wrapper
);
}
@Override
public
List
<
MemberUserDO
>
getUserByNoLevelDetail
()
{
return
memberUserMapper
.
getUserByNoLevelDetail
();
}
@Override
public
int
updateById
(
MemberUserDO
memberUserDO
)
{
return
memberUserMapper
.
updateById
(
memberUserDO
);
...
...
yudao-module-member/yudao-module-member-impl/src/main/resources/mapper/user/MemberUserMapper.xml
View file @
7b8fd244
...
...
@@ -37,6 +37,36 @@
and uca.deleted = 0 or uca.deleted is null
</sql>
<sql
id=
"queryTableByNoConfigDetail"
>
select u.*,
uca.`status` as identity_audit_status,
uca.`audit_remark` as identity_audit_remark,
uca.`name` as identity_name,
uca.`create_time` as identity_audit_create_time,
uca.`audit_time` as identity_audit_time,
uea.`status` as enterprise_audit_status,
uea.`name` as enterprise_name,
uea.`create_time` as enterprise_audit_create_time,
uea.`audit_time` as enterprise_audit_time,
uea.`audit_remark` as enterprise_audit_remark,
ec.id as customerId,
ec.number as customerCode,
u.code as memberCode
from member_user u
left join member_user_card_auth uca on u.id = uca.user_id
left join member_user_enterprise_auth uea on u.id = uea.user_id
left join ecw_customer_contacts ecc on u.id = ecc.userid
left join ecw_customer ec on ec.id = ecc.customer_id
left join member_user_level_details muld on muld.member_id = u.id
where 1 = 1
and muld.level is null
and (uca.deleted = 0 or uca.deleted is null)
</sql>
<select
id=
"getWaitApproveUserPage"
resultType=
"cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO"
>
select * from (
select u.*,
...
...
@@ -78,6 +108,12 @@
${ew.customSqlSegment}
</select>
<select
id=
"getUserByNoLevelDetail"
resultType=
"cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO"
>
select * from (
<include
refid=
"queryTableByNoConfigDetail"
/>
) as t
</select>
<select
id=
"get7daysCount"
parameterType=
"java.lang.String"
resultType=
"cn.iocoder.yudao.module.member.controller.admin.user.vo.UserBackVO"
>
select DATE_FORMAT(t.create_time,'%y-%m-%d') as registDate,count(1) as groupCount from member_user t where t.create_time>=#{format} GROUP BY DATE_FORMAT(t.create_time,'%y-%m-%d')
</select>
...
...
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