Commit 412062d2 by wangnb

账户体系账户类型接口编写--think.wang

1 parent 47086d52
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.example.LoginRequest;
import cn.com.glsx.merchants.response.LoginResponse;
import cn.com.glsx.merchants.model.response.MerchantAccountTypeResponse;
import cn.com.glsx.merchants.request.accounttype.AccountTypeDeleteRequest;
import cn.com.glsx.merchants.request.accounttype.AccountTypeListSearchRequest;
import cn.com.glsx.merchants.request.accounttype.AccountTypeSearchRequest;
import cn.com.glsx.merchants.service.MerchantAccountTypeService;
import cn.com.glsx.merchants.util.Pagination;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
......@@ -12,6 +16,8 @@ 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
......@@ -27,14 +33,71 @@ public class MerchantAccountTypeController {
private MerchantAccountTypeService accountTypeService;
/**
* 账户类型获取列表接口
*
* @param request
* @return
*/
@ServiceMethod(method = "org.ore.api.account.list", needInSession = NeedInSessionType.YES)
@ServiceMethod(method = "org.ore.api.accountType.list", needInSession = NeedInSessionType.YES)
@ApiOperation("账户类型获取列表接口")
public RopResponse<LoginResponse> getAccountList(LoginRequest request) {
return RopResponse.success(null);
public RopResponse<List<MerchantAccountTypeResponse>> getAccountTypeList(AccountTypeListSearchRequest request) {
try {
return RopResponse.success(accountTypeService.getAccountTypeList(request));
} catch (RpcServiceException e) {
log.info("=======MerchantAccountTypeController__invoke__getAccountTypeList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 账户类型获取分页数据接口
*
* @param request
* @return
*/
@ServiceMethod(method = "org.ore.api.accountType.page", needInSession = NeedInSessionType.YES)
@ApiOperation("账户类型获取分页数据接口")
public RopResponse<Pagination<MerchantAccountTypeResponse>> getAccountTypePage(AccountTypeListSearchRequest request) {
try {
return RopResponse.success(accountTypeService.getAccountTypePage(request));
} catch (RpcServiceException e) {
log.info("=======MerchantAccountTypeController__invoke__getAccountTypePage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 根据id获取账户类型接口
*
* @param request
* @return
*/
@ServiceMethod(method = "org.ore.api.accountType.getById", needInSession = NeedInSessionType.YES)
@ApiOperation("根据id获取账户类型接口")
public RopResponse<MerchantAccountTypeResponse> getById(AccountTypeSearchRequest request) {
try {
return RopResponse.success(accountTypeService.getAccountTypeDetail(request.getId()));
} catch (RpcServiceException e) {
log.info("=======MerchantAccountTypeController__invoke__getById__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
/**
* 根据id获取账户类型接口
*
* @param request
* @return
*/
@ServiceMethod(method = "org.ore.api.accountType.deleteById", needInSession = NeedInSessionType.YES)
@ApiOperation("根据id获取账户类型接口")
public RopResponse<Boolean> deleteById(AccountTypeDeleteRequest request) {
try {
return RopResponse.success(accountTypeService.delete(request));
} catch (RpcServiceException e) {
log.info("=======MerchantAccountTypeController__invoke__deleteById__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
}
......@@ -9,7 +9,7 @@ import org.springframework.beans.BeanUtils;
* @description: 请求体转化
* @date 2021/7/9 11:38
*/
public class ConverRequest {
public class ConvertRequest {
/**
* 转化请求参数
......@@ -32,7 +32,7 @@ public class ConverRequest {
* @param <T> 泛型
* @return
*/
public static <T> RpcPagination<T> converPage(Object old, T t){
public static <T> RpcPagination<T> convertPage(Object old, T t){
RpcPagination rpcPagination=new RpcPagination();
BeanUtils.copyProperties(old, rpcPagination);
BeanUtils.copyProperties(old, t);
......
......@@ -16,21 +16,21 @@ import java.util.List;
* @date 2021/7/9 11:21
*/
@Data
public class ConverResponse {
public class ConvertResponse {
/**
* 转化集合
*
* @param input 原集合
* @param clzz 新集合类
* @param clazz 新集合类
* @param <T> 泛型
* @return
*/
public static <E, T> List<T> convertList(List<E> input, Class<T> clzz) {
public static <E, T> List<T> convertList(List<E> input, Class<T> clazz) {
List<T> output = Lists.newArrayList();
if (CollectionUtils.isNotEmpty(input)) {
for (E source : input) {
T target = BeanUtils.instantiateClass(clzz);
T target = BeanUtils.instantiateClass(clazz);
BeanUtils.copyProperties(source, target);
output.add(target);
}
......@@ -45,11 +45,11 @@ public class ConverResponse {
* @param list 原集合
* @return 新分页参数
*/
public static <E,T> Pagination<T> converPage(RpcPagination<E> list, Class<T> clazz) {
public static <E,T> Pagination<T> convertPage(RpcPagination<E> list, Class<T> clazz) {
Pagination pagination = new Pagination();
pagination.setPageCount(list.getPageNum());
List<T> newlist = convertList(list.getList(), clazz);
pagination.setData(newlist);
List<T> newList = convertList(list.getList(), clazz);
pagination.setData(newList);
pagination.setTotalCount((int) list.getTotal());
pagination.setPageSize(list.getPageSize());
return pagination;
......
......@@ -16,11 +16,11 @@ public class AccountTypeListSearchRequest extends AbstractRopRequest {
private String accounttypeName;
@NotNull
@ApiModelProperty(notes = "分页数", required = true)
@ApiModelProperty(notes = "分页数")
private Integer pageSize;
@NotNull
@ApiModelProperty(notes = "当前页", required = true)
private Integer pageNumber;
@ApiModelProperty(notes = "当前页")
private Integer pageNum;
}
\ No newline at end of file
......@@ -22,11 +22,11 @@ public class RoleListSearchRequest extends AbstractRopRequest {
private Integer merchantId;
@NotNull
@ApiModelProperty(notes = "分页数", required = true)
@ApiModelProperty(notes = "分页数")
private Integer pageSize;
@NotNull
@ApiModelProperty(notes = "当前页", required = true)
@ApiModelProperty(notes = "当前页")
private Integer pageNumber;
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ 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.contants.Contants;
import cn.com.glsx.merchants.convert.ConverRequest;
import cn.com.glsx.merchants.model.request.MerchantUserRequest;
import cn.com.glsx.merchants.model.response.MerchantUserResponse;
import cn.com.glsx.merchants.remote.MerchantUserRemote;
......
package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantAccountTypeRequest;
import cn.com.glsx.merchants.model.response.MerchantAccountTypeResponse;
import cn.com.glsx.merchants.remote.MerchantAccountTypeRemote;
import cn.com.glsx.merchants.request.accounttype.AccountTypeDeleteRequest;
import cn.com.glsx.merchants.request.accounttype.AccountTypeListSearchRequest;
import cn.com.glsx.merchants.util.Pagination;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhouhaibao
......@@ -19,18 +29,70 @@ import javax.annotation.Resource;
public class MerchantAccountTypeService {
@Resource
private MerchantAccountTypeRemote merchantAccountTypeRemote;
private MerchantAccountTypeRemote accountTypeRemote;
/**
* 获取账户类型详情
* id获取账户类型详情
*
* @param id
* @return
*/
public RpcResponse<MerchantAccountTypeResponse> getAccountTypeDetail(Integer id) {
//获取主表数据
RpcResponse<MerchantAccountTypeResponse> response = merchantAccountTypeRemote.getByIdRemote(id);
return response;
public MerchantAccountTypeResponse getAccountTypeDetail(Integer id) {
RpcResponse<MerchantAccountTypeResponse> response = accountTypeRemote.getByIdRemote(id);
if(response.isSuccess()){
return response.getResult();
}
throw new RpcServiceException(response.getException().getErrId(),response.getMessage());
}
/**
* 获取账户类型分页数据
*
* @param request
* @return
*/
public Pagination<MerchantAccountTypeResponse> getAccountTypePage(AccountTypeListSearchRequest request) {
RpcPagination<MerchantAccountTypeRequest> pagination =
ConvertRequest.convertPage(request, new MerchantAccountTypeRequest());
RpcResponse<RpcPagination<MerchantAccountTypeResponse>> response =
accountTypeRemote.getAccountTypePageRemote(pagination);
if(response.isSuccess()){
return ConvertResponse.convertPage(response.getResult(), MerchantAccountTypeResponse.class);
}
throw new RpcServiceException(response.getException().getErrId(),response.getMessage());
}
/**
* 获取账户类型数据列表
*
* @param request
* @return
*/
public List<MerchantAccountTypeResponse> getAccountTypeList(AccountTypeListSearchRequest request) {
MerchantAccountTypeRequest typeRequest = new MerchantAccountTypeRequest();
typeRequest.setAccounttypeName(request.getAccounttypeName());
RpcResponse<List<MerchantAccountTypeResponse>> response =
accountTypeRemote.getAccountTypeListRemote(typeRequest);
if(response.isSuccess()){
return response.getResult();
}
throw new RpcServiceException(response.getException().getErrId(),response.getMessage());
}
/**
* id删除账户类型
*
* @param request
* @return
*/
public Boolean delete(AccountTypeDeleteRequest request) {
MerchantAccountTypeRequest typeRequest = new MerchantAccountTypeRequest();
BeanUtils.copyProperties(request, typeRequest);
RpcResponse<Boolean> response = accountTypeRemote.deleteRemote(typeRequest);
if(response.isSuccess()){
return response.getResult();
}
throw new RpcServiceException(response.getException().getErrId(),response.getMessage());
}
}
......@@ -3,8 +3,8 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantDictDataRequest;
import cn.com.glsx.merchants.model.response.MerchantDictDataResponse;
import cn.com.glsx.merchants.remote.MerchantDictDataRemote;
......@@ -34,38 +34,38 @@ public class MerchantDictDataService {
private MerchantUserService merchantUserService;
public void saveDictData(DictDataSaveRequest dictDataSaveRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.saveMerchantDictDataRemote(ConverRequest.converRequest(dictDataSaveRequest, new MerchantDictDataRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.saveMerchantDictDataRemote(ConvertRequest.converRequest(dictDataSaveRequest, new MerchantDictDataRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public void updateDictData(DictDataUpdateRequest DictDataUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.updateMerchantDictDataRemote(ConverRequest.converRequest(DictDataUpdateRequest, new MerchantDictDataRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.updateMerchantDictDataRemote(ConvertRequest.converRequest(DictDataUpdateRequest, new MerchantDictDataRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public Pagination<DictDataResponse> findDictData(DictDataListSearchRequest DictDataListSearchRequest) {
RpcResponse<RpcPagination<MerchantDictDataResponse>> merProductByPageRemote = merchantDictDataRemote.findMerchantDictDataRemote(ConverRequest.converPage(DictDataListSearchRequest, new MerchantDictDataRequest()));
RpcResponse<RpcPagination<MerchantDictDataResponse>> merProductByPageRemote = merchantDictDataRemote.findMerchantDictDataRemote(ConvertRequest.convertPage(DictDataListSearchRequest, new MerchantDictDataRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), DictDataResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), DictDataResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(), merProductByPageRemote.getMessage());
}
public void deleteDictData(DictDataDeleteRequest DictDataDeleteRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.deleteMerchantDictDataRemote(ConverRequest.converRequest(DictDataDeleteRequest, new MerchantDictDataRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictDataRemote.deleteMerchantDictDataRemote(ConvertRequest.converRequest(DictDataDeleteRequest, new MerchantDictDataRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public List<DictDataResponse> findAllDictData(DictDataSearchRequest dictDataSearchRequest) {
RpcResponse<List<MerchantDictDataResponse>> merProductByPageRemote = merchantDictDataRemote.findAllRemote(ConverRequest.converRequest(dictDataSearchRequest, new MerchantDictDataRequest()));
RpcResponse<List<MerchantDictDataResponse>> merProductByPageRemote = merchantDictDataRemote.findAllRemote(ConvertRequest.converRequest(dictDataSearchRequest, new MerchantDictDataRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.convertList(merProductByPageRemote.getResult(), DictDataResponse.class);
return ConvertResponse.convertList(merProductByPageRemote.getResult(), DictDataResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(), merProductByPageRemote.getMessage());
}
......
......@@ -3,10 +3,9 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantDictTypeRequest;
import cn.com.glsx.merchants.model.request.MerchantProductMenuRequest;
import cn.com.glsx.merchants.model.response.MerchantDictTypeResponse;
import cn.com.glsx.merchants.remote.MerchantDictTypeRemote;
import cn.com.glsx.merchants.request.dicttype.DictTypeDeleteRequest;
......@@ -40,29 +39,29 @@ public class MerchantDictTypeService {
@SysLog(value = "新增字典类型", action = OperateType.ADD,module = "字典类型管理")
public void saveDictType(DictTypeSaveRequest dictTypeSaveRequest) {
merchantUserService.setUser(dictTypeSaveRequest);
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.saveMerchantDictTypeRemote(ConverRequest.converRequest(dictTypeSaveRequest, new MerchantDictTypeRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.saveMerchantDictTypeRemote(ConvertRequest.converRequest(dictTypeSaveRequest, new MerchantDictTypeRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public void updateDictType(DictTypeUpdateRequest dictTypeUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.updateMerchantDictTypeRemote(ConverRequest.converRequest(dictTypeUpdateRequest, new MerchantDictTypeRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.updateMerchantDictTypeRemote(ConvertRequest.converRequest(dictTypeUpdateRequest, new MerchantDictTypeRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public Pagination<DictTypeResponse> findDictType(DictTypeListSearchRequest dictTypeListSearchRequest) {
RpcResponse<RpcPagination<MerchantDictTypeResponse>> merProductByPageRemote = merchantDictTypeRemote.findMerchantDictTypeRemote(ConverRequest.converPage(dictTypeListSearchRequest, new MerchantDictTypeRequest()));
RpcResponse<RpcPagination<MerchantDictTypeResponse>> merProductByPageRemote = merchantDictTypeRemote.findMerchantDictTypeRemote(ConvertRequest.convertPage(dictTypeListSearchRequest, new MerchantDictTypeRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), DictTypeResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), DictTypeResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(), merProductByPageRemote.getMessage());
}
public void deleteDictType(DictTypeDeleteRequest dictTypeDeleteRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.deleteMerchantDictTypeRemote(ConverRequest.converRequest(dictTypeDeleteRequest, new MerchantDictTypeRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantDictTypeRemote.deleteMerchantDictTypeRemote(ConvertRequest.converRequest(dictTypeDeleteRequest, new MerchantDictTypeRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
......
......@@ -2,8 +2,8 @@ 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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantFileRequest;
import cn.com.glsx.merchants.model.response.MerchantFileResponse;
import cn.com.glsx.merchants.remote.MerchantFileRemote;
......@@ -30,11 +30,11 @@ public class MerchantFileService {
public List<FileResponse> findMerchantFile(FileSearchRequest fileSearchRequest){
//入参集合转化
RpcResponse<List<MerchantFileResponse>> merchantFileRemoteRpc =
merchantFileRemote.findMerchantFileRemote(ConverRequest.converRequest(fileSearchRequest, new MerchantFileRequest()));
merchantFileRemote.findMerchantFileRemote(ConvertRequest.converRequest(fileSearchRequest, new MerchantFileRequest()));
//判断调用远程是否成功
if (merchantFileRemoteRpc.isSuccess()) {
//出参集合转化
return ConverResponse.convertList(merchantFileRemoteRpc.getResult(), FileResponse.class);
return ConvertResponse.convertList(merchantFileRemoteRpc.getResult(), FileResponse.class);
}
//自定义异常信息
throw new RpcServiceException(merchantFileRemoteRpc.getException().getErrId(), merchantFileRemoteRpc.getMessage());
......
......@@ -6,8 +6,8 @@ package cn.com.glsx.merchants.service;/**
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
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;
......@@ -34,23 +34,23 @@ public class MerchantFunctionService {
private MerchantProductFunctionRemote merchantProductFunctionRemote;
public void saveMerchantFunction(FunctionSaveRequest functionSaveRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.saveMerchantProductFunctionRemote(ConverRequest.converRequest(functionSaveRequest, new MerchantProductFunctionRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.saveMerchantProductFunctionRemote(ConvertRequest.converRequest(functionSaveRequest, new MerchantProductFunctionRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
public void updateMerchantFunction(FunctionUpdateRequest functionUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.updateMerchantProductFunctionRemote(ConverRequest.converRequest(functionUpdateRequest, new MerchantProductFunctionRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductFunctionRemote.updateMerchantProductFunctionRemote(ConvertRequest.converRequest(functionUpdateRequest, new MerchantProductFunctionRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
public Pagination<FunctionResponse> findMerchantFunction(FunctionListSearchRequest functionListSearchRequest) {
RpcResponse<RpcPagination<MerchantProductFunctionResponse>> merProductByPageRemote = merchantProductFunctionRemote.findMerProFunctionByPageRemote(ConverRequest.converPage(functionListSearchRequest, new MerchantProductFunctionRequest()));
RpcResponse<RpcPagination<MerchantProductFunctionResponse>> merProductByPageRemote = merchantProductFunctionRemote.findMerProFunctionByPageRemote(ConvertRequest.convertPage(functionListSearchRequest, new MerchantProductFunctionRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), FunctionResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), FunctionResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(),merProductByPageRemote.getMessage());
}
......
......@@ -3,8 +3,8 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantLogRequest;
import cn.com.glsx.merchants.model.response.MerchantLogResponse;
import cn.com.glsx.merchants.remote.MerchantLogRemote;
......@@ -30,7 +30,7 @@ public class MerchantLogService {
private MerchantLogRemote merchantLogRemote;
public MerchantLogResponse saveMerchantLog(LogRequest logRequest) {
RpcResponse<MerchantLogResponse> booleanRpcResponse = merchantLogRemote.saveMerchantLogRemote(ConverRequest.converRequest(logRequest, new MerchantLogRequest()));
RpcResponse<MerchantLogResponse> booleanRpcResponse = merchantLogRemote.saveMerchantLogRemote(ConvertRequest.converRequest(logRequest, new MerchantLogRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
} else {
......@@ -39,16 +39,16 @@ public class MerchantLogService {
}
public void updateMerchantLog(LogRequest logRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantLogRemote.updateMerchantLogRemote(ConverRequest.converRequest(logRequest, new MerchantLogRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantLogRemote.updateMerchantLogRemote(ConvertRequest.converRequest(logRequest, new MerchantLogRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(), booleanRpcResponse.getMessage());
}
}
public Pagination<LogResponse> findLog(LogSearchRequest logSearchRequest) {
RpcResponse<RpcPagination<MerchantLogResponse>> merProductByPageRemote = merchantLogRemote.findMerchantLogRemote(ConverRequest.converPage(logSearchRequest, new MerchantLogRequest()));
RpcResponse<RpcPagination<MerchantLogResponse>> merProductByPageRemote = merchantLogRemote.findMerchantLogRemote(ConvertRequest.convertPage(logSearchRequest, new MerchantLogRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), LogResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), LogResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(), merProductByPageRemote.getMessage());
}
......
......@@ -3,19 +3,16 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantProductMenuRequest;
import cn.com.glsx.merchants.model.request.MerchantProductRequest;
import cn.com.glsx.merchants.model.response.MerchantProductMenuResponse;
import cn.com.glsx.merchants.model.response.MerchantProductResponse;
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.response.MenuResponse;
import cn.com.glsx.merchants.response.ProductResponse;
import cn.com.glsx.merchants.util.Pagination;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,31 +34,31 @@ public class MerchantMenuService {
private MerchantProductMenuRemote merchantProductMenuRemote;
public List<MenuResponse> findMerProMenuTreeRemote(MenuSearchRequest menuSearchRequest) {
RpcResponse<List<MerchantProductMenuResponse>> merProMenuTreeRemote = merchantProductMenuRemote.findMerProMenuTreeRemote(ConverRequest.converRequest(menuSearchRequest, new MerchantProductMenuRequest()));
RpcResponse<List<MerchantProductMenuResponse>> merProMenuTreeRemote = merchantProductMenuRemote.findMerProMenuTreeRemote(ConvertRequest.converRequest(menuSearchRequest, new MerchantProductMenuRequest()));
if (merProMenuTreeRemote.isSuccess()) {
List<MenuResponse> menuResponseList = ConverResponse.convertList(merProMenuTreeRemote.getResult(), MenuResponse.class);
List<MenuResponse> menuResponseList = ConvertResponse.convertList(merProMenuTreeRemote.getResult(), MenuResponse.class);
return menuResponseList;
}
throw new RpcServiceException(merProMenuTreeRemote.getException().getErrId(),merProMenuTreeRemote.getMessage());
}
public void saveMerchantProductMenuRemote(MenuSaveRequest menuSaveRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductMenuRemote.saveMerchantProductMenuRemote(ConverRequest.converRequest(menuSaveRequest, new MerchantProductMenuRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductMenuRemote.saveMerchantProductMenuRemote(ConvertRequest.converRequest(menuSaveRequest, new MerchantProductMenuRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
public Pagination<MenuResponse> findMerProMenuByPageRemote(MenuListSearchRequest menuListSearchRequest) {
RpcResponse<RpcPagination<MerchantProductMenuResponse>> merProductByPageRemote = merchantProductMenuRemote.findMerProMenuByPageRemote(ConverRequest.converPage(menuListSearchRequest, new MerchantProductMenuRequest()));
RpcResponse<RpcPagination<MerchantProductMenuResponse>> merProductByPageRemote = merchantProductMenuRemote.findMerProMenuByPageRemote(ConvertRequest.convertPage(menuListSearchRequest, new MerchantProductMenuRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), MenuResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), MenuResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(),merProductByPageRemote.getMessage());
}
public void updateMerchantProductMenuRemote(MenuUpdateRequest menuUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductMenuRemote.updateMerchantProductMenuRemote(ConverRequest.converRequest(menuUpdateRequest, new MerchantProductMenuRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductMenuRemote.updateMerchantProductMenuRemote(ConvertRequest.converRequest(menuUpdateRequest, new MerchantProductMenuRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
......
......@@ -3,8 +3,8 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
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.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.model.request.MerchantProductRequest;
import cn.com.glsx.merchants.model.response.MerchantProductResponse;
import cn.com.glsx.merchants.remote.MerchantProductRemote;
......@@ -14,7 +14,6 @@ import cn.com.glsx.merchants.request.product.ProductUpdateRequest;
import cn.com.glsx.merchants.response.ProductResponse;
import cn.com.glsx.merchants.util.Pagination;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,29 +35,29 @@ public class MerchantProductService {
public List<ProductResponse> findProduct() {
RpcResponse<List<MerchantProductResponse>> merProductListRemote = merchantProductRemote.findMerProductListRemote();
if (merProductListRemote.isSuccess()) {
List<ProductResponse> productResponses = ConverResponse.convertList(merProductListRemote.getResult(), ProductResponse.class);
List<ProductResponse> productResponses = ConvertResponse.convertList(merProductListRemote.getResult(), ProductResponse.class);
return productResponses;
}
throw new RpcServiceException(merProductListRemote.getException().getErrId(),merProductListRemote.getMessage());
}
public void saveProduct(ProductSaveRequest productSearchRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductRemote.saveMerchantProductRemote(ConverRequest.converRequest(productSearchRequest, new MerchantProductRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductRemote.saveMerchantProductRemote(ConvertRequest.converRequest(productSearchRequest, new MerchantProductRequest()));
if (booleanRpcResponse.isFailed()) {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
}
}
public Pagination<ProductResponse> findProductByPage(ProductSearchRequest productSearchRequest) {
RpcResponse<RpcPagination<MerchantProductResponse>> merProductByPageRemote = merchantProductRemote.findMerProductByPageRemote(ConverRequest.converPage(productSearchRequest,new MerchantProductRequest()));
RpcResponse<RpcPagination<MerchantProductResponse>> merProductByPageRemote = merchantProductRemote.findMerProductByPageRemote(ConvertRequest.convertPage(productSearchRequest,new MerchantProductRequest()));
if (merProductByPageRemote.isSuccess()) {
return ConverResponse.converPage(merProductByPageRemote.getResult(), ProductResponse.class);
return ConvertResponse.convertPage(merProductByPageRemote.getResult(), ProductResponse.class);
}
throw new RpcServiceException(merProductByPageRemote.getException().getErrId(),merProductByPageRemote.getMessage());
}
public void updateProduct(ProductUpdateRequest productUpdateRequest) {
RpcResponse<Boolean> booleanRpcResponse = merchantProductRemote.updateProductRemote(ConverRequest.converRequest(productUpdateRequest, new MerchantProductRequest()));
RpcResponse<Boolean> booleanRpcResponse = merchantProductRemote.updateProductRemote(ConvertRequest.converRequest(productUpdateRequest, new MerchantProductRequest()));
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!