Advertisement
BoberDiversant

Untitled

Dec 5th, 2019
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1.     //было
  2. @PostMapping("create")
  3.     public @ResponseBody
  4.     String create(@RequestBody @Valid OutgoingCallTaskServiceLegacy.CreateCallTaskRequest request) {
  5.         return outgoingCallTaskService.create(request).getId();
  6.     }
  7.  
  8. //стало
  9.     @PostMapping("create")
  10.     public @ResponseBody
  11.     ResponseEntity<String> create(@RequestBody @Valid OutgoingCallTaskServiceLegacy.CreateCallTaskRequest request) {
  12.         ResponseEntity<String> responseEntity;
  13.         CallTaskController.CallTaskCreatedResponse response = outgoingCallTaskService.create(request);
  14.         if (response.getId() != null) {
  15.             responseEntity = new ResponseEntity<>(response.getId(), HttpStatus.OK);
  16.         } else {
  17.             responseEntity = new ResponseEntity<>(HttpStatus.BAD_REQUEST);
  18.         }
  19.         return responseEntity;
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement