fix: 限制调用未完成不能再次调用

hunan
huangfeng 4 months ago
parent 65842c1603
commit b4d7a88631

@ -87,11 +87,19 @@ public class TerminalPhotoController extends BaseController {
@RequestMapping("/getTakePicPhotoStatus")
@Log(title = "主动拍照下照片状态查询", type = "查询")
public ResponseReult<Boolean> getTakePicPhotoStatus( @Validated ReturnedPhotoVo vo) {
ServiceBody<Boolean> serviceBody = terminalPhotoService.getTakePicPhotoStatus(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
try {
if (workingMap.containsKey(vo.getRequestid())) {
throw new ApiException("相同请求正在处理中, 请刷新页面更新");
}
workingMap.put(vo.getRequestid(), "1");
ServiceBody<Boolean> serviceBody = terminalPhotoService.getTakePicPhotoStatus(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
} finally {
workingMap.remove(vo.getRequestid());
}
}

Loading…
Cancel
Save