修改接口
This commit is contained in:
@@ -32,7 +32,7 @@ public class ToErpApiController {
|
|||||||
/**
|
/**
|
||||||
* 回传其他出入库单
|
* 回传其他出入库单
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedDelay = 1500)
|
// @Scheduled(fixedDelay = 1500)
|
||||||
public void callbackTransferBill() {
|
public void callbackTransferBill() {
|
||||||
toErpService.callbackTransferBill();
|
toErpService.callbackTransferBill();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,16 @@ public class RequestLogServiceImpl implements IRequestLogService
|
|||||||
requestLog.setRequestUrl(url);
|
requestLog.setRequestUrl(url);
|
||||||
try {
|
try {
|
||||||
String resStr = HttpUtil.post(url, param);
|
String resStr = HttpUtil.post(url, param);
|
||||||
|
|
||||||
|
// 判断resStr的状态码,如果不是200抛出异常让catch捕获
|
||||||
|
if (!JSONUtil.isJsonObj(resStr)) {
|
||||||
|
throw new RuntimeException("返回结果不是有效的JSON对象");
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(resStr);
|
||||||
|
Object codeObj = jsonObject.get("code");
|
||||||
|
if (codeObj == null || !codeObj.toString().equals("200")) {
|
||||||
|
throw new RuntimeException("请求失败,状态码: " + (codeObj != null ? codeObj.toString() : "null"));
|
||||||
|
}
|
||||||
requestLog.setResponseBody(resStr);
|
requestLog.setResponseBody(resStr);
|
||||||
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
||||||
requestLog.setResponseStatus("1");
|
requestLog.setResponseStatus("1");
|
||||||
|
|||||||
Reference in New Issue
Block a user