java110 лет назад: 3
Родитель
Сommit
7a048558ed

+ 10 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/staff/AddStaffToIotAdapt.java

@@ -69,23 +69,27 @@ public class AddStaffToIotAdapt extends DatabusAdaptImpl {
     @Override
     @Override
     public void execute(Business business, List<Business> businesses) {
     public void execute(Business business, List<Business> businesses) {
         JSONObject data = business.getData();
         JSONObject data = business.getData();
+        JSONArray   businessStoreUsers = new JSONArray();
         if (data.containsKey(StoreUserPo.class.getSimpleName())) {
         if (data.containsKey(StoreUserPo.class.getSimpleName())) {
             Object bObj = data.get(StoreUserPo.class.getSimpleName());
             Object bObj = data.get(StoreUserPo.class.getSimpleName());
-            JSONArray businessStoreUsers = null;
             if (bObj instanceof JSONObject) {
             if (bObj instanceof JSONObject) {
-                businessStoreUsers = new JSONArray();
+
                 businessStoreUsers.add(bObj);
                 businessStoreUsers.add(bObj);
             } else if (bObj instanceof List) {
             } else if (bObj instanceof List) {
                 businessStoreUsers = JSONArray.parseArray(JSONObject.toJSONString(bObj));
                 businessStoreUsers = JSONArray.parseArray(JSONObject.toJSONString(bObj));
             } else {
             } else {
                 businessStoreUsers = (JSONArray) bObj;
                 businessStoreUsers = (JSONArray) bObj;
             }
             }
-            //JSONObject businessStoreUser = data.getJSONObject("businessStoreUser");
-            for (int bStoreUserIndex = 0; bStoreUserIndex < businessStoreUsers.size(); bStoreUserIndex++) {
-                JSONObject businessStoreUser = businessStoreUsers.getJSONObject(bStoreUserIndex);
-                doSendStoreUser(business, businessStoreUser);
+        }else {
+            if (data instanceof JSONObject) {
+                businessStoreUsers.add(data);
             }
             }
         }
         }
+        //JSONObject businessStoreUser = data.getJSONObject("businessStoreUser");
+        for (int bStoreUserIndex = 0; bStoreUserIndex < businessStoreUsers.size(); bStoreUserIndex++) {
+            JSONObject businessStoreUser = businessStoreUsers.getJSONObject(bStoreUserIndex);
+            doSendStoreUser(business, businessStoreUser);
+        }
     }
     }
 
 
     private void doSendStoreUser(Business business, JSONObject businessStoreUser) {
     private void doSendStoreUser(Business business, JSONObject businessStoreUser) {

+ 10 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/staff/DeleteStaffToIotAdapt.java

@@ -71,23 +71,27 @@ public class DeleteStaffToIotAdapt extends DatabusAdaptImpl {
     @Override
     @Override
     public void execute(Business business, List<Business> businesses) {
     public void execute(Business business, List<Business> businesses) {
         JSONObject data = business.getData();
         JSONObject data = business.getData();
+        JSONArray businessOwnerAttendances = new JSONArray();
         if (data.containsKey(StoreUserPo.class.getSimpleName())) {
         if (data.containsKey(StoreUserPo.class.getSimpleName())) {
             Object bObj = data.get(StoreUserPo.class.getSimpleName());
             Object bObj = data.get(StoreUserPo.class.getSimpleName());
-            JSONArray businessOwnerAttendances = null;
             if (bObj instanceof JSONObject) {
             if (bObj instanceof JSONObject) {
-                businessOwnerAttendances = new JSONArray();
                 businessOwnerAttendances.add(bObj);
                 businessOwnerAttendances.add(bObj);
             } else if (bObj instanceof List) {
             } else if (bObj instanceof List) {
                 businessOwnerAttendances = JSONArray.parseArray(JSONObject.toJSONString(bObj));
                 businessOwnerAttendances = JSONArray.parseArray(JSONObject.toJSONString(bObj));
             } else {
             } else {
                 businessOwnerAttendances = (JSONArray) bObj;
                 businessOwnerAttendances = (JSONArray) bObj;
             }
             }
-            //JSONObject businessOwnerAttendance = data.getJSONObject("businessOwnerAttendance");
-            for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) {
-                JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex);
-                doSendOwnerAttendance(business, businessOwnerAttendance);
+        }else {
+            if (data instanceof JSONObject) {
+                businessOwnerAttendances.add(data);
             }
             }
         }
         }
+
+        //JSONObject businessOwnerAttendance = data.getJSONObject("businessOwnerAttendance");
+        for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) {
+            JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex);
+            doSendOwnerAttendance(business, businessOwnerAttendance);
+        }
     }
     }
 
 
     private void doSendOwnerAttendance(Business business, JSONObject businessStoreUser) {
     private void doSendOwnerAttendance(Business business, JSONObject businessStoreUser) {

+ 12 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/staff/UpdateStaffToIotAdapt.java

@@ -67,23 +67,29 @@ public class UpdateStaffToIotAdapt extends DatabusAdaptImpl {
     @Override
     @Override
     public void execute(Business business, List<Business> businesses) {
     public void execute(Business business, List<Business> businesses) {
         JSONObject data = business.getData();
         JSONObject data = business.getData();
+        JSONArray  businessOwnerAttendances = new JSONArray();
         if (data.containsKey(AttendanceClassesPo.class.getSimpleName())) {
         if (data.containsKey(AttendanceClassesPo.class.getSimpleName())) {
             Object bObj = data.get(AttendanceClassesPo.class.getSimpleName());
             Object bObj = data.get(AttendanceClassesPo.class.getSimpleName());
-            JSONArray businessOwnerAttendances = null;
+
             if (bObj instanceof JSONObject) {
             if (bObj instanceof JSONObject) {
-                businessOwnerAttendances = new JSONArray();
+
                 businessOwnerAttendances.add(bObj);
                 businessOwnerAttendances.add(bObj);
             } else if (bObj instanceof List) {
             } else if (bObj instanceof List) {
                 businessOwnerAttendances = JSONArray.parseArray(JSONObject.toJSONString(bObj));
                 businessOwnerAttendances = JSONArray.parseArray(JSONObject.toJSONString(bObj));
             } else {
             } else {
                 businessOwnerAttendances = (JSONArray) bObj;
                 businessOwnerAttendances = (JSONArray) bObj;
             }
             }
-            //JSONObject businessOwnerAttendance = data.getJSONObject("businessOwnerAttendance");
-            for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) {
-                JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex);
-                doSendOwnerAttendance(business, businessOwnerAttendance);
+        }else {
+            if (data instanceof JSONObject) {
+                businessOwnerAttendances.add(data);
             }
             }
         }
         }
+
+        //JSONObject businessOwnerAttendance = data.getJSONObject("businessOwnerAttendance");
+        for (int bOwnerAttendanceIndex = 0; bOwnerAttendanceIndex < businessOwnerAttendances.size(); bOwnerAttendanceIndex++) {
+            JSONObject businessOwnerAttendance = businessOwnerAttendances.getJSONObject(bOwnerAttendanceIndex);
+            doSendOwnerAttendance(business, businessOwnerAttendance);
+        }
     }
     }
 
 
     private void doSendOwnerAttendance(Business business, JSONObject businessOwnerAttendance) {
     private void doSendOwnerAttendance(Business business, JSONObject businessOwnerAttendance) {