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 86832a5c
authored
Jul 16, 2021
by
licy
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]文件管理
1 parent
126b4f8c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
222 additions
and
7 deletions
src/main/java/cn/com/glsx/merchants/config/DubboConfig.java
src/main/java/cn/com/glsx/merchants/controller/MerchantFileController.java
src/main/java/cn/com/glsx/merchants/controller/MerchantFunctionController.java
src/main/java/cn/com/glsx/merchants/convert/ConverResponse.java
src/main/java/cn/com/glsx/merchants/request/file/FileSearchRequest.java
src/main/java/cn/com/glsx/merchants/request/function/FunctionSaveRequest.java
src/main/java/cn/com/glsx/merchants/response/FileResponse.java
src/main/java/cn/com/glsx/merchants/service/MerchantFileService.java
src/main/java/cn/com/glsx/merchants/config/DubboConfig.java
View file @
86832a5
...
@@ -49,4 +49,19 @@ public class DubboConfig {
...
@@ -49,4 +49,19 @@ public class DubboConfig {
public
MerchantUserRemote
getMerchantUserRemote
()
{
public
MerchantUserRemote
getMerchantUserRemote
()
{
return
factory
.
builder
(
MerchantUserRemote
.
class
).
check
(
false
).
timeout
(
30000
).
version
(
"2.0.0"
).
build
();
return
factory
.
builder
(
MerchantUserRemote
.
class
).
check
(
false
).
timeout
(
30000
).
version
(
"2.0.0"
).
build
();
}
}
@Bean
public
MerchantFileRemote
getMerchantFileRemote
()
{
return
factory
.
builder
(
MerchantFileRemote
.
class
).
check
(
false
).
timeout
(
30000
).
version
(
"2.0.0"
).
build
();
}
@Bean
public
MerchantAccountTypeRemote
getMerchantAccountTypeRemote
()
{
return
factory
.
builder
(
MerchantAccountTypeRemote
.
class
).
check
(
false
).
timeout
(
30000
).
version
(
"2.0.0"
).
build
();
}
@Bean
public
MerchantRoleRemote
getMerchantRoleRemote
()
{
return
factory
.
builder
(
MerchantRoleRemote
.
class
).
check
(
false
).
timeout
(
30000
).
version
(
"2.0.0"
).
build
();
}
}
}
src/main/java/cn/com/glsx/merchants/controller/MerchantFileController.java
0 → 100644
View file @
86832a5
package
cn
.
com
.
glsx
.
merchants
.
controller
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.merchants.request.file.FileSearchRequest
;
import
cn.com.glsx.merchants.response.FileResponse
;
import
cn.com.glsx.merchants.service.MerchantFileService
;
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.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
/**
* @author Administrator
*/
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
NO
)
@Api
(
"文件管理接口"
)
@Slf4j
public
class
MerchantFileController
{
@Autowired
private
MerchantFileService
merchantFileService
;
/**
* 查询素材库
* @param fileSearchRequest
* @return
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.findMerchantFile"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"查询素材库"
)
public
RpcResponse
<
List
<
FileResponse
>>
findMerchantFile
(
FileSearchRequest
fileSearchRequest
){
try
{
List
<
FileResponse
>
fileResponseList
=
merchantFileService
.
findMerchantFile
(
fileSearchRequest
);
return
RpcResponse
.
success
(
fileResponseList
);
}
catch
(
RpcServiceException
e
)
{
log
.
info
(
"=======MerchantFileController__invoke__findMerchantFile__exception:{}"
,
e
.
getMessage
());
return
RpcResponse
.
error
(
e
.
getError
(),
e
.
getMessage
());
}
}
public
RpcResponse
<
Boolean
>
saveMerchantFileImg
(){
return
null
;
}
public
RpcResponse
<
Boolean
>
updateMerchantFileImg
(){
return
null
;
}
}
src/main/java/cn/com/glsx/merchants/controller/MerchantFunctionController.java
View file @
86832a5
...
@@ -38,7 +38,7 @@ public class MerchantFunctionController {
...
@@ -38,7 +38,7 @@ public class MerchantFunctionController {
* @return
* @return
*/
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.saveMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.saveMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"保存
菜单
"
)
@ApiOperation
(
"保存
功能
"
)
public
RopResponse
<
Boolean
>
saveMerchantFunction
(
FunctionSaveRequest
functionSaveRequest
)
{
public
RopResponse
<
Boolean
>
saveMerchantFunction
(
FunctionSaveRequest
functionSaveRequest
)
{
try
{
try
{
merchantFunctionService
.
saveMerchantFunction
(
functionSaveRequest
);
merchantFunctionService
.
saveMerchantFunction
(
functionSaveRequest
);
...
@@ -56,7 +56,7 @@ public class MerchantFunctionController {
...
@@ -56,7 +56,7 @@ public class MerchantFunctionController {
* @return
* @return
*/
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.updateMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.updateMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"
保存菜单
"
)
@ApiOperation
(
"
修改功能
"
)
public
RopResponse
<
Boolean
>
updateMerchantFunction
(
FunctionUpdateRequest
functionUpdateRequest
)
{
public
RopResponse
<
Boolean
>
updateMerchantFunction
(
FunctionUpdateRequest
functionUpdateRequest
)
{
try
{
try
{
merchantFunctionService
.
updateMerchantFunction
(
functionUpdateRequest
);
merchantFunctionService
.
updateMerchantFunction
(
functionUpdateRequest
);
...
@@ -68,13 +68,13 @@ public class MerchantFunctionController {
...
@@ -68,13 +68,13 @@ public class MerchantFunctionController {
}
}
/**
/**
*
修改功能
*
查询功能列表
*
*
* @param functionListSearchRequest 入参
* @param functionListSearchRequest 入参
* @return
* @return
*/
*/
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.findMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ServiceMethod
(
method
=
"cn.com.glsx.merchants.menu.findMerchantFunction"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"
保存菜单
"
)
@ApiOperation
(
"
查询功能列表
"
)
public
RopResponse
<
Pagination
<
FunctionResponse
>>
findMerchantFunction
(
FunctionListSearchRequest
functionListSearchRequest
)
{
public
RopResponse
<
Pagination
<
FunctionResponse
>>
findMerchantFunction
(
FunctionListSearchRequest
functionListSearchRequest
)
{
try
{
try
{
Pagination
<
FunctionResponse
>
listPagination
=
merchantFunctionService
.
findMerchantFunction
(
functionListSearchRequest
);
Pagination
<
FunctionResponse
>
listPagination
=
merchantFunctionService
.
findMerchantFunction
(
functionListSearchRequest
);
...
...
src/main/java/cn/com/glsx/merchants/convert/ConverResponse.java
View file @
86832a5
...
@@ -30,7 +30,7 @@ public class ConverResponse {
...
@@ -30,7 +30,7 @@ public class ConverResponse {
List
<
T
>
output
=
Lists
.
newArrayList
();
List
<
T
>
output
=
Lists
.
newArrayList
();
if
(
CollectionUtils
.
isNotEmpty
(
input
))
{
if
(
CollectionUtils
.
isNotEmpty
(
input
))
{
for
(
E
source
:
input
)
{
for
(
E
source
:
input
)
{
T
target
=
BeanUtils
.
instantiate
(
clzz
);
T
target
=
BeanUtils
.
instantiate
Class
(
clzz
);
BeanUtils
.
copyProperties
(
source
,
target
);
BeanUtils
.
copyProperties
(
source
,
target
);
output
.
add
(
target
);
output
.
add
(
target
);
}
}
...
...
src/main/java/cn/com/glsx/merchants/request/file/FileSearchRequest.java
0 → 100644
View file @
86832a5
package
cn
.
com
.
glsx
.
merchants
.
request
.
file
;
import
com.rop.AbstractRopRequest
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author Lichongyuan
* @version 1.0
* @description: ${todo}
* @date 2021/7/16 15:43
*/
@Data
public
class
FileSearchRequest
extends
AbstractRopRequest
implements
Serializable
{
/**
* 1.门店照片 2.菜单图片素材 3.头像
*/
@ApiModelProperty
(
notes
=
"文件类型"
)
@NotNull
private
Byte
fileType
;
/**
* 是否删除:0=正常,-1=删除
*/
@ApiModelProperty
(
notes
=
"删除标识"
)
@NotNull
private
Byte
delFlag
;
}
src/main/java/cn/com/glsx/merchants/request/function/FunctionSaveRequest.java
View file @
86832a5
...
@@ -38,7 +38,6 @@ public class FunctionSaveRequest extends AbstractRopRequest implements Serializa
...
@@ -38,7 +38,6 @@ public class FunctionSaveRequest extends AbstractRopRequest implements Serializa
* 功能值
* 功能值
*/
*/
@ApiModelProperty
(
notes
=
"功能值"
,
required
=
true
)
@ApiModelProperty
(
notes
=
"功能值"
,
required
=
true
)
@NotNull
private
String
functionValue
;
private
String
functionValue
;
/**
/**
...
@@ -64,7 +63,6 @@ public class FunctionSaveRequest extends AbstractRopRequest implements Serializa
...
@@ -64,7 +63,6 @@ public class FunctionSaveRequest extends AbstractRopRequest implements Serializa
* 排序
* 排序
*/
*/
@ApiModelProperty
(
notes
=
"排序"
,
required
=
true
)
@ApiModelProperty
(
notes
=
"排序"
,
required
=
true
)
@NotNull
private
Integer
sort
;
private
Integer
sort
;
/**
/**
...
...
src/main/java/cn/com/glsx/merchants/response/FileResponse.java
0 → 100644
View file @
86832a5
package
cn
.
com
.
glsx
.
merchants
.
response
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author Lichongyuan
* @version 1.0
* @description: ${todo}
* @date 2021/7/16 15:52
*/
@Data
public
class
FileResponse
{
@ApiModelProperty
(
name
=
"id"
,
notes
=
"文件id"
)
private
Integer
id
;
/**
* 图片路径
*/
@ApiModelProperty
(
name
=
"fileUrl"
,
notes
=
"图片路径"
)
private
String
fileUrl
;
/**
* 1.门店照片 2.菜单图片素材 3.头像
*/
@ApiModelProperty
(
name
=
"fileType"
,
notes
=
"文件类型"
)
private
Byte
fileType
;
/**
* 创建人
*/
@ApiModelProperty
(
name
=
"createdBy"
,
notes
=
"创建人"
)
private
Integer
createdBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
name
=
"createdTime"
,
notes
=
"创建时间"
)
private
Date
createdTime
;
/**
* 更新人
*/
@ApiModelProperty
(
name
=
"updatedBy"
,
notes
=
"更新人"
)
private
Integer
updatedBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
name
=
"updatedTime"
,
notes
=
"更新时间"
)
private
Date
updatedTime
;
/**
* 是否删除:0=正常,-1=删除
*/
@ApiModelProperty
(
name
=
"delFlag"
,
notes
=
"是否删除"
)
private
Byte
delFlag
;
/**
* 图片名称
*/
@ApiModelProperty
(
name
=
"fileName"
,
notes
=
"图片名称"
)
private
String
fileName
;
/**
* 业务id(商户id)/人员id
*/
@ApiModelProperty
(
name
=
"bussinessId"
,
notes
=
"业务id"
)
private
Integer
bussinessId
;
}
src/main/java/cn/com/glsx/merchants/service/MerchantFileService.java
0 → 100644
View file @
86832a5
package
cn
.
com
.
glsx
.
merchants
.
service
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.merchants.convert.ConverRequest
;
import
cn.com.glsx.merchants.convert.ConverResponse
;
import
cn.com.glsx.merchants.model.request.MerchantFileRequest
;
import
cn.com.glsx.merchants.model.response.MerchantFileResponse
;
import
cn.com.glsx.merchants.remote.MerchantFileRemote
;
import
cn.com.glsx.merchants.request.file.FileSearchRequest
;
import
cn.com.glsx.merchants.response.FileResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @author Lichongyuan
* @version 1.0
* @description: ${todo}
* @date 2021/7/16 15:30
*/
@Service
@Slf4j
public
class
MerchantFileService
{
@Autowired
private
MerchantFileRemote
merchantFileRemote
;
public
List
<
FileResponse
>
findMerchantFile
(
FileSearchRequest
fileSearchRequest
){
//入参集合转化
RpcResponse
<
List
<
MerchantFileResponse
>>
merchantFileRemoteRpc
=
merchantFileRemote
.
findMerchantFileRemote
(
ConverRequest
.
converRequest
(
fileSearchRequest
,
new
MerchantFileRequest
()));
//判断调用远程是否成功
if
(
merchantFileRemoteRpc
.
isSuccess
())
{
//出参集合转化
return
ConverResponse
.
convertList
(
merchantFileRemoteRpc
.
getResult
(),
FileResponse
.
class
);
}
//自定义异常信息
throw
new
RpcServiceException
(
merchantFileRemoteRpc
.
getException
().
getErrId
(),
merchantFileRemoteRpc
.
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