标签:ticket _id success cat send error while ftp string
public String retryHeadPhoto(String orderNo, String appId, String signTicket, String applyNo) {
try {
// 重试3次, 或者拿到照片为止, 期间休眠2秒!
String photoId = null;
int times = FaceConst.MAX_RETRY; // MAX_RETRY=3
do {
// 1.第一次远程调用获取数据
String rscResult = fetchRemoteResource(orderNo, signTicket, appId);
ResourceResponse rscResp = JSONUtil.safeRead(rscResult, ResourceResponse.class);
// 1.1 提取请求中需要判断的核心数据
String headPhoto = rscResp.getResult().getHeadPhoto();
if (StringUtils.isNotBlank(headPhoto)) {
// 有效数据-上传处理
photoId = FtpHelper.uploadFileToFtp(headPhoto, applyNo, FtpHelper.PHOTO, "png"); // 上传至系统
}
times--; // 减少一次, 休眠2秒重试
if(StringUtils.isBlank(photoId)){
TimeUnit.SECONDS.sleep(FaceConst.GAP_SEC); // 间隔2秒
}
} while (times > 0 && StringUtils.isBlank(photoId));
return photoId;
} catch (Exception e) {
LOGGER.error("idcardImage_send_return_idcardrscResp_isNotSuccess, use original imageid:{}", idcardImageId, e);
}
return null;
}
标签:ticket _id success cat send error while ftp string
原文地址:http://blog.51cto.com/coffee/2325343