Merge branch 'feature-BOX一期' of http://47.99.132.106:10081/wulin/qiuguo-iot into feature-BOX一期
This commit is contained in:
commit
ca1c34f6f1
@ -64,7 +64,7 @@ public class MusicService {
|
||||
if (type == 1) {
|
||||
return webClient.get().uri(baseUrl+"/search?keywords="+keyword).retrieve()
|
||||
.bodyToMono(SearchResponse.class)
|
||||
.delaySubscription(Duration.ofMillis(1000), Schedulers.boundedElastic())
|
||||
.delaySubscription(Duration.ofMillis(300), Schedulers.boundedElastic())
|
||||
.flatMap(res -> {
|
||||
if (!Objects.equals(res.getCode(), 200)) {
|
||||
return Mono.empty();
|
||||
@ -91,7 +91,7 @@ public class MusicService {
|
||||
} else {
|
||||
return webClient.get().uri(baseUrl+"/search?keywords="+keyword+"&type=100").retrieve()
|
||||
.bodyToMono(SingerResponse.class)
|
||||
.delaySubscription(Duration.ofMillis(1000), Schedulers.boundedElastic())
|
||||
.delaySubscription(Duration.ofMillis(300), Schedulers.boundedElastic())
|
||||
.flatMap(res -> {
|
||||
if (!Objects.equals(res.getCode(), 200) && res.getResult().getArtists().size() == 0) {
|
||||
return Mono.empty();
|
||||
@ -99,7 +99,7 @@ public class MusicService {
|
||||
String id = res.getResult().getArtists().get(0).getId();
|
||||
return webClient.get().uri(baseUrl+"/artist/top/song?id="+id).retrieve()
|
||||
.bodyToMono(SingerSongsResponse.class)
|
||||
.delaySubscription(Duration.ofMillis(1000), Schedulers.boundedElastic())
|
||||
.delaySubscription(Duration.ofMillis(300), Schedulers.boundedElastic())
|
||||
.flatMap(song -> {
|
||||
if (Objects.equals(200, song.getCode()) && song.getSongs().size() > 0) {
|
||||
String ids = song.getSongs().stream().limit(3)
|
||||
|
||||
@ -14,6 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -167,7 +168,7 @@ public class TuyaDeviceService {
|
||||
if (type.equalsIgnoreCase("boolean")) {
|
||||
jsonObject.put("value", Boolean.parseBoolean(data.getValue()));
|
||||
} else if (type.equalsIgnoreCase("Integer")) {
|
||||
jsonObject.put("value", Integer.parseInt(query.getValue()));
|
||||
jsonObject.put("value", Integer.parseInt(data.getValue()));
|
||||
} else if (type.equalsIgnoreCase("Enum")) {
|
||||
jsonObject.put("value", data.getValue());
|
||||
} else if (type.equalsIgnoreCase("auto_add_integer")) {
|
||||
@ -198,14 +199,25 @@ public class TuyaDeviceService {
|
||||
return Mono.just(tuyaResponse);
|
||||
}
|
||||
javaList.add(jsonObject);
|
||||
List<JSONObject> collect = javaList.stream().filter(jl -> !ObjectUtils.isEmpty(jl.get("value")))
|
||||
Set<JSONObject> collect = javaList.stream().filter(jl -> !ObjectUtils.isEmpty(jl.get("value")))
|
||||
.filter(jl -> !jl.getString("value").startsWith("{"))
|
||||
.filter(jl -> !jl.getString("value").startsWith("[")).collect(Collectors.toList());
|
||||
.filter(jl -> !jl.getString("value").startsWith("["))
|
||||
.map(jl->{
|
||||
if (jl.getString("code").equalsIgnoreCase(jsonObject.getString("code"))) {
|
||||
return jsonObject;
|
||||
}
|
||||
return jl;
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
if (Objects.equals(deviceInfo.getString("category"), "fs")) {
|
||||
JSONObject fsJson = new JSONObject();
|
||||
fsJson.put("code", "switch");
|
||||
fsJson.put("value", true);
|
||||
collect.add(fsJson);
|
||||
collect.clear();
|
||||
collect.add(jsonObject);
|
||||
if (!Objects.equals(data.getMatchingFields(), "关")) {
|
||||
JSONObject fsJson = new JSONObject();
|
||||
fsJson.put("code", "switch");
|
||||
fsJson.put("value", true);
|
||||
collect.add(fsJson);
|
||||
}
|
||||
}
|
||||
commands.put("commands", categoryBoolean ? Arrays.asList(jsonObject) : collect);
|
||||
Boolean result = tuyaDeviceConnector.controlDevice(query.getDeviceId(), commands);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user