| @@ -16,7 +16,7 @@ | |||||
| <properties> | <properties> | ||||
| <lombok.version>1.16.18</lombok.version> | <lombok.version>1.16.18</lombok.version> | ||||
| <hutool.version>5.5.4</hutool.version> | <hutool.version>5.5.4</hutool.version> | ||||
| <fastjson.version>2.0.23</fastjson.version> | |||||
| <fastjson.version>1.2.74</fastjson.version> | |||||
| <java.version>1.8</java.version> | <java.version>1.8</java.version> | ||||
| <project.sourceEncoding>UTF-8</project.sourceEncoding> | <project.sourceEncoding>UTF-8</project.sourceEncoding> | ||||
| </properties> | </properties> | ||||
| @@ -53,8 +53,8 @@ | |||||
| <!-- 阿里JSON解析器 --> | <!-- 阿里JSON解析器 --> | ||||
| <dependency> | <dependency> | ||||
| <groupId>com.alibaba.fastjson2</groupId> | |||||
| <artifactId>fastjson2</artifactId> | |||||
| <groupId>com.alibaba</groupId> | |||||
| <artifactId>fastjson</artifactId> | |||||
| <version>${fastjson.version}</version> | <version>${fastjson.version}</version> | ||||
| </dependency> | </dependency> | ||||
| </dependencies> | </dependencies> | ||||
| @@ -70,8 +70,8 @@ | |||||
| <artifactId>hutool-all</artifactId> | <artifactId>hutool-all</artifactId> | ||||
| </dependency> | </dependency> | ||||
| <dependency> | <dependency> | ||||
| <groupId>com.alibaba.fastjson2</groupId> | |||||
| <artifactId>fastjson2</artifactId> | |||||
| <groupId>com.alibaba</groupId> | |||||
| <artifactId>fastjson</artifactId> | |||||
| </dependency> | </dependency> | ||||
| <dependency> | <dependency> | ||||
| <groupId>javax.servlet</groupId> | <groupId>javax.servlet</groupId> | ||||
| @@ -1,7 +1,7 @@ | |||||
| package com.nsgk.agentcentersdk.api; | package com.nsgk.agentcentersdk.api; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson2.JSONObject; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.nsgk.agentcentersdk.err.NSErrno; | import com.nsgk.agentcentersdk.err.NSErrno; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -52,6 +52,11 @@ public final class NSApiResult | |||||
| this(suc ? NS_RESULT_SUCCESS : NS_RESULT_ERROR, msg, data, timestamp, errno); | this(suc ? NS_RESULT_SUCCESS : NS_RESULT_ERROR, msg, data, timestamp, errno); | ||||
| } | } | ||||
| public boolean IsSuccess() | |||||
| { | |||||
| return NS_RESULT_SUCCESS == code; | |||||
| } | |||||
| static NSApiResult Success(String msg, Object data) | static NSApiResult Success(String msg, Object data) | ||||
| { | { | ||||
| return new NSApiResult(NS_RESULT_SUCCESS, msg, data); | return new NSApiResult(NS_RESULT_SUCCESS, msg, data); | ||||
| @@ -17,7 +17,7 @@ public final class NSSDK | |||||
| private static final ThreadLocal<String> _privateKey = new ThreadLocal<>(); | private static final ThreadLocal<String> _privateKey = new ThreadLocal<>(); | ||||
| private static final ThreadLocal<Boolean> _serverInit = new ThreadLocal<>(); | private static final ThreadLocal<Boolean> _serverInit = new ThreadLocal<>(); | ||||
| public static boolean InitClient(String host, short port, String identifier, String publicKey, int timeout) | |||||
| public static boolean InitClient(String host, Short port, String identifier, String publicKey, int timeout) | |||||
| { | { | ||||
| if(NSConv.FALSE(_clientInit.get())) | if(NSConv.FALSE(_clientInit.get())) | ||||
| return false; | return false; | ||||
| @@ -1,8 +1,8 @@ | |||||
| package com.nsgk.agentcentersdk.api; | package com.nsgk.agentcentersdk.api; | ||||
| import cn.hutool.core.util.URLUtil; | import cn.hutool.core.util.URLUtil; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson2.JSONObject; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.nsgk.agentcentersdk.core.NSConstants; | import com.nsgk.agentcentersdk.core.NSConstants; | ||||
| import com.nsgk.agentcentersdk.core.NSProtocol; | import com.nsgk.agentcentersdk.core.NSProtocol; | ||||
| import com.nsgk.agentcentersdk.core.NSReportObject; | import com.nsgk.agentcentersdk.core.NSReportObject; | ||||
| @@ -35,12 +35,12 @@ import lombok.experimental.Accessors; | |||||
| public final class NSSDKClient | public final class NSSDKClient | ||||
| { | { | ||||
| private final String host; | private final String host; | ||||
| private final short port; | |||||
| private final Short port; | |||||
| private final String identifier; | private final String identifier; | ||||
| private final String publicKey; | private final String publicKey; | ||||
| private int timeout; | private int timeout; | ||||
| NSSDKClient(String host, short port, String identifier, String publicKey, int timeout) | |||||
| NSSDKClient(String host, Short port, String identifier, String publicKey, int timeout) | |||||
| { | { | ||||
| this.host = host; | this.host = host; | ||||
| this.port = port; | this.port = port; | ||||
| @@ -74,7 +74,7 @@ public final class NSSDKClient | |||||
| private String BuildUrl(String url) | private String BuildUrl(String url) | ||||
| { | { | ||||
| return URLUtil.completeUrl(host + ":" + port, url); | |||||
| return URLUtil.completeUrl(host + (null != port ? ":" + port : ""), url); | |||||
| } | } | ||||
| private <T> void WriteDataObject(NSNetworkRequest request, NSReportObject<T> object) | private <T> void WriteDataObject(NSNetworkRequest request, NSReportObject<T> object) | ||||
| @@ -1,6 +1,6 @@ | |||||
| package com.nsgk.agentcentersdk.api; | package com.nsgk.agentcentersdk.api; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.nsgk.agentcentersdk.core.NSConstants; | import com.nsgk.agentcentersdk.core.NSConstants; | ||||
| import com.nsgk.agentcentersdk.core.NSProtocol; | import com.nsgk.agentcentersdk.core.NSProtocol; | ||||
| import com.nsgk.agentcentersdk.core.NSReportObject; | import com.nsgk.agentcentersdk.core.NSReportObject; | ||||
| @@ -1,7 +1,7 @@ | |||||
| package com.nsgk.agentcentersdk.core; | package com.nsgk.agentcentersdk.core; | ||||
| import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.nsgk.agentcentersdk.err.NSErrGlobal; | import com.nsgk.agentcentersdk.err.NSErrGlobal; | ||||
| import com.nsgk.agentcentersdk.err.NSErrno; | import com.nsgk.agentcentersdk.err.NSErrno; | ||||
| import com.nsgk.agentcentersdk.utility.NSSignTool; | import com.nsgk.agentcentersdk.utility.NSSignTool; | ||||
| @@ -2,7 +2,7 @@ package com.nsgk.agentcentersdk.entity; | |||||
| import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
| import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
| import com.alibaba.fastjson2.JSON; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.nsgk.agentcentersdk.utility.NSArr; | import com.nsgk.agentcentersdk.utility.NSArr; | ||||
| import com.nsgk.agentcentersdk.utility.NSReflect; | import com.nsgk.agentcentersdk.utility.NSReflect; | ||||
| import com.nsgk.agentcentersdk.utility.NSStr; | import com.nsgk.agentcentersdk.utility.NSStr; | ||||
| @@ -131,6 +131,20 @@ public class NSEntity implements Serializable | |||||
| return false; | return false; | ||||
| } | } | ||||
| @SuppressWarnings("unchecked") | |||||
| public <T extends NSEntity> T Add(String name, Object val) | |||||
| { | |||||
| Set(name, val); | |||||
| return (T)this; | |||||
| } | |||||
| @SuppressWarnings("unchecked") | |||||
| public <T extends NSEntity> T Add_s(String name, Object val) | |||||
| { | |||||
| Set_s(name, val); | |||||
| return (T)this; | |||||
| } | |||||
| // json反序列化 | // json反序列化 | ||||
| @SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | ||||
| public boolean FromJson(String json) | public boolean FromJson(String json) | ||||
| @@ -65,8 +65,9 @@ public class ContractionListener | |||||
| .setOrderAt(new Date()) | .setOrderAt(new Date()) | ||||
| .setAgentStatus(TAgentTask.AGENT_STATUS_READY) | .setAgentStatus(TAgentTask.AGENT_STATUS_READY) | ||||
| .setOrderStatus("2") | .setOrderStatus("2") | ||||
| .normalized(); | |||||
| .normalized() | |||||
| ; | ; | ||||
| contraction.setCreateBy("admin"); | |||||
| return contraction; | return contraction; | ||||
| } | } | ||||