tuya / tuya-connector

tuya-connector helps you efficiently create cloud development projects regarding the OpenAPI or message subscription capabilities. You can put all the focus on business logic without taking care of server-side programming nor relational databases.
Apache License 2.0
59 stars 34 forks source link

在简单设备属性上从 Fastjson 设置属性错误 #41

Open leandromsales opened 1 year ago

leandromsales commented 1 year ago

我正在使用 tuya-spring-boot-starter 版本 1.3.0 来查询设备详细信息,如下所示:

TuyaClient.java:

public interface TuyaClient {

    @GET("/v1.0/devices/{device_id}")
    Device getById(@Path("device_id") String deviceId);

}

Device.java:

@Data
@AllArgsConstructor
@NoArgsConstructor
@FieldDefaults(level = AccessLevel.PUBLIC)
public class Device {
    String id;

    @JSONField(name="update_time")
    Long update_time;

    @JSONField(name="create_time")
    Long createTime;

    Boolean online;

    String icon;

    // other fields here
}

问题:

某些字段(例如“update_time”)没有被 Fastjson 反序列化,没有明确的原因,从而产生以下错误:

_调用连接器时出错。 原因:com.alibaba.fastjson.JSONException:设置属性错误,mypackage.models.Device#updatetime"

我想知道为什么会发生这种情况,因为例如,与“update_time”具有相同类型的字段“create_time”正在被正确反序列化。

有什么线索吗?

Java version: 20 tuya-spring-boot-starter: 1.3.0

leandromsales commented 1 year ago

FYI, I have tried with 1.3.2 and still the same issue. Anyone to help me on this?

leandromsales commented 1 year ago

Why nobody in this project address this issue yet? Is there someone looking at this?