Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
YouJia
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6375078a
authored
Oct 12, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(store): 角色是admin可以审批
1 parent
8b224ca0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
docs/nacos/youjia-test.yaml
youjia-module-store/src/main/java/com/youjia/store/service/impl/StoreApprovalServiceImpl.java
docs/nacos/youjia-test.yaml
View file @
6375078
...
@@ -169,7 +169,8 @@ youjia:
...
@@ -169,7 +169,8 @@ youjia:
store
:
store
:
approval
:
approval
:
level-role-codes
:
level-role-codes
:
-
finance_manager
-
business_manager
# 第1级:商务经理
-
finance_manager
# 第2级:财务经理
partner-merchant
:
partner-merchant
:
# 审批通过后同步至 D+ 的主服务商(深圳优加)
# 审批通过后同步至 D+ 的主服务商(深圳优加)
id
:
${PARTNER_MERCHANT_ID:}
id
:
${PARTNER_MERCHANT_ID:}
...
...
youjia-module-store/src/main/java/com/youjia/store/service/impl/StoreApprovalServiceImpl.java
View file @
6375078
...
@@ -2,6 +2,7 @@ package com.youjia.store.service.impl;
...
@@ -2,6 +2,7 @@ package com.youjia.store.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.youjia.common.constant.CommonConstants
;
import
com.youjia.common.core.PageResult
;
import
com.youjia.common.core.PageResult
;
import
com.youjia.common.core.ResultCode
;
import
com.youjia.common.core.ResultCode
;
import
com.youjia.common.enums.ApprovalActionEnum
;
import
com.youjia.common.enums.ApprovalActionEnum
;
...
@@ -64,11 +65,15 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
...
@@ -64,11 +65,15 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
@Override
@Override
public
PageResult
<
StoreApprovalTaskVO
>
pagePending
(
StoreApprovalTaskQueryDTO
query
)
{
public
PageResult
<
StoreApprovalTaskVO
>
pagePending
(
StoreApprovalTaskQueryDTO
query
)
{
List
<
String
>
roleCodes
=
CurrentUserHolder
.
getRoleCodes
();
List
<
String
>
roleCodes
=
CurrentUserHolder
.
getRoleCodes
();
boolean
isAdmin
=
roleCodes
.
contains
(
CommonConstants
.
ROLE_SYS_ADMIN
);
LambdaQueryWrapper
<
StoreListing
>
wrapper
=
buildWrapper
(
query
)
LambdaQueryWrapper
<
StoreListing
>
wrapper
=
buildWrapper
(
query
)
.
eq
(
StoreListing:
:
getStatus
,
StoreStatusEnum
.
PENDING
.
getCode
())
.
eq
(
StoreListing:
:
getStatus
,
StoreStatusEnum
.
PENDING
.
getCode
());
.
in
(
roleCodes
.
isEmpty
(),
StoreListing:
:
getLevelRoleCode
,
List
.
of
(
"-1"
))
// SYS_ADMIN 可看到所有待审批任务(充当所有角色),其他用户按角色匹配
.
in
(!
roleCodes
.
isEmpty
(),
StoreListing:
:
getLevelRoleCode
,
roleCodes
)
if
(!
isAdmin
)
{
.
orderByDesc
(
StoreListing:
:
getSubmitTime
);
wrapper
.
in
(
roleCodes
.
isEmpty
(),
StoreListing:
:
getLevelRoleCode
,
List
.
of
(
"-1"
))
.
in
(!
roleCodes
.
isEmpty
(),
StoreListing:
:
getLevelRoleCode
,
roleCodes
);
}
wrapper
.
orderByDesc
(
StoreListing:
:
getSubmitTime
);
return
pageTask
(
query
,
wrapper
);
return
pageTask
(
query
,
wrapper
);
}
}
...
@@ -133,7 +138,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
...
@@ -133,7 +138,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
}
}
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
PASS
,
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
PASS
,
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
PENDING
.
getCode
(),
"第 "
+
currentLevel
+
" 级审批通过,流转至第 "
+
nextLevel
+
" 级"
);
"第 "
+
currentLevel
+
" 级审批通过,流转至第 "
+
nextLevel
+
" 级"
,
listing
.
getLevelRoleCode
());
log
.
info
(
"门店上架审批升级:listingId={}, 第{}级→第{}级"
,
log
.
info
(
"门店上架审批升级:listingId={}, 第{}级→第{}级"
,
listing
.
getListingId
(),
currentLevel
,
nextLevel
);
listing
.
getListingId
(),
currentLevel
,
nextLevel
);
}
else
{
}
else
{
...
@@ -160,7 +166,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
...
@@ -160,7 +166,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
deactivateOldEffective
(
listing
.
getMerchantNo
(),
listing
.
getBusinessScene
(),
listing
.
getListingId
());
deactivateOldEffective
(
listing
.
getMerchantNo
(),
listing
.
getBusinessScene
(),
listing
.
getListingId
());
writeChangeLogForApproval
(
listing
,
oldEffective
,
now
);
writeChangeLogForApproval
(
listing
,
oldEffective
,
now
);
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
PASS
,
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
PASS
,
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
APPROVED
.
getCode
(),
"审批通过"
);
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
APPROVED
.
getCode
(),
"审批通过"
,
listing
.
getLevelRoleCode
());
log
.
info
(
"门店上架审批通过:listingId={}, 门店={}, 场景={}"
,
log
.
info
(
"门店上架审批通过:listingId={}, 门店={}, 场景={}"
,
listing
.
getListingId
(),
listing
.
getStoreName
(),
listing
.
getBusinessScene
());
listing
.
getListingId
(),
listing
.
getStoreName
(),
listing
.
getBusinessScene
());
// 对账规则发布由「审核通过」事件监听器处理(publishByListingId),
// 对账规则发布由「审核通过」事件监听器处理(publishByListingId),
...
@@ -192,7 +199,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
...
@@ -192,7 +199,8 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
storeListingMapper
.
updateById
(
update
);
storeListingMapper
.
updateById
(
update
);
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
REJECT
,
writeApprovalLog
(
listing
.
getListingId
(),
ApprovalActionEnum
.
REJECT
,
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
REJECTED
.
getCode
(),
dto
.
getReason
());
StoreStatusEnum
.
PENDING
.
getCode
(),
StoreStatusEnum
.
REJECTED
.
getCode
(),
dto
.
getReason
(),
listing
.
getLevelRoleCode
());
// TODO 接入企业微信通知发起人(携带打回原因)
// TODO 接入企业微信通知发起人(携带打回原因)
}
}
...
@@ -586,13 +594,26 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
...
@@ -586,13 +594,26 @@ public class StoreApprovalServiceImpl implements StoreApprovalService {
private
void
writeApprovalLog
(
Long
listingId
,
ApprovalActionEnum
action
,
private
void
writeApprovalLog
(
Long
listingId
,
ApprovalActionEnum
action
,
String
preStatus
,
String
postStatus
,
String
reason
)
{
String
preStatus
,
String
postStatus
,
String
reason
)
{
writeApprovalLog
(
listingId
,
action
,
preStatus
,
postStatus
,
reason
,
null
);
}
private
void
writeApprovalLog
(
Long
listingId
,
ApprovalActionEnum
action
,
String
preStatus
,
String
postStatus
,
String
reason
,
String
actingRoleCode
)
{
StoreApprovalLog
entity
=
new
StoreApprovalLog
();
StoreApprovalLog
entity
=
new
StoreApprovalLog
();
entity
.
setListingId
(
listingId
);
entity
.
setListingId
(
listingId
);
entity
.
setAction
(
action
.
name
());
entity
.
setAction
(
action
.
name
());
entity
.
setOperatorId
(
CurrentUserHolder
.
getUserId
());
entity
.
setOperatorId
(
CurrentUserHolder
.
getUserId
());
entity
.
setOperatorName
(
CurrentUserHolder
.
getName
());
entity
.
setOperatorName
(
CurrentUserHolder
.
getName
());
List
<
String
>
roleCodes
=
CurrentUserHolder
.
getRoleCodes
();
List
<
String
>
roleCodes
=
CurrentUserHolder
.
getRoleCodes
();
entity
.
setOperatorRole
(
roleCodes
.
isEmpty
()
?
null
:
String
.
join
(
","
,
roleCodes
));
String
operatorRole
;
if
(
actingRoleCode
!=
null
&&
roleCodes
.
contains
(
CommonConstants
.
ROLE_SYS_ADMIN
))
{
// SYS_ADMIN 代审批时,记录其充当的角色
operatorRole
=
CommonConstants
.
ROLE_SYS_ADMIN
+
"(代 "
+
actingRoleCode
+
")"
;
}
else
{
operatorRole
=
roleCodes
.
isEmpty
()
?
null
:
String
.
join
(
","
,
roleCodes
);
}
entity
.
setOperatorRole
(
operatorRole
);
entity
.
setPreStatus
(
preStatus
);
entity
.
setPreStatus
(
preStatus
);
entity
.
setPostStatus
(
postStatus
);
entity
.
setPostStatus
(
postStatus
);
entity
.
setReason
(
reason
);
entity
.
setReason
(
reason
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment