Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-12-15 09:58:10 +08:00
commit 408d3dde05
1 changed files with 15 additions and 1 deletions

View File

@ -15,6 +15,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
@ -39,6 +41,7 @@ import java.util.*;
@Api(tags = "网关统计")
@Log4j2
public class MonitorController {
private static final Logger logger = LoggerFactory.getLogger(MonitorController.class);
@Autowired
private RestTemplate restTemplate;
@ -151,9 +154,20 @@ public class MonitorController {
outputStream.write(buffer, 0, len);
len = inputStream.read(buffer);
}
outputStream.close();
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
log.error("网关接口异常", e);
response.setStatus(500);
try {
ServletOutputStream outputStream = response.getOutputStream();
outputStream.write("api error".getBytes());
outputStream.flush();
outputStream.close();
} catch (Exception exception) {
}
}
}