Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
scrm
/
rop-merchant
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 75f13e9f
authored
Aug 03, 2021
by
zhouhb
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]员工接口
1 parent
f72ffc24
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
14 deletions
src/main/java/cn/com/glsx/merchants/controller/MerchantController.java
src/main/java/cn/com/glsx/merchants/controller/StaffController.java
src/main/java/cn/com/glsx/merchants/request/staff/StaffSaveRequest.java
src/main/java/cn/com/glsx/merchants/response/StaffResponse.java
src/main/java/cn/com/glsx/merchants/service/StaffService.java
src/main/java/cn/com/glsx/merchants/controller/MerchantController.java
View file @
75f13e9
...
...
@@ -2,14 +2,12 @@ package cn.com.glsx.merchants.controller;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
cn.com.glsx.merchants.request.DefaultRequest
;
import
cn.com.glsx.merchants.request.merchant.*
;
import
cn.com.glsx.merchants.response.AccountTypeTreeRopResponse
;
import
cn.com.glsx.merchants.response.MerchantRopResponse
;
import
cn.com.glsx.merchants.response.MerchantTreeRopResponse
;
import
cn.com.glsx.merchants.service.MerchantService
;
import
cn.com.glsx.merchants.util.Pagination
;
import
com.rop.AbstractRopRequest
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
...
...
@@ -21,7 +19,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author zhouhaibao
...
...
src/main/java/cn/com/glsx/merchants/controller/StaffController.java
View file @
75f13e9
...
...
@@ -2,6 +2,7 @@ package cn.com.glsx.merchants.controller;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.rop.response.RopResponse
;
import
cn.com.glsx.merchants.request.DataRequest
;
import
cn.com.glsx.merchants.request.merchant.MerchantSaveRequest
;
import
cn.com.glsx.merchants.request.merchant.MerchantSearchResquest
;
import
cn.com.glsx.merchants.request.staff.*
;
...
...
@@ -9,15 +10,15 @@ import cn.com.glsx.merchants.response.MerchantRopResponse;
import
cn.com.glsx.merchants.response.StaffResponse
;
import
cn.com.glsx.merchants.service.StaffService
;
import
cn.com.glsx.merchants.util.Pagination
;
import
com.alibaba.fastjson.JSONObject
;
import
com.rop.AbstractRopRequest
;
import
com.rop.annotation.HttpAction
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
import
com.rop.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
...
...
@@ -41,7 +42,7 @@ public class StaffController {
* @param staffSaveRequest 入参
* @return
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.staff.saveStaff"
,
needInSession
=
NeedInSessionType
.
NO
)
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.staff.saveStaff"
,
needInSession
=
NeedInSessionType
.
NO
#
)
@ApiOperation
(
"保存员工"
)
public
RopResponse
<
Boolean
>
saveStaff
(
StaffSaveRequest
staffSaveRequest
)
{
try
{
...
...
@@ -162,4 +163,22 @@ public class StaffController {
}
}
/**
* 更新员工的有效期
*
* @param staffUpdateValRequest 入参
* @return
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.staff.updateValPerByStaffId"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"更新员工的有效期"
)
public
RopResponse
<
Boolean
>
updateValPerByStaffId
(
StaffUpdateValRequest
staffUpdateValRequest
)
{
try
{
staffService
.
updateValPerByStaffId
(
staffUpdateValRequest
);
return
RopResponse
.
success
(
true
);
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
"=======StaffController__invoke__updateValPerByStaffId__exception:{}"
,
e
.
getMessage
());
return
RopResponse
.
error
(
e
.
getErrId
(),
e
.
getMessage
());
}
}
}
src/main/java/cn/com/glsx/merchants/request/staff/StaffSaveRequest.java
View file @
75f13e9
...
...
@@ -2,6 +2,7 @@ package cn.com.glsx.merchants.request.staff;
import
cn.com.glsx.merchants.request.DefaultRequest
;
import
cn.com.glsx.merchants.request.file.FileSaveRequest
;
import
com.rop.annotation.IgnoreSign
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -64,7 +65,8 @@ public class StaffSaveRequest extends DefaultRequest {
@ApiModelProperty
(
notes
=
"角色id"
,
required
=
true
)
private
List
<
Integer
>
roleIds
;
private
FileSaveRequest
merchantFileRequest
;
private
String
merchantFileRequest
;
}
src/main/java/cn/com/glsx/merchants/response/StaffResponse.java
View file @
75f13e9
...
...
@@ -106,6 +106,12 @@ public class StaffResponse implements Serializable {
private
String
roleName
;
/**
* 有效期
*/
@ApiModelProperty
(
notes
=
"有效期"
)
private
Integer
effectiveTime
;
/**
* 文件
*/
private
FileResponse
merchantFileResponse
;
...
...
src/main/java/cn/com/glsx/merchants/service/StaffService.java
View file @
75f13e9
...
...
@@ -18,6 +18,8 @@ import cn.com.glsx.merchants.util.ExcelUtiles;
import
cn.com.glsx.merchants.util.FileUploadServerData
;
import
cn.com.glsx.merchants.util.FileUploadUtil
;
import
cn.com.glsx.merchants.util.Pagination
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.cloudframework.core.util.StringUtil
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.enums.OperateType
;
import
com.glsx.plat.common.utils.DateUtils
;
...
...
@@ -58,9 +60,9 @@ public class StaffService {
private
MerchantStaffRequest
converRequest
(
StaffSaveRequest
staffSaveRequest
)
{
MerchantStaffRequest
merchantStaffRequest
=
ConvertRequest
.
convertRequest
(
staffSaveRequest
,
new
MerchantStaffRequest
());
FileSaveRequest
merchantFileRequest
=
staffSaveRequest
.
getMerchantFileRequest
();
if
(
merchantFileRequest
!=
null
)
{
merchantStaffRequest
.
setMerchantFileRequest
(
ConvertRequest
.
convertRequest
(
merchantFileRequest
,
new
MerchantFileRequest
()
));
String
merchantFileRequest
=
staffSaveRequest
.
getMerchantFileRequest
();
if
(
!
StringUtil
.
isBlank
(
merchantFileRequest
)
)
{
merchantStaffRequest
.
setMerchantFileRequest
(
JSONObject
.
parseObject
(
merchantFileRequest
,
MerchantFileRequest
.
class
));
}
return
merchantStaffRequest
;
}
...
...
@@ -147,8 +149,8 @@ public class StaffService {
RpcResponse
<
List
<
MerchantStaffResponse
>>
listRpcResponse
=
merchantStaffRemote
.
exportStaffRemote
(
ConvertRequest
.
convertRequest
(
staffExportRequest
,
new
MerchantStaffRequest
()));
if
(
listRpcResponse
.
isSuccess
())
{
List
<
StaffExportResponse
>
staffResponses
=
ConvertResponse
.
convertList
(
listRpcResponse
.
getResult
(),
StaffExportResponse
.
class
);
staffResponses
.
forEach
(
index
->
{
index
.
setCreateDate
(
DateUtils
.
format
(
index
.
getCreatedTime
(),
DateUtils
.
NORMAL_DATE_TIME_PATTERN
));
staffResponses
.
forEach
(
index
->
{
index
.
setCreateDate
(
DateUtils
.
format
(
index
.
getCreatedTime
(),
DateUtils
.
NORMAL_DATE_TIME_PATTERN
));
});
byte
[]
bytes
=
ExcelUtiles
.
exportGoodsExcel
(
staffResponses
,
StaffExportResponse
.
class
);
FileUploadServerData
fileUploadServerData
=
FileUploadUtil
.
uploadToFileSystem
(
systemProperty
.
getUploadFileUrl
(),
""
,
bytes
,
"xlsx"
);
...
...
@@ -156,4 +158,17 @@ public class StaffService {
}
throw
new
RpcServiceException
(
listRpcResponse
.
getException
().
getErrId
(),
listRpcResponse
.
getMessage
());
}
/**
* 更新员工的有效期
*
* @param staffUpdateValRequest 入参
* @return
*/
public
void
updateValPerByStaffId
(
StaffUpdateValRequest
staffUpdateValRequest
)
{
RpcResponse
<
Boolean
>
booleanRpcResponse
=
merchantStaffRemote
.
updateValPerByStaffId
(
ConvertRequest
.
convertRequest
(
staffUpdateValRequest
,
new
MerchantStaffRequest
()));
if
(
booleanRpcResponse
.
isFailed
())
{
throw
new
RpcServiceException
(
booleanRpcResponse
.
getException
().
getErrId
(),
booleanRpcResponse
.
getMessage
());
}
}
}
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