回调测试完成

于相涌/mail
YXY 2 years ago committed by bob
parent 5aec9eb139
commit 35279bd315

@ -32,6 +32,7 @@ public abstract class LarkOperateAbstract{
}else { }else {
request.setErrorMessage(message); request.setErrorMessage(message);
} }
}finally { }finally {
//业务处理完成后的系列操作,例如日志 //业务处理完成后的系列操作,例如日志
endHandle(request); endHandle(request);

@ -109,6 +109,10 @@ public class ApprovalCallbackOperate extends LarkAbstract {
request.setAppSecret(relation.getSecret()); request.setAppSecret(relation.getSecret());
LarkApprovalRequest detailRequest = new LarkApprovalRequest(request.getAppId(), request.getAppSecret(), event.getRecordId()); LarkApprovalRequest detailRequest = new LarkApprovalRequest(request.getAppId(), request.getAppSecret(), event.getRecordId());
GetInstanceRespBody approvalInfoDetail = larkApprovalHelper.getApprovalInfoDetail(detailRequest); GetInstanceRespBody approvalInfoDetail = larkApprovalHelper.getApprovalInfoDetail(detailRequest);
JSONArray objects = JSONArray.parseArray(approvalInfoDetail.getForm());
if (objects.size() == 1){
return;
}
request.setInstanceRespBody(approvalInfoDetail); request.setInstanceRespBody(approvalInfoDetail);
String approvalName = approvalInfoDetail.getApprovalName(); String approvalName = approvalInfoDetail.getApprovalName();
request.setApproveName(approvalName); request.setApproveName(approvalName);
@ -119,7 +123,9 @@ public class ApprovalCallbackOperate extends LarkAbstract {
@Override @Override
protected void businessProcessing(RequestVo request) { protected void businessProcessing(RequestVo request) {
if (request.getInstanceRespBody() == null){
return;
}
for (Map.Entry<String, Long> entry : request.getTableRelationMap().entrySet()) { for (Map.Entry<String, Long> entry : request.getTableRelationMap().entrySet()) {
String[] arr = entry.getKey().split("_"); String[] arr = entry.getKey().split("_");
request.setToAppToken(arr[0]); request.setToAppToken(arr[0]);
@ -173,10 +179,10 @@ public class ApprovalCallbackOperate extends LarkAbstract {
list.add(String.valueOf(object)); list.add(String.valueOf(object));
} else { } else {
List<String> keyList = new ArrayList<>(); List<String> keyList = new ArrayList<>();
for (int j = index+1; j < split.length; j++) { for (int j = index + 1; j < split.length; j++) {
keyList.add(split[j]); keyList.add(split[j]);
} }
Object o = recursiveValue(jsonArray.getJSONObject(i), String.join(",",keyList)); Object o = recursiveValue(jsonArray.getJSONObject(i), String.join(",", keyList));
list.add(String.valueOf(o)); list.add(String.valueOf(o));
} }
} }
@ -207,9 +213,7 @@ public class ApprovalCallbackOperate extends LarkAbstract {
eventLog = new EventLog(event.getId(), request.getApproveName(), request.getMessage()); eventLog = new EventLog(event.getId(), request.getApproveName(), request.getMessage());
} else { } else {
eventService.updateStatus(event.getId(), EventOperateStatus.PENDING.getCode(), event.getNumbers() + 1); eventService.updateStatus(event.getId(), EventOperateStatus.PENDING.getCode(), event.getNumbers() + 1);
if (request.getEventOperateType() != null) { eventLog = new EventLog(event.getId(), request.getApproveName(), request.getMessage(), request.getErrorCode(), request.getErrorMessage());
new EventLog(event.getId(), request.getApproveName(), request.getMessage(), request.getErrorCode(), request.getErrorMessage());
}
} }
if (eventLog != null) { if (eventLog != null) {
eventLog.setOperateInfo(request.getOperateInfo()); eventLog.setOperateInfo(request.getOperateInfo());

Loading…
Cancel
Save