Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rop-dj-strategy
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 89c3cc92
authored
Jan 22, 2026
by
林永健
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(strategy): 新增策略中心门店员工管理功能
1 parent
e8274c93
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
1 deletions
pom.xml
src/main/java/cn/com/glsx/dj/strategy/config/dubbo/MerchantDubboConfig.java
src/main/java/cn/com/glsx/dj/strategy/controller/MerchantStaffController.java
src/main/java/cn/com/glsx/dj/strategy/request/StrategyStaffRequest.java
src/main/java/cn/com/glsx/dj/strategy/uitl/CommonUtil.java
pom.xml
View file @
89c3cc9
...
...
@@ -42,7 +42,7 @@
<dependency>
<groupId>
cn.com.glsx.merchants
</groupId>
<artifactId>
platform-merchants-api
</artifactId>
<version>
5.
5
.1-SNAPSHOT
</version>
<version>
5.
6
.1-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
cn.com.glsx.dj
</groupId>
...
...
src/main/java/cn/com/glsx/dj/strategy/config/dubbo/MerchantDubboConfig.java
0 → 100644
View file @
89c3cc9
package
cn
.
com
.
glsx
.
dj
.
strategy
.
config
.
dubbo
;
import
cn.com.glsx.merchants.remote.MerchantRoleRemote
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
MerchantDubboConfig
extends
DubboConfig
{
@Bean
public
MerchantStaffRemote
merchantStaffRemote
()
{
return
factory
.
builder
(
MerchantStaffRemote
.
class
).
version
(
"2.0.0"
).
check
(
check
)
/*.url("dubbo://localhost:20885")*/
.
timeout
(
timeout
).
build
();
}
@Bean
public
MerchantRoleRemote
merchantRoleRemote
()
{
return
factory
.
builder
(
MerchantRoleRemote
.
class
).
version
(
"2.0.0"
).
check
(
check
)
/*.url("dubbo://localhost:20885")*/
.
timeout
(
timeout
).
build
();
}
}
src/main/java/cn/com/glsx/dj/strategy/controller/MerchantStaffController.java
0 → 100644
View file @
89c3cc9
package
cn
.
com
.
glsx
.
dj
.
strategy
.
controller
;
import
cn.com.glsx.dj.strategy.request.StrategyStaffRequest
;
import
cn.com.glsx.dj.strategy.uitl.CommonUtil
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.enums.DefaultErrorEnum
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.core.util.RpcAssert
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
cn.com.glsx.merchants.model.request.MerchantRoleRequest
;
import
cn.com.glsx.merchants.model.request.MerchantStaffRequest
;
import
cn.com.glsx.merchants.model.request.StaffBatchRequest
;
import
cn.com.glsx.merchants.model.request.wechatbinding.MerchantStaffListRequest
;
import
cn.com.glsx.merchants.model.response.MerchantRoleResponse
;
import
cn.com.glsx.merchants.model.response.MerchantStaffResponse
;
import
cn.com.glsx.merchants.remote.MerchantRoleRemote
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
com.alibaba.nacos.common.utils.CollectionUtils
;
import
com.google.common.collect.Lists
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@Api
(
"策略中心-员工操作"
)
@RequiredArgsConstructor
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
YES
)
public
class
MerchantStaffController
{
@Autowired
private
MerchantStaffRemote
merchantStaffRemote
;
@Autowired
private
MerchantRoleRemote
merchantRoleRemote
;
@ApiOperation
(
"添加员工"
)
@ServiceMethod
(
method
=
"dj.api.strategy.merchant.staff.add"
)
public
RopResponse
<
Boolean
>
addMerchantStaff
(
StrategyStaffRequest
request
)
{
try
{
checkStaffExist
(
request
);
RpcResponse
<
Boolean
>
res
=
merchantStaffRemote
.
saveStaffRemote
(
buildMerchantStaffRequest
(
request
));
return
RopResponse
.
success
(
res
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
"addMerchantStaff occur error!"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
"addMerchantStaff occur error!"
,
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
/**
* 检查手机号和门店是否存在
*/
private
void
checkStaffExist
(
StrategyStaffRequest
request
)
{
RpcAssert
.
assertNotNull
(
request
.
getMerchantId
(),
DefaultErrorEnum
.
SERVER_ERROR
,
"门店号不能为空"
);
RpcAssert
.
assertNotNull
(
request
.
getStaffPhone
(),
DefaultErrorEnum
.
SERVER_ERROR
,
"手机号不能为空"
);
MerchantStaffListRequest
staffQuery
=
new
MerchantStaffListRequest
();
staffQuery
.
setMerchantIds
(
Lists
.
newArrayList
(
request
.
getMerchantId
()));
staffQuery
.
setStaffPhone
(
request
.
getStaffPhone
());
log
.
info
(
"查询员工列表参数:{}"
,
staffQuery
);
RpcResponse
<
List
<
MerchantStaffResponse
>>
staffListRes
=
merchantStaffRemote
.
selectStaffListByMerchantIdsAndPhone
(
staffQuery
);
if
(
staffListRes
.
isFailed
())
{
log
.
error
(
"查询员工列表失败,response:{}"
,
staffListRes
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
SERVICE_ERROR
,
staffListRes
.
getMessage
());
}
if
(
CollectionUtils
.
isNotEmpty
(
staffListRes
.
getResult
()))
{
log
.
info
(
"员工已存在, staffIds:{}"
,
staffListRes
.
getResult
().
stream
().
map
(
MerchantStaffResponse:
:
getUuid
).
collect
(
Collectors
.
toList
()));
throw
new
RpcServiceException
(
DefaultErrorEnum
.
SERVICE_ERROR
,
"已存在员工账号"
);
}
}
/**
* 构建创建员工的传参
*/
private
MerchantStaffRequest
buildMerchantStaffRequest
(
StrategyStaffRequest
request
)
{
MerchantStaffRequest
staffRequest
=
new
MerchantStaffRequest
();
staffRequest
.
setMerchantId
(
request
.
getMerchantId
());
staffRequest
.
setStaffName
(
request
.
getStaffName
());
staffRequest
.
setStaffPhone
(
request
.
getStaffPhone
());
staffRequest
.
setPassword
(
"Gl123456"
);
staffRequest
.
setVisibleInferiorMer
(
request
.
getMerchantId
().
toString
());
staffRequest
.
setCreatedAccount
(
CommonUtil
.
getPhone
());
staffRequest
.
setCreatedName
(
CommonUtil
.
getUserName
());
staffRequest
.
setStaffLabel
(
request
.
getStaffLabel
());
staffRequest
.
setStaffBusinessType
(
0
);
// 查找该门店的角色id
MerchantRoleRequest
roleQuery
=
new
MerchantRoleRequest
();
roleQuery
.
setMerchantNo
(
request
.
getMerchantId
());
roleQuery
.
setRoleName
(
"驻店人员"
);
log
.
info
(
"查询角色列表参数:{}"
,
roleQuery
);
RpcResponse
<
List
<
MerchantRoleResponse
>>
roleListRes
=
merchantRoleRemote
.
getRoleListRemote
(
roleQuery
);
if
(!
roleListRes
.
hasResult
()
||
CollectionUtils
.
isEmpty
(
roleListRes
.
getResult
()))
{
log
.
error
(
"查询角色列表失败,response:{}"
,
roleListRes
);
throw
new
RpcServiceException
(
DefaultErrorEnum
.
SERVICE_ERROR
,
"门店驻店人员角色不存在"
);
}
Integer
roleId
=
roleListRes
.
getResult
().
get
(
0
).
getId
();
staffRequest
.
setRoleIds
(
Lists
.
newArrayList
(
roleId
));
return
staffRequest
;
}
@ApiOperation
(
"禁用员工"
)
@ServiceMethod
(
method
=
"dj.api.strategy.merchant.staff.disable"
)
public
RopResponse
<
Boolean
>
disableMerchantStaff
(
StrategyStaffRequest
request
)
{
try
{
StaffBatchRequest
staffBatchRequest
=
new
StaffBatchRequest
();
staffBatchRequest
.
setStaffUuid
(
request
.
getStaffUuid
());
staffBatchRequest
.
setStatus
(
2
);
log
.
info
(
"禁用员工:{}"
,
staffBatchRequest
);
RpcResponse
<
Boolean
>
res
=
merchantStaffRemote
.
updateStaffStatusByPhone
(
staffBatchRequest
);
return
RopResponse
.
success
(
res
.
getResult
());
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
"disableMerchantStaff occur error!"
,
e
);
return
RopResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
"disableMerchantStaff occur error!"
,
e
);
return
RopResponse
.
result
(
DefaultErrorEnum
.
SERVICE_ERROR
);
}
}
}
src/main/java/cn/com/glsx/dj/strategy/request/StrategyStaffRequest.java
0 → 100644
View file @
89c3cc9
package
cn
.
com
.
glsx
.
dj
.
strategy
.
request
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.io.Serializable
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"门店员工"
)
public
class
StrategyStaffRequest
extends
AbstractRopRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1L
;
@ApiModelProperty
(
notes
=
"门店号"
)
private
Integer
merchantId
;
@ApiModelProperty
(
notes
=
"员工编号"
)
private
String
staffUuid
;
@ApiModelProperty
(
notes
=
"员工手机号"
)
private
String
staffPhone
;
@ApiModelProperty
(
notes
=
"员工姓名"
)
private
String
staffName
;
@ApiModelProperty
(
notes
=
"员工标签:0: 会员权益 1:精品升级 2:膨胀金活动 3:售后众筹 4:次新车转化 7: 二手车"
)
private
String
staffLabel
;
}
src/main/java/cn/com/glsx/dj/strategy/uitl/CommonUtil.java
View file @
89c3cc9
...
...
@@ -252,6 +252,22 @@ public class CommonUtil {
return
user
.
getLoginAccout
();
}
public
static
String
getUuid
()
{
LoginUserDTO
user
=
getLoginUser
();
if
(
user
==
null
)
{
return
null
;
}
return
user
.
getUuid
();
}
public
static
String
getPhone
()
{
LoginUserDTO
user
=
getLoginUser
();
if
(
user
==
null
)
{
return
null
;
}
return
user
.
getPhone
();
}
/**
* @return
* @Description:获取用户名,如为商户则返回商户名称,员工则返回员工姓名
...
...
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