perf:移除hutool-json,直接使用fastjson

This commit is contained in:
曾文豪
2024-08-23 15:04:20 +08:00
parent 9bab4cdb25
commit 4bcae2f8d1
23 changed files with 176 additions and 116 deletions

View File

@@ -1,6 +1,6 @@
package com.tiesheng.message.config.aliyun;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject;
public interface AliyunSmsHandler {

View File

@@ -5,8 +5,8 @@ import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.message.service.TsMessageSender;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.ApiResp;
@@ -103,10 +103,10 @@ public class AliyunSmsSender implements TsMessageSender {
try {
respBody = OkHttpUtil.get(ENDPOINT + "?Signature=" + signature + sortQueryStringTmp);
} catch (Exception e) {
respBody = JSONUtil.createObj()
.putOpt("Code", "Error")
.putOpt("Message", "消息通道异常")
.toString();
JSONObject object = new JSONObject();
object.put("Code", "Error");
object.put("Message", "消息通道异常");
respBody = object.toJSONString();
}
return respBody;
}
@@ -130,9 +130,9 @@ public class AliyunSmsSender implements TsMessageSender {
queryMap.put("TemplateParam", tempParam.getTemplateParam().toString());
}
JSONObject respObj = JSONUtil.parseObj(request("SendSms", queryMap));
if (!Objects.equals(respObj.getStr("Code"), "OK")) {
return ApiResp.resp130(respObj.getStr("Message"));
JSONObject respObj = JSON.parseObject(request("SendSms", queryMap));
if (!Objects.equals(respObj.getString("Code"), "OK")) {
return ApiResp.resp130(respObj.getString("Message"));
}
return ApiResp.respOK("");

View File

@@ -1,6 +1,6 @@
package com.tiesheng.message.config.aliyun;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject;
public class AliyunTempParam {

View File

@@ -1,7 +1,7 @@
package com.tiesheng.message.service;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.util.pojos.ApiResp;
/**

View File

@@ -3,7 +3,7 @@ package com.tiesheng.message.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.tiesheng.message.pojos.UserChannel;
import com.tiesheng.util.pojos.ApiResp;
import org.springframework.beans.factory.annotation.Autowired;