Commit 402c078e by zhouhb

[+]代码提交

1 parent d6d9eaae
......@@ -286,4 +286,16 @@ public class OpenController {
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findBySapCode", needInSession = NeedInSessionType.NO)
@ApiOperation("根据sapCode查询商户")
public RopResponse<MerchantRopResponse> findBySapCode(OpenSapSearchRequest openSapSearchRequest) {
try {
MerchantRopResponse openUserResponse = openService.findBySapCode(openSapSearchRequest);
return RopResponse.success(openUserResponse);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findBySapCode__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}
......@@ -65,6 +65,9 @@ public class ConvertResponse {
* @return
*/
public static <T> T convertObject(Object object, Class<T> clazz) {
if(object==null){
return null;
}
T target = BeanUtils.instantiateClass(clazz);
BeanUtils.copyProperties(object, target);
return target;
......
package cn.com.glsx.merchants.request.open;
import cn.com.glsx.merchants.request.DefaultRequest;
import lombok.Data;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/10/14 20:43
*/
@Data
public class OpenSapSearchRequest extends DefaultRequest {
private String sapCode;
}
......@@ -224,4 +224,12 @@ public class OpenService {
}
throw new RpcServiceException(merchantUserResponseRpcResponse.getException().getErrId(), merchantUserResponseRpcResponse.getMessage());
}
public MerchantRopResponse findBySapCode(OpenSapSearchRequest openSapSearchRequest) {
RpcResponse<MerchantResponse> bySapCode = merchantRemote.findBySapCode(openSapSearchRequest.getSapCode());
if (bySapCode.isSuccess()) {
return ConvertResponse.convertObject(bySapCode.getResult(), MerchantRopResponse.class);
}
throw new RpcServiceException(bySapCode.getException().getErrId(), bySapCode.getMessage());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!