fix: 微信小程序接口对接修改,联调测试问题修复。

This commit is contained in:
tianyongbao
2026-01-14 08:31:55 +08:00
parent a41248e405
commit 15af17fb95
44 changed files with 3887 additions and 52 deletions

View File

@@ -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;
}

View File

@@ -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();
}
}