|
|
@@ -1,5 +1,6 @@
|
|
|
package com.kym.service.awoara;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
import com.google.gson.FieldNamingPolicy;
|
|
|
@@ -39,6 +40,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter())
|
|
|
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
|
|
.create();
|
|
|
+
|
|
|
/**
|
|
|
* BASE64解码器
|
|
|
*/
|
|
|
@@ -238,56 +240,16 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
"params": []
|
|
|
}
|
|
|
""";
|
|
|
- return doRequest(productKey, deviceName, params, new TypeReference<AwoaraResponse<DeviceConfig>>() {
|
|
|
- });
|
|
|
+ var res = doRequest(productKey, deviceName, params, null);
|
|
|
+ return gson.fromJson(JSON.toJSONString(res).replaceAll("\\.", ""), DeviceConfig.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void writeConfig(String productKey, String deviceName, DeviceConfig deviceConfig) {
|
|
|
- var params = """
|
|
|
- {
|
|
|
- "version": "2.0",
|
|
|
- "method": "write_config",
|
|
|
- "params": {
|
|
|
- "version":2,
|
|
|
- "maintenance_mode": 0,
|
|
|
- "user_message.1": "超级进化车生活2",
|
|
|
- "user_message.2": "客服电话:13018061579",
|
|
|
- "sensor_water": 0,
|
|
|
- "price_space": 0,
|
|
|
- "price_water": 150,
|
|
|
- "price_foam": 250,
|
|
|
- "price_tap": 100,
|
|
|
- "price_cleaner": 120,
|
|
|
- "price_user_ext": 100,
|
|
|
- "idle_timeout": 1200,
|
|
|
- "operation_timeout": 3600,
|
|
|
- "quick_open_money": 2000,
|
|
|
- "work_mode": 1,
|
|
|
- "work_time_period.1": "00:00 - 00:00",
|
|
|
- "work_time_period.2": "00:00 - 00:00",
|
|
|
- "light_mode": 2,
|
|
|
- "light_time_period.1": "00:00 - 05:30",
|
|
|
- "light_time_period.2": "18:30 - 00:00",
|
|
|
- "sound_volume": 70,
|
|
|
- "screen_type": 0,
|
|
|
- "video_source": 0,
|
|
|
- "video_play_delay": 20,
|
|
|
- "work_light_delay": 30,
|
|
|
- "bill_delay": 60,
|
|
|
- "notice_throshold_idle": 300,
|
|
|
- "notice_throshold_operation": 600,
|
|
|
- "motor_mode": 0
|
|
|
- }
|
|
|
- }
|
|
|
- """;
|
|
|
-
|
|
|
var json = new JSONObject();
|
|
|
json.put("version", "2.0");
|
|
|
json.put("method", "write_config");
|
|
|
json.put("params", deviceConfig);
|
|
|
-
|
|
|
-// doRequest(productKey, deviceName, params, null);
|
|
|
doRequest(productKey, deviceName, gson.toJson(json).replaceAll("1\"", ".1\"").replaceAll("2\"", ".2\""), null);
|
|
|
}
|
|
|
}
|