Commit 86af8538 authored by alex yao's avatar alex yao

feat: 上传简历添加重试

parent a8d76319
...@@ -34,6 +34,8 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema ...@@ -34,6 +34,8 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema
import cn.com.yict.framemax.core.exception.BusinessException; import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.data.model.PagingInfo; import cn.com.yict.framemax.data.model.PagingInfo;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -62,6 +64,7 @@ public class HumanResourceServiceImpl implements HumanResourceService { ...@@ -62,6 +64,7 @@ public class HumanResourceServiceImpl implements HumanResourceService {
private BizHumanResourceResumeService bizHumanResourceResumeService; private BizHumanResourceResumeService bizHumanResourceResumeService;
@Override @Override
@Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 1000, multiplier = 2))
public Resume uploadResume(String fileURL, Long positionId, Long userId) throws Exception { public Resume uploadResume(String fileURL, Long positionId, Long userId) throws Exception {
BizHumanResourcePositionEntity bizHumanResourcePositionEntity = bizHumanResourcePositionService.get(positionId); BizHumanResourcePositionEntity bizHumanResourcePositionEntity = bizHumanResourcePositionService.get(positionId);
...@@ -93,6 +96,9 @@ public class HumanResourceServiceImpl implements HumanResourceService { ...@@ -93,6 +96,9 @@ public class HumanResourceServiceImpl implements HumanResourceService {
throw new BusinessException("提取简历失败"); throw new BusinessException("提取简历失败");
} }
Resume resume = JsonUtils.deSerialize(response.getAnswer(), Resume.class); Resume resume = JsonUtils.deSerialize(response.getAnswer(), Resume.class);
if (resume == null){
throw new BusinessException("提取简历异常");
}
this.saveResume(userId, fileURL, positionId, resume); this.saveResume(userId, fileURL, positionId, resume);
return resume; return resume;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment