MerchantMenuController.java
8.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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.enums.BusinessExceptionEnum;
import cn.com.glsx.merchants.request.menu.*;
import cn.com.glsx.merchants.response.MenuResponse;
import cn.com.glsx.merchants.service.MerchantMenuService;
import cn.com.glsx.merchants.util.Pagination;
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 zhouhaibao
* @version 1.0
* @description: 菜单模块
* @date 2021/7/12 9:47
*/
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("菜单接口")
@Slf4j
public class MerchantMenuController {
@Autowired
private MerchantMenuService merchantMenuService;
/**
* 查询菜单树
*
* @param menuSearchRequest 入参
* @return 菜单树结构
*/
@ServiceMethod(method = "merchants.api.menu.findMerProMenuTree", needInSession = NeedInSessionType.NO)
@ApiOperation("查询菜单树")
public RopResponse<List<MenuResponse>> findMerProMenuTree(MenuSearchRequest menuSearchRequest) {
try {
List<MenuResponse> menuResponseList = merchantMenuService.findMerProMenuTreeRemote(menuSearchRequest);
return RopResponse.success(menuResponseList);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__findMerProMenuTree__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 保存菜单
*
* @param menuSaveRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.menu.saveMerchantProductMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("保存菜单")
public RopResponse<Boolean> saveMerchantProductMenu(MenuSaveRequest menuSaveRequest) {
try {
merchantMenuService.saveMerchantProductMenuRemote(menuSaveRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__saveMerchantProductMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/*@ServiceMethod(method = "merchants.api.menu.buildMenuAndFunction", needInSession = NeedInSessionType.NO)
@ApiOperation("构建版本菜单")
public RopResponse<Boolean> buildMenuAndFunction(BuildMenuParam param){
try {
if(!"Thomas".equals(param.getParam())){
throw new RpcServiceException("FBI警告", "不要乱搞");
}
merchantMenuService.buildMenuAndFunction(param);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__buildMenuAndFunction__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}*/
/**
* 查询菜单列表
*
* @param menuListSearchRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.menu.findMerProMenuByPage", needInSession = NeedInSessionType.NO)
@ApiOperation("查询菜单列表")
public RopResponse<Pagination<MenuResponse>> findMerProMenuByPage(MenuListSearchRequest menuListSearchRequest) {
try {
Pagination<MenuResponse> list=merchantMenuService.findMerProMenuByPageRemote(menuListSearchRequest);
return RopResponse.success(list);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__findMerProMenuByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 更新菜单
*
* @param menuUpdateRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.menu.updateMerchantProductMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("更新菜单")
public RopResponse<Boolean> updateMerchantProductMenu(MenuUpdateRequest menuUpdateRequest) {
try {
merchantMenuService.updateMerchantProductMenuRemote(menuUpdateRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__updateMerchantProductMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 删除菜单
*
* @param menuDeleteRequest 入参
* @return
*/
@ServiceMethod(method = "merchants.api.menu.deleteMerchantProductMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("删除菜单")
public RopResponse<Boolean> deleteMerchantProductMenu(MenuDeleteRequest menuDeleteRequest) {
try {
merchantMenuService.deleteMerchantProductMenuRemote(menuDeleteRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__deleteMerchantProductMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.menu.rebuildVersionMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("构建版本菜单--根据生产json重构菜单和功能")
public RopResponse<Boolean> rebuildVersionMenu(BuildMenuParam param){
try {
merchantMenuService.rebuildVersionMenu(param);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__rebuildVersionMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.menu.buildVersionMenuFunctionNew", needInSession = NeedInSessionType.NO)
@ApiOperation("根据menuJson构建版本菜单-新增")
public RopResponse<Boolean> buildVersionMenuFunctionNew(BuildMenuParam param){
try {
merchantMenuService.buildVersionMenuFunctionNew(param);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__buildVersionMenuFunctionNew__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.menu.updateVersionMenuAndFunction", needInSession = NeedInSessionType.NO)
@ApiOperation("根据menuJson构建版本菜单-修改")
public RopResponse<Boolean> updateVersionMenuAndFunction(BuildMenuParam param){
try {
merchantMenuService.updateVersionMenuAndFunction(param);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__updateVersionMenuAndFunction__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
@ServiceMethod(method = "merchants.api.menu.deleteVersionMenuAndFunction", needInSession = NeedInSessionType.NO)
@ApiOperation("根据menuJson构建版本菜单-删除")
public RopResponse<Boolean> deleteVersionMenuAndFunction(BuildMenuParam param){
try {
merchantMenuService.deleteVersionMenuAndFunction(param);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__deleteVersionMenuAndFunction__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
}