ActionInterceptor接口的作用
* 请求之前拦截器
*/
@Override
public ActionResult preExecute(BeatContext beat) {
try {
String customerCode = (String) beat.getRequest().getParameter(Constants.REQUEST_PARAMETER_CUSTOMERCODE);
//获取请求IP
String ip = IpUtil.getFirstIpAddr(beat);
if (StringUtils.isBlank(customerCode)) {
logger.error("customerCode为空");
CommonResultInfo result = new CommonResultInfo();
result.setSuccess(false);
result.setMessage(ConstantAPIEnum.COMMON_CUSTOMERCODE_BLANK_ERROR.getMessage());
result.setCode(ConstantAPIEnum.COMMON_CUSTOMERCODE_BLANK_ERROR.getCode());
//直接返回失败
return new JsonBeanResult(result);
}