fix: 微信小程序接口对接修改,联调测试问题修复。
This commit is contained in:
@@ -88,4 +88,23 @@ public interface IotDeviceService {
|
||||
*/
|
||||
Map<String, Object> queryThingModel(String productKey) throws Exception;
|
||||
|
||||
/**
|
||||
* 设置设备校准
|
||||
*
|
||||
* @param iotId 设备ID
|
||||
* @return 是否成功
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
boolean calibrateDevice(String iotId) throws Exception;
|
||||
|
||||
/**
|
||||
* 设置设备盐度补偿
|
||||
*
|
||||
* @param iotId 设备ID
|
||||
* @param salinityCompensation 盐度补偿值
|
||||
* @return 是否成功
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
boolean setSalinityCompensation(String iotId, Double salinityCompensation) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -191,4 +191,44 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean calibrateDevice(String iotId) throws Exception {
|
||||
log.info("设置设备校准,IotId: {}", iotId);
|
||||
|
||||
// 构造属性JSON:{"correct": 1}
|
||||
String properties = "{\"correct\": 1}";
|
||||
|
||||
SetDevicePropertyRequest request = new SetDevicePropertyRequest();
|
||||
request.setIotId(iotId);
|
||||
request.setItems(properties);
|
||||
|
||||
SetDevicePropertyResponse response = acsClient.getAcsResponse(request);
|
||||
|
||||
if (!response.getSuccess()) {
|
||||
log.error("设置设备校准失败,Code: {}, ErrorMessage: {}", response.getCode(), response.getErrorMessage());
|
||||
}
|
||||
|
||||
return response.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSalinityCompensation(String iotId, Double salinityCompensation) throws Exception {
|
||||
log.info("设置设备盐度补偿,IotId: {}, SalinityCompensation: {}", iotId, salinityCompensation);
|
||||
|
||||
// 构造属性JSON:{"salinitySet": value}
|
||||
String properties = String.format("{\"salinitySet\": %s}", salinityCompensation);
|
||||
|
||||
SetDevicePropertyRequest request = new SetDevicePropertyRequest();
|
||||
request.setIotId(iotId);
|
||||
request.setItems(properties);
|
||||
|
||||
SetDevicePropertyResponse response = acsClient.getAcsResponse(request);
|
||||
|
||||
if (!response.getSuccess()) {
|
||||
log.error("设置设备盐度补偿失败,Code: {}, ErrorMessage: {}", response.getCode(), response.getErrorMessage());
|
||||
}
|
||||
|
||||
return response.getSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user