增加异常处理
continuous-integration/drone/push Build is passing Details

于相涌/mail
YXY 2 years ago
parent 02588501d5
commit f037698ede

@ -26,16 +26,18 @@ public class LarkApprovalHelper extends LarkHelper{
/**
*
*
* @return
*/
public GetInstanceRespBody getApprovalInfoDetail(LarkApprovalRequest request) {
try {
return buildClient(request).approval().instance().get(GetInstanceReq.newBuilder()
.instanceId(request.getInstanceId()).build()).getData();
GetInstanceResp getInstanceResp = buildClient(request).approval().instance().get(GetInstanceReq.newBuilder()
.instanceId(request.getInstanceId()).build());
if (getInstanceResp.getCode() == 0){
return getInstanceResp.getData();
}else {
throw new RuntimeException(getInstanceResp.getMsg());
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return null;
}
}

@ -25,7 +25,7 @@ public class LarkTableHelper extends LarkHelper{
public static void main(String[] args) throws Exception {
LarkTableHelper bk = new LarkTableHelper();
map.put("b", "aaa");
map.put("a", "aaa");
LarkTableRequest add = new LarkTableRequest(appId, secret, appToken, tableId,map);
CreateAppTableRecordRespBody createAppTableRecordRespBody = bk.addTableRecord(add);
String recordId = createAppTableRecordRespBody.getRecord().getRecordId();
@ -58,7 +58,7 @@ public class LarkTableHelper extends LarkHelper{
public CreateAppTableRecordRespBody addTableRecord(LarkTableRequest request) {
try {
return buildClient(request).bitable().appTableRecord()
CreateAppTableRecordResp createAppTableRecordResp = buildClient(request).bitable().appTableRecord()
.create(CreateAppTableRecordReq.newBuilder()
.appToken(request.getAppToken())
.tableId(request.getAppTable())
@ -66,7 +66,12 @@ public class LarkTableHelper extends LarkHelper{
AppTableRecord.newBuilder()
.fields(request.getBody())
.build())
.build()).getData();
.build());
if (createAppTableRecordResp.getCode() == 0){
return createAppTableRecordResp.getData();
}else {
throw new RuntimeException(createAppTableRecordResp.getMsg());
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
@ -74,13 +79,18 @@ public class LarkTableHelper extends LarkHelper{
public DeleteAppTableRecordRespBody deleteTableRecord(LarkTableRequest request) {
try {
return buildClient(request).bitable().appTableRecord().delete(
DeleteAppTableRecordResp delete = buildClient(request).bitable().appTableRecord().delete(
DeleteAppTableRecordReq.newBuilder()
.appToken(request.getAppToken())
.tableId(request.getAppTable())
.recordId(request.getRecord())
.build()
).getData();
);
if (delete.getCode() == 0){
return delete.getData();
}else {
throw new RuntimeException(delete.getMsg());
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
@ -88,7 +98,7 @@ public class LarkTableHelper extends LarkHelper{
public UpdateAppTableRecordRespBody updateTableRecord(LarkTableRequest request) {
try {
return buildClient(request).bitable().appTableRecord().update(
UpdateAppTableRecordResp update = buildClient(request).bitable().appTableRecord().update(
UpdateAppTableRecordReq.newBuilder()
.appToken(request.getAppToken())
.tableId(request.getAppTable())
@ -98,7 +108,12 @@ public class LarkTableHelper extends LarkHelper{
.fields(request.getBody())
.build()
).build()
).getData();
);
if (update.getCode() == 0){
return update.getData();
}else {
throw new RuntimeException(update.getMsg());
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}

Loading…
Cancel
Save