|
@@ -2,6 +2,7 @@ package com.malk.minglei.controller;
|
|
|
|
|
|
|
|
import com.malk.minglei.dto.ReplyErpRequest;
|
|
import com.malk.minglei.dto.ReplyErpRequest;
|
|
|
import com.malk.minglei.service.port.ReplyErpService;
|
|
import com.malk.minglei.service.port.ReplyErpService;
|
|
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
@@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.client.RestClientException;
|
|
import org.springframework.web.client.RestClientException;
|
|
|
|
|
|
|
|
-import javax.validation.Valid;
|
|
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -47,7 +47,8 @@ public class ReplyErpController {
|
|
|
* @return ERP 接口原始响应内容
|
|
* @return ERP 接口原始响应内容
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/replyerp")
|
|
@PostMapping("/replyerp")
|
|
|
- public ResponseEntity<Map<String, Object>> replyErp(@Valid @RequestBody ReplyErpRequest request) {
|
|
|
|
|
|
|
+ public ResponseEntity<Map<String, Object>> replyErp(@RequestBody JsonNode requestBody) {
|
|
|
|
|
+ ReplyErpRequest request = ReplyErpRequest.from(requestBody);
|
|
|
return ResponseEntity.ok(replyErpService.replyErp(request));
|
|
return ResponseEntity.ok(replyErpService.replyErp(request));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -57,7 +58,8 @@ public class ReplyErpController {
|
|
|
* @param exception 请求处理异常
|
|
* @param exception 请求处理异常
|
|
|
* @return 参数错误响应
|
|
* @return 参数错误响应
|
|
|
*/
|
|
*/
|
|
|
- @ExceptionHandler({MethodArgumentNotValidException.class, HttpMessageNotReadableException.class})
|
|
|
|
|
|
|
+ @ExceptionHandler({MethodArgumentNotValidException.class, HttpMessageNotReadableException.class,
|
|
|
|
|
+ IllegalArgumentException.class})
|
|
|
public ResponseEntity<Map<String, String>> handleInvalidRequest(Exception exception) {
|
|
public ResponseEntity<Map<String, String>> handleInvalidRequest(Exception exception) {
|
|
|
return ResponseEntity.badRequest().body(Collections.singletonMap("message", "Request validation failed"));
|
|
return ResponseEntity.badRequest().body(Collections.singletonMap("message", "Request validation failed"));
|
|
|
}
|
|
}
|