From a40c2eb885bcdb697c2e16dae4f43cb6cd718973 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 22 一月 2024 11:28:03 +0800
Subject: [PATCH] 优化小区数据

---
 service-job/src/main/java/com/java110/job/adapt/hcIot/community/DeleteCommunityToIotAdapt.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/adapt/hcIot/community/DeleteCommunityToIotAdapt.java b/service-job/src/main/java/com/java110/job/adapt/hcIot/community/DeleteCommunityToIotAdapt.java
index f3dac2d..3cdcc02 100755
--- a/service-job/src/main/java/com/java110/job/adapt/hcIot/community/DeleteCommunityToIotAdapt.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcIot/community/DeleteCommunityToIotAdapt.java
@@ -17,7 +17,7 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.java110.entity.order.Business;
+import com.java110.dto.system.Business;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.community.CommunityPo;
@@ -57,22 +57,25 @@
     @Override
     public void execute(Business business, List<Business> businesses) {
         JSONObject data = business.getData();
+        JSONArray   businessCommunitys = new JSONArray();
         if (data.containsKey(CommunityPo.class.getSimpleName())) {
             Object bObj = data.get(CommunityPo.class.getSimpleName());
-            JSONArray businessCommunitys = null;
             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);
-                doDeleteCommunity(business, businessCommunity);
+        }else {
+            if (data instanceof JSONObject) {
+                businessCommunitys.add(data);
             }
         }
+        for (int bMachineIndex = 0; bMachineIndex < businessCommunitys.size(); bMachineIndex++) {
+            JSONObject businessCommunity = businessCommunitys.getJSONObject(bMachineIndex);
+            doDeleteCommunity(business, businessCommunity);
+        }
     }
 
     /**

--
Gitblit v1.8.0