Commit a358f739 by licy

菜单和功能的删除功能

1 parent a5ffa895
......@@ -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.function.FunctionDeleteRequest;
import cn.com.glsx.merchants.request.function.FunctionListSearchRequest;
import cn.com.glsx.merchants.request.function.FunctionSaveRequest;
import cn.com.glsx.merchants.request.function.FunctionUpdateRequest;
......@@ -84,4 +85,22 @@ public class MerchantFunctionController {
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 删除功能信息
*
* @param functionDeleteRequest
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.deleteMerchantFunction", needInSession = NeedInSessionType.NO)
@ApiOperation("删除功能信息")
public RopResponse<Boolean> deleteMerchantFunction(FunctionDeleteRequest functionDeleteRequest) {
try {
merchantFunctionService.deleteMerchantFunction(functionDeleteRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__deleteMerchantFunction__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}
......@@ -2,10 +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.menu.MenuListSearchRequest;
import cn.com.glsx.merchants.request.menu.MenuSaveRequest;
import cn.com.glsx.merchants.request.menu.MenuSearchRequest;
import cn.com.glsx.merchants.request.menu.MenuUpdateRequest;
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;
......@@ -40,14 +37,14 @@ public class MerchantMenuController {
* @param menuSearchRequest 入参
* @return 菜单树结构
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.findMerProMenuTreeRemote", needInSession = NeedInSessionType.NO)
@ServiceMethod(method = "cn.com.glsx.merchants.menu.findMerProMenuTree", needInSession = NeedInSessionType.NO)
@ApiOperation("查询菜单树")
public RopResponse<List<MenuResponse>> findMerProMenuTreeRemote(MenuSearchRequest menuSearchRequest) {
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__findMerProMenuTreeRemote__exception:{}", e.getMessage());
log.info("=======MerchantMenuController__invoke__findMerProMenuTree__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
......@@ -58,14 +55,14 @@ public class MerchantMenuController {
* @param menuSaveRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.saveMerchantProductMenuRemote", needInSession = NeedInSessionType.NO)
@ServiceMethod(method = "cn.com.glsx.merchants.menu.saveMerchantProductMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("保存菜单")
public RopResponse<Boolean> saveMerchantProductMenuRemote(MenuSaveRequest menuSaveRequest) {
public RopResponse<Boolean> saveMerchantProductMenu(MenuSaveRequest menuSaveRequest) {
try {
merchantMenuService.saveMerchantProductMenuRemote(menuSaveRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__saveMerchantProductMenuRemote__exception:{}", e.getMessage());
log.info("=======MerchantMenuController__invoke__saveMerchantProductMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
......@@ -76,14 +73,14 @@ public class MerchantMenuController {
* @param menuListSearchRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.findMerProMenuByPageRemote", needInSession = NeedInSessionType.NO)
@ServiceMethod(method = "cn.com.glsx.merchants.menu.findMerProMenuByPage", needInSession = NeedInSessionType.NO)
@ApiOperation("查询菜单列表")
public RopResponse<Pagination<MenuResponse>> findMerProMenuByPageRemote(MenuListSearchRequest menuListSearchRequest) {
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__findMerProMenuByPageRemote__exception:{}", e.getMessage());
log.info("=======MerchantMenuController__invoke__findMerProMenuByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
......@@ -94,14 +91,32 @@ public class MerchantMenuController {
* @param menuUpdateRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.menu.updateMerchantProductMenuRemote", needInSession = NeedInSessionType.NO)
@ServiceMethod(method = "cn.com.glsx.merchants.menu.updateMerchantProductMenu", needInSession = NeedInSessionType.NO)
@ApiOperation("更新菜单")
public RopResponse<Boolean> updateMerchantProductMenuRemote(MenuUpdateRequest menuUpdateRequest) {
public RopResponse<Boolean> updateMerchantProductMenu(MenuUpdateRequest menuUpdateRequest) {
try {
merchantMenuService.updateMerchantProductMenuRemote(menuUpdateRequest);
return RopResponse.success(true);
} catch (RpcServiceException e) {
log.info("=======MerchantMenuController__invoke__updateMerchantProductMenuRemote__exception:{}", e.getMessage());
log.info("=======MerchantMenuController__invoke__updateMerchantProductMenu__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 删除菜单
*
* @param menuDeleteRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.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());
}
}
......
package cn.com.glsx.merchants.request.function;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author Lichongyuan
* @Description: 功能删除入参
* @date 2021/7/29 16:56
*/
@Data
public class FunctionDeleteRequest extends AbstractRopRequest implements Serializable {
@ApiModelProperty(notes = "id", required = true)
@NotNull
private Integer id;
}
package cn.com.glsx.merchants.request.menu;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author Lichongyuan
* @Description: 菜单删除入参
* @date 2021/7/29 15:47
*/
@Data
public class MenuDeleteRequest extends AbstractRopRequest {
@ApiModelProperty(notes = "id", required = true)
@NotNull
private Integer id;
}
......@@ -11,6 +11,7 @@ import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantProductFunctionRequest;
import cn.com.glsx.merchants.model.response.MerchantProductFunctionResponse;
import cn.com.glsx.merchants.remote.MerchantProductFunctionRemote;
import cn.com.glsx.merchants.request.function.FunctionDeleteRequest;
import cn.com.glsx.merchants.request.function.FunctionListSearchRequest;
import cn.com.glsx.merchants.request.function.FunctionSaveRequest;
import cn.com.glsx.merchants.request.function.FunctionUpdateRequest;
......@@ -39,7 +40,7 @@ public class MerchantFunctionService {
public void saveMerchantFunction(FunctionSaveRequest functionSaveRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.saveMerchantProductFunctionRemote(ConvertRequest.convertRequest(functionSaveRequest, new MerchantProductFunctionRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
......@@ -47,7 +48,7 @@ public class MerchantFunctionService {
public void updateMerchantFunction(FunctionUpdateRequest functionUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.updateMerchantProductFunctionRemote(ConvertRequest.convertRequest(functionUpdateRequest, new MerchantProductFunctionRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
......@@ -56,6 +57,13 @@ public class MerchantFunctionService {
if (merProductByPageRemote.isSuccess()) {
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), FunctionResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(),merProductByPageRemote.getMessage());
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(), merProductByPageRemote.getMessage());
}
public void deleteMerchantFunction(FunctionDeleteRequest functionDeleteRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.deleteMerchantProductFunctionRemote(ConvertRequest.convertRequest(functionDeleteRequest, new MerchantProductFunctionRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
}
......@@ -8,10 +8,7 @@ import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantProductMenuRequest;
import cn.com.glsx.merchants.model.response.MerchantProductMenuResponse;
import cn.com.glsx.merchants.remote.MerchantProductMenuRemote;
import cn.com.glsx.merchants.request.menu.MenuListSearchRequest;
import cn.com.glsx.merchants.request.menu.MenuSaveRequest;
import cn.com.glsx.merchants.request.menu.MenuSearchRequest;
import cn.com.glsx.merchants.request.menu.MenuUpdateRequest;
import cn.com.glsx.merchants.request.menu.*;
import cn.com.glsx.merchants.response.MenuResponse;
import cn.com.glsx.merchants.util.Pagination;
import com.glsx.plat.common.annotation.SysLog;
......@@ -67,4 +64,12 @@ public class MerchantMenuService {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
@SysLog(value = "删除菜单", action = OperateType.DELETE, module = "菜单模块")
public void deleteMerchantProductMenuRemote(MenuDeleteRequest menuDeleteRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductMenuRemote.deleteMerchantProductMenuRemote(ConvertRequest.convertRequest(menuDeleteRequest, new MerchantProductMenuRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!