Commit f7cd1142 by 袁伟铭

1.0.0

parent e3b3c416
......@@ -4,7 +4,6 @@ import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zq.api.constant.ApiCodeEnum;
import com.zq.api.form.ApiForm;
import com.zq.api.form.ApiResp;
......@@ -44,10 +43,7 @@ public class ApiController {
long start = System.currentTimeMillis();
ApiForm form = ServletUtil.toBean(request, ApiForm.class, true);
try {
JSONObject jsonObject = JSON.parseObject(form.getBizContent());
form.setBizContentJson(jsonObject);
} catch (Exception e) {
if (!form.parseBizContent()) {
return ApiUtils.getParamError(form);
}
......
......@@ -41,16 +41,26 @@ public class ApiForm {
private JSONObject bizContentJson; // 请求业务的json对象
private ApiTokenVo apiTokenVo;
public boolean parseBizContent() {
try {
bizContentJson = JSON.parseObject(bizContent);
if (bizContentJson == null) {
bizContentJson = new JSONObject();
}
return true;
} catch (Exception e) {
log.error("bizContent解析失败:{}", e.getMessage());
return false;
}
}
public JSONObject getContentJson() {
if (bizContentJson != null) {
return bizContentJson;
}
JSONObject object = JSON.parseObject(bizContent);
if (object == null) {
return new JSONObject();
}
return object;
parseBizContent();
return bizContentJson;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment