|
@ -5,16 +5,22 @@ import com.netflix.zuul.ZuulFilter;
|
|
|
import com.netflix.zuul.context.RequestContext;
|
|
|
import com.netflix.zuul.exception.ZuulException;
|
|
|
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
|
|
|
import com.yihu.jw.gateway.AesEncryptUtils;
|
|
|
import com.yihu.jw.gateway.methlog.BaseExceptionService;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
|
|
|
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
|
|
|
import com.yihu.jw.gateway.security.BeanUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StreamUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
import java.nio.charset.Charset;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@ -57,14 +63,23 @@ public class DidiFilterProcessor extends FilterProcessor {
|
|
|
responseCode=serviceId+list.get(0).get("code").toString();
|
|
|
exceptionType = list.get(0).get("exceptionType").toString();
|
|
|
}
|
|
|
ZuulException e1 = new ZuulException(message, StringUtils.isEmpty(responseCode)?99999999:Integer.valueOf(responseCode),cause);
|
|
|
ZuulException e1 = new ZuulException(message, StringUtils.isEmpty(responseCode)?99999999:Integer.parseInt(responseCode),cause);
|
|
|
BaseExceptionLogDO baseExceptionLogDO = new BaseExceptionLogDO();
|
|
|
baseExceptionLogDO.setCreateTime(new Date());
|
|
|
baseExceptionLogDO.setExceptionType(exceptionType);
|
|
|
baseExceptionLogDO.setServiceCode(serviceId);
|
|
|
baseExceptionLogDO.setExceptionCode(responseCode);
|
|
|
baseExceptionLogDO.setRequest(ctx.getRequest().toString());
|
|
|
baseExceptionLogDO.setResponse(ctx.toString());
|
|
|
try {
|
|
|
String in = ctx.getRequest().getParameter("object");
|
|
|
String jsonobject = AesEncryptUtils.decrypt(in);
|
|
|
baseExceptionLogDO.setRequest(jsonobject);
|
|
|
InputStream stream = RequestContext.getCurrentContext().getResponseDataStream();
|
|
|
byte[] bytes = StreamUtils.copyToByteArray(stream);
|
|
|
String resp = new String(bytes,"UTF8");
|
|
|
baseExceptionLogDO.setResponse(resp);
|
|
|
}catch (Exception s){
|
|
|
s.printStackTrace();
|
|
|
}
|
|
|
baseExceptionLogDao.save(baseExceptionLogDO);
|
|
|
ctx.set("failed.exception", e1);
|
|
|
ctx.set("failed.filter", filter);
|