From 24f890886d5a634f9f1ae2dd73652a05a4e2d2cf Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 08 六月 2022 10:46:36 +0800
Subject: [PATCH] 优化 同步iot 功能
---
service-job/src/main/java/com/java110/job/adapt/hcIot/community/AddCommunityToIotAdapt.java | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/service-job/src/main/java/com/java110/job/adapt/hcIot/community/AddCommunityToIotAdapt.java b/service-job/src/main/java/com/java110/job/adapt/hcIot/community/AddCommunityToIotAdapt.java
index cdd6271..29ee526 100755
--- a/service-job/src/main/java/com/java110/job/adapt/hcIot/community/AddCommunityToIotAdapt.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcIot/community/AddCommunityToIotAdapt.java
@@ -56,27 +56,26 @@
@Override
public void execute(Business business, List<Business> businesses) throws Exception{
JSONObject data = business.getData();
- JSONArray businessCommunitys = null;
+ JSONArray businessCommunitys = new JSONArray();
if (data.containsKey(CommunityPo.class.getSimpleName())) {
Object bObj = data.get(CommunityPo.class.getSimpleName());
if (bObj instanceof JSONObject) {
- businessCommunitys = new JSONArray();
businessCommunitys.add(bObj);
} else if (bObj instanceof List) {
businessCommunitys = JSONArray.parseArray(JSONObject.toJSONString(bObj));
} else {
businessCommunitys = (JSONArray) bObj;
}
- for (int bMachineIndex = 0; bMachineIndex < businessCommunitys.size(); bMachineIndex++) {
- JSONObject businessCommunity = businessCommunitys.getJSONObject(bMachineIndex);
- doAddCommunity(business, businessCommunity);
- }
}else {
if (data instanceof JSONObject) {
- businessCommunitys = new JSONArray();
businessCommunitys.add(data);
}
}
+
+ for (int bMachineIndex = 0; bMachineIndex < businessCommunitys.size(); bMachineIndex++) {
+ JSONObject businessCommunity = businessCommunitys.getJSONObject(bMachineIndex);
+ doAddCommunity(business, businessCommunity);
+ }
}
/**
--
Gitblit v1.8.0