|
|
@@ -36,16 +36,21 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
*/
|
|
|
private static Base64.Decoder decoder = Base64.getDecoder();
|
|
|
|
|
|
- static <T> AwoaraResponse<T> doRequest(String productKey, String deviceName, String params, TypeReference<AwoaraResponse<T>>... typeReference) {
|
|
|
+ static <T> T doRequest(String productKey, String deviceName, String params, TypeReference<AwoaraResponse<T>>... typeReference) {
|
|
|
try {
|
|
|
var response = AliyunLotClient.rRpc(productKey, deviceName, params);
|
|
|
+ AwoaraResponse<T> res;
|
|
|
if (HTTP_OK == response.getStatusCode()) {
|
|
|
if (CommUtil.isNotEmptyAndNull(typeReference)) {
|
|
|
- return JSONObject.parseObject(new String(decoder.decode(response.getBody().payloadBase64Byte), StandardCharsets.UTF_8), typeReference[0]);
|
|
|
+ res = JSONObject.parseObject(new String(decoder.decode(response.getBody().payloadBase64Byte), StandardCharsets.UTF_8), typeReference[0]);
|
|
|
} else {
|
|
|
- return JSONObject.parseObject(new String(decoder.decode(response.getBody().payloadBase64Byte), StandardCharsets.UTF_8), AwoaraResponse.class);
|
|
|
+ res = JSONObject.parseObject(new String(decoder.decode(response.getBody().payloadBase64Byte), StandardCharsets.UTF_8), AwoaraResponse.class);
|
|
|
+ }
|
|
|
+ if (HTTP_OK == res.getCode()) {
|
|
|
+ return res.getData();
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("AliyunLot响应异常");
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
throw new BusinessException("AliyunLot响应异常");
|
|
|
}
|
|
|
@@ -55,7 +60,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<ApiList> help(String productKey, String deviceName) {
|
|
|
+ public ApiList help(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -68,7 +73,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<MethodHelp> methodHelp(String productKey, String deviceName, String method) {
|
|
|
+ public MethodHelp methodHelp(String productKey, String deviceName, String method) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -84,7 +89,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<?> showMsgbox(String productKey, String deviceName, String title, String content, int seconds) {
|
|
|
+ public void showMsgbox(String productKey, String deviceName, String title, String content, int seconds) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -97,11 +102,11 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
""".formatted(title, content, seconds);
|
|
|
|
|
|
- return doRequest(productKey, deviceName, params, null);
|
|
|
+ doRequest(productKey, deviceName, params, null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<?> hideMsgbox(String productKey, String deviceName) {
|
|
|
+ public void hideMsgbox(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -109,11 +114,11 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
"params": []
|
|
|
}
|
|
|
""";
|
|
|
- return doRequest(productKey, deviceName, params, null);
|
|
|
+ doRequest(productKey, deviceName, params, null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<?> reboot(String productKey, String deviceName) {
|
|
|
+ public void reboot(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -121,11 +126,11 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
"params": []
|
|
|
}
|
|
|
""";
|
|
|
- return doRequest(productKey, deviceName, params, null);
|
|
|
+ doRequest(productKey, deviceName, params, null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<State> queryState(String productKey, String deviceName) {
|
|
|
+ public State queryState(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -138,7 +143,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<HardwareInfo> queryHardwareInfo(String productKey, String deviceName) {
|
|
|
+ public HardwareInfo queryHardwareInfo(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -151,7 +156,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<CreateOrder> createOrder(String productKey, String deviceName, String orderId, String memberName, int memberBalance, int memberDiscount, int prepayMoney) {
|
|
|
+ public CreateOrder createOrder(String productKey, String deviceName, String orderId, String memberName, int memberBalance, int memberDiscount, int prepayMoney) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -170,7 +175,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<?> closeOrder(String productKey, String deviceName, String orderId, int forceClose) {
|
|
|
+ public void closeOrder(String productKey, String deviceName, String orderId, int forceClose) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -181,11 +186,11 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
}
|
|
|
""".formatted(orderId, forceClose);
|
|
|
- return doRequest(productKey, deviceName, params, null);
|
|
|
+ doRequest(productKey, deviceName, params, null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<OrderInfo> queryOrder(String productKey, String deviceName, String orderId) {
|
|
|
+ public OrderInfo queryOrder(String productKey, String deviceName, String orderId) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -200,7 +205,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<Config> readConfig(String productKey, String deviceName) {
|
|
|
+ public Config readConfig(String productKey, String deviceName) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -213,7 +218,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AwoaraResponse<?> writeConfig(String productKey, String deviceName, Config config) {
|
|
|
+ public void writeConfig(String productKey, String deviceName, Config config) {
|
|
|
var params = """
|
|
|
{
|
|
|
"version": "2.0",
|
|
|
@@ -221,7 +226,7 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
"params": {
|
|
|
"version":2,
|
|
|
"maintenance_mode": 0,
|
|
|
- "user_message.1": "快与慢自助洗车",
|
|
|
+ "user_message.1": "超级进化车生活",
|
|
|
"user_message.2": "客服电话:13018061579",
|
|
|
"sensor_water": 0,
|
|
|
"price_space": 10,
|
|
|
@@ -248,11 +253,11 @@ public class AwoaraServiceImpl implements AwoaraService {
|
|
|
"notice_throshold_idle": 300,
|
|
|
"notice_throshold_operation": 600,
|
|
|
"motor_mode": 0,
|
|
|
- "tts_open_by_button":"欢迎使用快与慢自助洗车机",
|
|
|
- "tts_open_by_network":"欢迎使用快与慢自助洗车机"
|
|
|
+ "tts_open_by_button":"欢迎使用超级进化自助洗车机",
|
|
|
+ "tts_open_by_network":"欢迎使用超级进化自助洗车机"
|
|
|
}
|
|
|
}
|
|
|
""";
|
|
|
- return doRequest(productKey, deviceName, params, null);
|
|
|
+ doRequest(productKey, deviceName, params, null);
|
|
|
}
|
|
|
}
|