Browse Source

HC加入物联网数据同步功能

java110 5 years ago
parent
commit
4782c0f6bb
19 changed files with 316 additions and 508 deletions
  1. 194 0
      service-job/src/main/java/com/java110/job/adapt/hcIot/AddCommunityToIotAdapt.java
  2. 6 6
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoAddMachineTransactionIotAdapt.java
  3. 7 7
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoAddOwnerTransactionIotAdapt.java
  4. 6 6
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteMachineTransactionIotAdapt.java
  5. 7 7
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteOwnerTransactionIotAdapt.java
  6. 7 7
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoEditOwnerTransactionIotAdapt.java
  7. 5 5
      service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java
  8. 14 13
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoIotConstant.java
  9. 0 42
      service-job/src/main/java/com/java110/job/adapt/hcIot/MachineTransactionIotAdapt.java
  10. 6 6
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoModifyMachineTransactionIotAdapt.java
  11. 4 4
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOpenDoorAdapt.java
  12. 7 7
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOwnerBindRoomTransactionIotAdapt.java
  13. 7 7
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOwnerUnBindRoomTransactionIotAdapt.java
  14. 14 3
      service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/IXimoMachineAsyn.java
  15. 0 24
      service-job/src/main/java/com/java110/job/adapt/hcIot/asyn/ITransactionMachineAsyn.java
  16. 32 20
      service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/impl/XimoMachineAsynImpl.java
  17. 0 33
      service-job/src/main/java/com/java110/job/adapt/hcIot/asyn/impl/TransactionMachineAsynImpl.java
  18. 0 110
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoGetMachineStateAdapt.java
  19. 0 201
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoGetOpenDoorLogAdapt.java

+ 194 - 0
service-job/src/main/java/com/java110/job/adapt/hcIot/AddCommunityToIotAdapt.java

@@ -0,0 +1,194 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.job.adapt.hcIot;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.RoomDto;
+import com.java110.dto.communityLocation.CommunityLocationDto;
+import com.java110.dto.file.FileDto;
+import com.java110.dto.file.FileRelDto;
+import com.java110.dto.owner.OwnerDto;
+import com.java110.entity.order.Business;
+import com.java110.intf.common.IFileInnerServiceSMO;
+import com.java110.intf.common.IFileRelInnerServiceSMO;
+import com.java110.intf.common.IMachineInnerServiceSMO;
+import com.java110.intf.community.ICommunityLocationInnerServiceSMO;
+import com.java110.intf.community.IRoomInnerServiceSMO;
+import com.java110.intf.user.IOwnerInnerServiceSMO;
+import com.java110.job.adapt.DatabusAdaptImpl;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
+import com.java110.po.community.CommunityPo;
+import com.java110.po.machine.MachinePo;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * HC 小区同步适配器
+ *
+ * @desc add by 吴学文 18:58
+ */
+@Component(value = "addCommunityToIotAdapt")
+public class AddCommunityToIotAdapt extends DatabusAdaptImpl {
+
+    @Autowired
+    private IIotSendAsyn hcMachineAsynImpl;
+    @Autowired
+    IMachineInnerServiceSMO machineInnerServiceSMOImpl;
+
+    @Autowired
+    private ICommunityLocationInnerServiceSMO communityLocationInnerServiceSMOImpl;
+
+    @Autowired
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
+    @Autowired
+    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+
+    @Autowired
+    private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
+
+    @Autowired
+    private IFileInnerServiceSMO fileInnerServiceSMOImpl;
+
+    /**
+     * 添加小区执行类
+     * {
+     * "name": "HC小区",
+     * "address": "青海省西宁市",
+     * "cityCode": "510104",
+     * "extCommunityId": "702020042194860039"
+     * }
+     *
+     * @param business   当前处理业务
+     * @param businesses 所有业务信息
+     */
+    @Override
+    public void execute(Business business, List<Business> businesses) {
+        JSONObject data = business.getData();
+        if (data.containsKey(CommunityPo.class.getSimpleName())) {
+            Object bObj = data.get(CommunityPo.class.getSimpleName());
+            JSONArray businessMachines = null;
+            if (bObj instanceof JSONObject) {
+                businessMachines = new JSONArray();
+                businessMachines.add(bObj);
+            } else if (bObj instanceof List) {
+                businessMachines = JSONArray.parseArray(JSONObject.toJSONString(bObj));
+            } else {
+                businessMachines = (JSONArray) bObj;
+            }
+            //JSONObject businessMachine = data.getJSONObject("businessMachine");
+            for (int bMachineIndex = 0; bMachineIndex < businessMachines.size(); bMachineIndex++) {
+                JSONObject businessMachine = businessMachines.getJSONObject(bMachineIndex);
+                doSendMachine(business, businessMachine);
+            }
+        }
+    }
+
+    private void doSendMachine(Business business, JSONObject businessMachine) {
+
+        CommunityPo communityPo = BeanConvertUtil.covertBean(businessMachine, CommunityPo.class);
+        JSONObject postParameters = new JSONObject();
+        postParameters.put("name", communityPo.getName());
+        postParameters.put("address", communityPo.getAddress());
+        postParameters.put("cityCode", communityPo.getCityCode());
+        postParameters.put("extCommunityId", communityPo.getCommunityId());
+        hcMachineAsynImpl.addCommunity(postParameters);
+    }
+
+    private List<MultiValueMap<String, Object>> getOwners(MachinePo machinePo) {
+        //拿到小区ID
+        String communityId = machinePo.getCommunityId();
+
+        List<MultiValueMap<String, Object>> ownerDtos = new ArrayList<>();
+
+        List<OwnerDto> owners = null;
+        //根据小区ID查询现有设备
+        OwnerDto ownerDto = new OwnerDto();
+        ownerDto.setCommunityId(communityId);
+        String locationTypeCd = machinePo.getLocationTypeCd();
+        CommunityLocationDto communityLocationDto = new CommunityLocationDto();
+        communityLocationDto.setLocationId(locationTypeCd);
+        communityLocationDto.setCommunityId(machinePo.getCommunityId());
+        List<CommunityLocationDto> communityLocationDtos = communityLocationInnerServiceSMOImpl.queryCommunityLocations(communityLocationDto);
+
+        if (communityLocationDtos == null || communityLocationDtos.size() < 1) {
+            return ownerDtos;
+        }
+        communityLocationDto = communityLocationDtos.get(0);
+
+        if ("1000".contains(communityLocationDto.getLocationType())) {//查询整个小区的业主
+            owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
+        } else if ("2000".equals(communityLocationDto.getLocationType())) {//2000 单元门 ,则这个单元下的业主同步
+            //先根据单元门ID 查询 房屋
+            RoomDto roomDto = new RoomDto();
+            roomDto.setUnitId(machinePo.getLocationObjId());
+            roomDto.setCommunityId(machinePo.getCommunityId());
+            List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
+            if (roomDtos == null || roomDtos.size() == 0) { // 单元下没有房屋
+                return ownerDtos;
+            }
+            ownerDto.setRoomIds(getRoomIds(roomDtos));
+            owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
+        } else if ("3000".equals(communityLocationDto.getLocationType())) {// 3000 房屋门
+            ownerDto.setRoomId(machinePo.getLocationObjId());
+            owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
+        }
+
+        for (OwnerDto tOwnerDto : owners) {
+            FileRelDto fileRelDto = new FileRelDto();
+            fileRelDto.setObjId(tOwnerDto.getMemberId());
+            fileRelDto.setRelTypeCd("10000");
+            List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto);
+            if (fileRelDtos == null || fileRelDtos.size() != 1) {
+                continue;
+            }
+            FileDto fileDto = new FileDto();
+            fileDto.setFileId(fileRelDtos.get(0).getFileSaveName());
+            fileDto.setFileSaveName(fileRelDtos.get(0).getFileSaveName());
+            fileDto.setCommunityId(tOwnerDto.getCommunityId());
+            List<FileDto> fileDtos = fileInnerServiceSMOImpl.queryFiles(fileDto);
+            if (fileDtos == null || fileDtos.size() != 1) {
+                continue;
+            }
+            MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
+
+            postParameters.add("extCommunityUuid", tOwnerDto.getCommunityId());
+            postParameters.add("addAuthorizationDevSn", machinePo.getMachineCode());
+            postParameters.add("uuid", tOwnerDto.getMemberId());
+            postParameters.add("name", tOwnerDto.getName());
+            postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
+
+            ownerDtos.add(postParameters);
+        }
+
+        return ownerDtos;
+    }
+
+    private String[] getRoomIds(List<RoomDto> roomDtos) {
+        List<String> roomIds = new ArrayList<String>();
+        for (RoomDto roomDto : roomDtos) {
+            roomIds.add(roomDto.getRoomId());
+        }
+        return roomIds.toArray(new String[roomIds.size()]);
+    }
+}

+ 6 - 6
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoAddMachineTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -31,7 +31,7 @@ import com.java110.intf.community.ICommunityLocationInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.machine.MachinePo;
 import com.java110.po.machine.MachinePo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -48,11 +48,11 @@ import java.util.List;
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoAddMachineTransactionIotAdapt")
-public class XimoAddMachineTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "addMachineToIotAdapt")
+public class AddMachineToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -130,7 +130,7 @@ public class XimoAddMachineTransactionIotAdapt extends DatabusAdaptImpl {
         postParameters.add("name", machinePo.getMachineName());
         postParameters.add("name", machinePo.getMachineName());
         postParameters.add("positionType", "0");
         postParameters.add("positionType", "0");
         postParameters.add("positionUuid", machinePo.getCommunityId());
         postParameters.add("positionUuid", machinePo.getCommunityId());
-        ximoMachineAsynImpl.send(postParameters, ownerDtos);
+        hcMachineAsynImpl.addMachine(postParameters, ownerDtos);
     }
     }
 
 
     private List<MultiValueMap<String, Object>> getOwners(MachinePo machinePo) {
     private List<MultiValueMap<String, Object>> getOwners(MachinePo machinePo) {

+ 7 - 7
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoAddOwnerTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -27,7 +27,7 @@ import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -40,15 +40,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * HC iot 添加业主同步细末
+ * HC iot 添加业主同步iot
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoAddOwnerTransactionIotAdapt")
-public class XimoAddOwnerTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "addOwnerToIotAdapt")
+public class AddOwnerToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -146,7 +146,7 @@ public class XimoAddOwnerTransactionIotAdapt extends DatabusAdaptImpl {
             postParameters.add("uuid", ownerPo.getMemberId());
             postParameters.add("uuid", ownerPo.getMemberId());
             postParameters.add("name", ownerPo.getName());
             postParameters.add("name", ownerPo.getName());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
-            ximoMachineAsynImpl.sendOwner(postParameters);
+            hcMachineAsynImpl.sendOwner(postParameters);
         }
         }
 
 
     }
     }

+ 6 - 6
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteMachineTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -21,7 +21,7 @@ import com.java110.dto.machine.MachineDto;
 import com.java110.entity.order.Business;
 import com.java110.entity.order.Business;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.machine.MachinePo;
 import com.java110.po.machine.MachinePo;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,11 +36,11 @@ import java.util.List;
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoDeleteMachineTransactionIotAdapt")
-public class XimoDeleteMachineTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "deleteMachineToIotAdapt")
+public class DeleteMachineToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
 
 
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
@@ -93,6 +93,6 @@ public class XimoDeleteMachineTransactionIotAdapt extends DatabusAdaptImpl {
         postParameters.add("extCommunityUuid", machinePo.getCommunityId());
         postParameters.add("extCommunityUuid", machinePo.getCommunityId());
         postParameters.add("devSns", machinePo.getMachineCode());
         postParameters.add("devSns", machinePo.getMachineCode());
         //postParameters.add("uuids", machinePo.getMachineId());
         //postParameters.add("uuids", machinePo.getMachineId());
-        ximoMachineAsynImpl.deleteSend(postParameters);
+        hcMachineAsynImpl.deleteSend(postParameters);
     }
     }
 }
 }

+ 7 - 7
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteOwnerTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -21,7 +21,7 @@ import com.java110.dto.machine.MachineDto;
 import com.java110.entity.order.Business;
 import com.java110.entity.order.Business;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -34,15 +34,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * HC iot 添加业主同步细末
+ * HC  添加业主同步iot
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoDeleteOwnerTransactionIotAdapt")
-public class XimoDeleteOwnerTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "hcDeleteOwnerTransactionIotAdapt")
+public class DeleteOwnerToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -103,7 +103,7 @@ public class XimoDeleteOwnerTransactionIotAdapt extends DatabusAdaptImpl {
 
 
             postParameters.add("extCommunityUuid", ownerPo.getCommunityId());
             postParameters.add("extCommunityUuid", ownerPo.getCommunityId());
             postParameters.add("uuids", ownerPo.getMemberId());
             postParameters.add("uuids", ownerPo.getMemberId());
-            ximoMachineAsynImpl.sendDeleteOwner(postParameters);
+            hcMachineAsynImpl.sendDeleteOwner(postParameters);
         }
         }
 
 
     }
     }

+ 7 - 7
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoEditOwnerTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -27,7 +27,7 @@ import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -40,15 +40,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * HC iot 添加业主同步细末
+ * HC iot 添加业主同步iot
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoEditOwnerTransactionIotAdapt")
-public class XimoEditOwnerTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "editOwnerToIotAdapt")
+public class EditOwnerToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -146,7 +146,7 @@ public class XimoEditOwnerTransactionIotAdapt extends DatabusAdaptImpl {
             postParameters.add("uuid", ownerPo.getMemberId());
             postParameters.add("uuid", ownerPo.getMemberId());
             postParameters.add("name", ownerPo.getName());
             postParameters.add("name", ownerPo.getName());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
-            ximoMachineAsynImpl.sendUpdateOwner(postParameters);
+            hcMachineAsynImpl.sendUpdateOwner(postParameters);
         }
         }
 
 
     }
     }

+ 5 - 5
service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Synchronized;
 import com.java110.core.annotation.Java110Synchronized;
@@ -32,15 +32,15 @@ import org.springframework.http.*;
 public class GetToken {
 public class GetToken {
 
 
 
 
-    @Java110Synchronized(value = "ximo_get_token")
+    @Java110Synchronized(value = "hc_get_token")
     public static String get(RestTemplate restTemplate) {
     public static String get(RestTemplate restTemplate) {
-        String token = CommonCache.getValue(XimoIotConstant.XI_MO_TOKEN);
+        String token = CommonCache.getValue(IotConstant.HC_TOKEN);
         if (!StringUtil.isEmpty(token)) {
         if (!StringUtil.isEmpty(token)) {
             return token;
             return token;
         }
         }
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
         HttpEntity httpEntity = new HttpEntity(headers);
         HttpEntity httpEntity = new HttpEntity(headers);
-        ResponseEntity<String> tokenRes = restTemplate.exchange(XimoIotConstant.GET_TOKEN_URL, HttpMethod.GET, httpEntity, String.class);
+        ResponseEntity<String> tokenRes = restTemplate.exchange(IotConstant.GET_TOKEN_URL, HttpMethod.GET, httpEntity, String.class);
 
 
         if (tokenRes.getStatusCode() != HttpStatus.OK) {
         if (tokenRes.getStatusCode() != HttpStatus.OK) {
             throw new IllegalArgumentException("获取token失败" + tokenRes.getBody());
             throw new IllegalArgumentException("获取token失败" + tokenRes.getBody());
@@ -54,7 +54,7 @@ public class GetToken {
         token = tokenObj.getJSONObject("data").getString("accessToken");
         token = tokenObj.getJSONObject("data").getString("accessToken");
         int expiresIn = tokenObj.getJSONObject("data").getInteger("expiresIn");
         int expiresIn = tokenObj.getJSONObject("data").getInteger("expiresIn");
 
 
-        CommonCache.setValue(XimoIotConstant.XI_MO_TOKEN, token, expiresIn - 200);
+        CommonCache.setValue(IotConstant.HC_TOKEN, token, expiresIn - 200);
 
 
         return token;
         return token;
     }
     }

+ 14 - 13
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoIotConstant.java

@@ -13,35 +13,36 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 /**
 /**
- * 吸墨常量类
+ * HC 物联网常量类
  *
  *
  * @desc add by 吴学文 9:49
  * @desc add by 吴学文 9:49
  */
  */
-public class XimoIotConstant {
+public class IotConstant {
 
 
-    public static final String IOT_URL = "https://cloud-api.test.thinmoo.com/";
+    public static final String IOT_URL = "https://things.homecommunity.cn:9999/";
 
 
     public static final String APP_ID = "e86a6a373c354927bea5fd21a0bec617";
     public static final String APP_ID = "e86a6a373c354927bea5fd21a0bec617";
     public static final String APP_SECRET = "ead9a2f67f96e2b8ed2fe38cc9709463";
     public static final String APP_SECRET = "ead9a2f67f96e2b8ed2fe38cc9709463";
 
 
-    public static final String GET_TOKEN_URL = IOT_URL + "/platCompany/extapi/getAccessToken?appId=" + APP_ID + "&appSecret=" + APP_SECRET;
+    public static final String GET_TOKEN_URL = IOT_URL + " /extApi/auth/getAccessToken?appId=" + APP_ID + "&appSecret=" + APP_SECRET;
 
 
     //添加设备
     //添加设备
-    public static final String ADD_MACHINE_URL = IOT_URL + "/devDevice/extapi/add";
-    public static final String UPDATE_MACHINE_URL = IOT_URL + "/devDevice/extapi/update";
-    public static final String DELETE_MACHINE_URL = IOT_URL + "/devDevice/extapi/delete";
-    public static final String OPEN_DOOR = IOT_URL + "/sqDoor/extapi/remoteOpenDoor";
+    public static final String ADD_MACHINE_URL = IOT_URL + "/extApi/machine/addMachine";
+    public static final String UPDATE_MACHINE_URL = IOT_URL + "/extApi/machine/updateMachine";
+    public static final String DELETE_MACHINE_URL = IOT_URL + "/extApi/machine/deleteMachine";
+    public static final String OPEN_DOOR = IOT_URL + "/extApi/machine/openDoor";
+    public static final String RESTART_MACHINE = IOT_URL + "/extApi/machine/restartMachine";
 
 
-    public static final String XI_MO_TOKEN = "XI_MO_TOKEN";
+    public static final String HC_TOKEN = "HC_ACCESS_TOKEN";
 
 
     //单位为秒
     //单位为秒
     public static final int DEFAULT_LOG_TIME = 5 * 60;
     public static final int DEFAULT_LOG_TIME = 5 * 60;
 
 
     //添加业主
     //添加业主
-    public static final String ADD_OWNER = "/persEmpHousehold/extapi/add";
-    public static final String EDIT_OWNER = "/persEmpHousehold/extapi/update";
-    public static final String DELETE_OWNER = "/persEmpHousehold/extapi/delete";
+    public static final String ADD_OWNER = "/extApi/user/addUser";
+    public static final String EDIT_OWNER = "/extApi/user/updateUser";
+    public static final String DELETE_OWNER = "/extApi/user/deleteUser";
 }
 }

+ 0 - 42
service-job/src/main/java/com/java110/job/adapt/hcIot/MachineTransactionIotAdapt.java

@@ -1,42 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.job.adapt.hcIot;
-
-import com.java110.entity.order.Business;
-import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.IDatabusAdapt;
-import com.java110.job.adapt.hcIot.asyn.ITransactionMachineAsyn;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * HC iot 设备同步适配器
- *
- * @desc add by 吴学文 18:58
- */
-@Component(value = "machineTransactionIotAdapt")
-public class MachineTransactionIotAdapt extends DatabusAdaptImpl {
-
-    @Autowired
-    private ITransactionMachineAsyn transactionMachineAsynImpl;
-
-    @Override
-    public void execute(Business business, List<Business> businesses) {
-
-    }
-}

+ 6 - 6
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoModifyMachineTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -21,7 +21,7 @@ import com.java110.dto.machine.MachineDto;
 import com.java110.entity.order.Business;
 import com.java110.entity.order.Business;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.machine.MachinePo;
 import com.java110.po.machine.MachinePo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
@@ -37,11 +37,11 @@ import java.util.List;
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoModifyMachineTransactionIotAdapt")
-public class XimoModifyMachineTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "modifyMachineToIotAdapt")
+public class ModifyMachineToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
 
 
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
@@ -97,6 +97,6 @@ public class XimoModifyMachineTransactionIotAdapt extends DatabusAdaptImpl {
         postParameters.add("name", machinePo.getMachineName());
         postParameters.add("name", machinePo.getMachineName());
         postParameters.add("positionType", "0");
         postParameters.add("positionType", "0");
         postParameters.add("positionUuid", machinePo.getCommunityId());
         postParameters.add("positionUuid", machinePo.getCommunityId());
-        ximoMachineAsynImpl.updateSend(postParameters);
+        hcMachineAsynImpl.updateSend(postParameters);
     }
     }
 }
 }

+ 4 - 4
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOpenDoorAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
 import com.java110.core.client.RestTemplate;
@@ -33,8 +33,8 @@ import java.util.List;
  *
  *
  * @desc add by 吴学文 15:29
  * @desc add by 吴学文 15:29
  */
  */
-@Component(value = "ximoOpenDoorAdapt")
-public class XimoOpenDoorAdapt extends DatabusAdaptImpl {
+@Component(value = "openDoorAdapt")
+public class OpenDoorAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
     RestTemplate outRestTemplate;
     RestTemplate outRestTemplate;
@@ -59,7 +59,7 @@ public class XimoOpenDoorAdapt extends DatabusAdaptImpl {
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = outRestTemplate.exchange(XimoIotConstant.OPEN_DOOR, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.OPEN_DOOR, HttpMethod.POST, httpEntity, String.class);
 
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
             return new ResultVo(ResultVo.CODE_ERROR, responseEntity.getBody());
             return new ResultVo(ResultVo.CODE_ERROR, responseEntity.getBody());

+ 7 - 7
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOwnerBindRoomTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -29,7 +29,7 @@ import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerRoomRelPo;
 import com.java110.po.owner.OwnerRoomRelPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
@@ -43,15 +43,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * HC iot 添加业主同步细末
+ * HC  添加业主同步iot
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoOwnerBindRoomTransactionIotAdapt")
-public class XimoOwnerBindRoomTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "ownerBindRoomToIotAdapt")
+public class OwnerBindRoomToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -165,7 +165,7 @@ public class XimoOwnerBindRoomTransactionIotAdapt extends DatabusAdaptImpl {
             postParameters.add("uuid", tOwnerDto.getMemberId());
             postParameters.add("uuid", tOwnerDto.getMemberId());
             postParameters.add("name", tOwnerDto.getName());
             postParameters.add("name", tOwnerDto.getName());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
             postParameters.add("faceFileBase64Array", fileDtos.get(0).getContext());
-            ximoMachineAsynImpl.sendOwner(postParameters);
+            hcMachineAsynImpl.sendOwner(postParameters);
         }
         }
     }
     }
 }
 }

+ 7 - 7
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoOwnerUnBindRoomTransactionIotAdapt.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot;
+package com.java110.job.adapt.hcIot;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -27,7 +27,7 @@ import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerPo;
 import com.java110.po.owner.OwnerRoomRelPo;
 import com.java110.po.owner.OwnerRoomRelPo;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
@@ -41,15 +41,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * HC iot 添加业主同步细末
+ * HC  添加业主同步iot
  *
  *
  * @desc add by 吴学文 18:58
  * @desc add by 吴学文 18:58
  */
  */
-@Component(value = "ximoOwnerUnBindRoomTransactionIotAdapt")
-public class XimoOwnerUnBindRoomTransactionIotAdapt extends DatabusAdaptImpl {
+@Component(value = "ownerUnBindRoomToIotAdapt")
+public class OwnerUnBindRoomToIotAdapt extends DatabusAdaptImpl {
 
 
     @Autowired
     @Autowired
-    private IXimoMachineAsyn ximoMachineAsynImpl;
+    private IIotSendAsyn hcMachineAsynImpl;
     @Autowired
     @Autowired
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     IMachineInnerServiceSMO machineInnerServiceSMOImpl;
 
 
@@ -144,7 +144,7 @@ public class XimoOwnerUnBindRoomTransactionIotAdapt extends DatabusAdaptImpl {
 
 
             postParameters.add("extCommunityUuid", tOwnerDto.getCommunityId());
             postParameters.add("extCommunityUuid", tOwnerDto.getCommunityId());
             postParameters.add("uuids", tOwnerDto.getMemberId());
             postParameters.add("uuids", tOwnerDto.getMemberId());
-            ximoMachineAsynImpl.sendDeleteOwner(postParameters);
+            hcMachineAsynImpl.sendDeleteOwner(postParameters);
         }
         }
     }
     }
 }
 }

+ 14 - 3
service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/IXimoMachineAsyn.java

@@ -1,4 +1,4 @@
-package com.java110.job.adapt.ximoIot.asyn;/*
+/*
  * Copyright 2017-2020 吴学文 and java110 team.
  * Copyright 2017-2020 吴学文 and java110 team.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,14 +13,23 @@ package com.java110.job.adapt.ximoIot.asyn;/*
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
+package com.java110.job.adapt.hcIot.asyn;
 
 
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.util.MultiValueMap;
 import org.springframework.util.MultiValueMap;
 
 
 import java.util.List;
 import java.util.List;
 
 
-public interface IXimoMachineAsyn {
+public interface IIotSendAsyn {
 
 
-    public void send(MultiValueMap<String, Object> postParameters, List<MultiValueMap<String, Object>> ownerDtos);
+    /**
+     * 添加小区信息
+     *
+     * @param postParameters
+     */
+    public void addCommunity(JSONObject postParameters);
+
+    public void addMachine(MultiValueMap<String, Object> postParameters, List<MultiValueMap<String, Object>> ownerDtos);
 
 
     void updateSend(MultiValueMap<String, Object> postParameters);
     void updateSend(MultiValueMap<String, Object> postParameters);
 
 
@@ -30,12 +39,14 @@ public interface IXimoMachineAsyn {
 
 
     /**
     /**
      * 修改业主
      * 修改业主
+     *
      * @param postParameters
      * @param postParameters
      */
      */
     void sendUpdateOwner(MultiValueMap<String, Object> postParameters);
     void sendUpdateOwner(MultiValueMap<String, Object> postParameters);
 
 
     /**
     /**
      * 删除业主
      * 删除业主
+     *
      * @param postParameters
      * @param postParameters
      */
      */
     void sendDeleteOwner(MultiValueMap<String, Object> postParameters);
     void sendDeleteOwner(MultiValueMap<String, Object> postParameters);

+ 0 - 24
service-job/src/main/java/com/java110/job/adapt/hcIot/asyn/ITransactionMachineAsyn.java

@@ -1,24 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.job.adapt.hcIot.asyn;
-
-/**
- * 设备同步 异步处理
- */
-public interface ITransactionMachineAsyn {
-
-    void doSend();
-}

+ 32 - 20
service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/impl/XimoMachineAsynImpl.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * limitations under the License.
  */
  */
-package com.java110.job.adapt.ximoIot.asyn.impl;
+package com.java110.job.adapt.hcIot.asyn.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
 import com.java110.core.client.RestTemplate;
@@ -21,9 +21,9 @@ import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.machine.MachineDto;
 import com.java110.dto.machine.MachineDto;
 import com.java110.intf.common.IMachineAttrInnerServiceSMO;
 import com.java110.intf.common.IMachineAttrInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.intf.common.IMachineInnerServiceSMO;
-import com.java110.job.adapt.ximoIot.GetToken;
-import com.java110.job.adapt.ximoIot.XimoIotConstant;
-import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.job.adapt.hcIot.GetToken;
+import com.java110.job.adapt.hcIot.IotConstant;
+import com.java110.job.adapt.hcIot.asyn.IIotSendAsyn;
 import com.java110.po.machine.MachineAttrPo;
 import com.java110.po.machine.MachineAttrPo;
 import com.java110.vo.ResultVo;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -40,12 +40,12 @@ import java.util.List;
  * @desc add by 吴学文 11:55
  * @desc add by 吴学文 11:55
  */
  */
 @Service
 @Service
-public class XimoMachineAsynImpl implements IXimoMachineAsyn {
-    private static final Logger logger = LoggerFactory.getLogger(XimoMachineAsynImpl.class);
+public class IotSendAsynImpl implements IIotSendAsyn {
+    private static final Logger logger = LoggerFactory.getLogger(IotSendAsynImpl.class);
 
 
 
 
     @Autowired
     @Autowired
-    private RestTemplate formRestTemplate;
+    private RestTemplate outRestTemplate;
 
 
     @Autowired
     @Autowired
     private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
     private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
@@ -53,15 +53,27 @@ public class XimoMachineAsynImpl implements IXimoMachineAsyn {
     @Autowired
     @Autowired
     private IMachineAttrInnerServiceSMO machineAttrInnerServiceSMOImpl;
     private IMachineAttrInnerServiceSMO machineAttrInnerServiceSMOImpl;
 
 
+
+    @Override
+    @Async
+    public void addCommunity(JSONObject postParameters) {
+        postParameters.put("accessToken", GetToken.get(outRestTemplate));
+        HttpHeaders httpHeaders = new HttpHeaders();
+        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.DELETE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
+
+        logger.debug("调用吸墨信息:" + responseEntity);
+    }
+
     @Override
     @Override
     @Async
     @Async
-    public void send(MultiValueMap<String, Object> postParameters, List<MultiValueMap<String, Object>> ownerDtos) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+    public void addMachine(MultiValueMap<String, Object> postParameters, List<MultiValueMap<String, Object>> ownerDtos) {
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.ADD_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.ADD_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
 
 
@@ -100,60 +112,60 @@ public class XimoMachineAsynImpl implements IXimoMachineAsyn {
     @Override
     @Override
     @Async
     @Async
     public void updateSend(MultiValueMap<String, Object> postParameters) {
     public void updateSend(MultiValueMap<String, Object> postParameters) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.UPDATE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.UPDATE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
     }
     }
 
 
     @Override
     @Override
     public void deleteSend(MultiValueMap<String, Object> postParameters) {
     public void deleteSend(MultiValueMap<String, Object> postParameters) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.DELETE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.DELETE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
     }
     }
 
 
     @Override
     @Override
     public void sendOwner(MultiValueMap<String, Object> postParameters) {
     public void sendOwner(MultiValueMap<String, Object> postParameters) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.ADD_OWNER, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.ADD_OWNER, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
     }
     }
 
 
     @Override
     @Override
     public void sendUpdateOwner(MultiValueMap<String, Object> postParameters) {
     public void sendUpdateOwner(MultiValueMap<String, Object> postParameters) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.EDIT_OWNER, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.EDIT_OWNER, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
     }
     }
 
 
     @Override
     @Override
     public void sendDeleteOwner(MultiValueMap<String, Object> postParameters) {
     public void sendDeleteOwner(MultiValueMap<String, Object> postParameters) {
-        postParameters.add("accessToken", GetToken.get(formRestTemplate));
+        postParameters.add("accessToken", GetToken.get(outRestTemplate));
         HttpHeaders httpHeaders = new HttpHeaders();
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
         httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
 
 
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
         HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = formRestTemplate.exchange(XimoIotConstant.DELETE_OWNER, HttpMethod.POST, httpEntity, String.class);
+        ResponseEntity<String> responseEntity = outRestTemplate.exchange(IotConstant.DELETE_OWNER, HttpMethod.POST, httpEntity, String.class);
 
 
         logger.debug("调用吸墨信息:" + responseEntity);
         logger.debug("调用吸墨信息:" + responseEntity);
     }
     }

+ 0 - 33
service-job/src/main/java/com/java110/job/adapt/hcIot/asyn/impl/TransactionMachineAsynImpl.java

@@ -1,33 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.job.adapt.hcIot.asyn.impl;
-
-import com.java110.job.adapt.hcIot.asyn.ITransactionMachineAsyn;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-/**
- * @desc add by 吴学文 9:23
- */
-
-@Service
-public class TransactionMachineAsynImpl implements ITransactionMachineAsyn {
-    @Override
-    @Async
-    public void doSend() {
-
-    }
-}

+ 0 - 110
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoGetMachineStateAdapt.java

@@ -1,110 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.job.adapt.ximoIot;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.client.RestTemplate;
-import com.java110.dto.community.CommunityDto;
-import com.java110.dto.machine.MachineDto;
-import com.java110.dto.task.TaskDto;
-import com.java110.intf.common.IMachineInnerServiceSMO;
-import com.java110.job.quartz.TaskSystemQuartz;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-import java.util.List;
-
-/**
- * @desc add by 吴学文 12:28
- */
-@Service("ximoGetMachineStateAdapt")
-public class XimoGetMachineStateAdapt extends TaskSystemQuartz {
-
-    @Autowired
-    private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
-    @Autowired
-    private RestTemplate outRestTemplate;
-
-    @Override
-    protected void process(TaskDto taskDto) throws Exception {
-        // 获取小区
-        List<CommunityDto> communityDtos = getAllCommunity();
-
-        for (CommunityDto communityDto : communityDtos) {
-            queryMachineStatue(taskDto, communityDto);
-        }
-    }
-
-    private void queryMachineStatue(TaskDto taskDto, CommunityDto communityDto) {
-
-        MachineDto machineDto = new MachineDto();
-        machineDto.setCommunityId(communityDto.getCommunityId());
-        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
-
-        StringBuilder devSns = new StringBuilder();
-
-        for (MachineDto tmpMachineDto : machineDtos) {
-            devSns.append(tmpMachineDto.getMachineCode());
-            devSns.append(",");
-        }
-
-        String devSnsString = devSns.toString().endsWith(",")
-                ? devSns.toString().substring(0, devSns.length() - 2) : devSns.toString();
-        MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
-        postParameters.add("devSns", devSnsString);
-        postParameters.add("accessToken", GetToken.get(outRestTemplate));
-        HttpHeaders httpHeaders = new HttpHeaders();
-        httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
-
-        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = outRestTemplate.exchange(XimoIotConstant.UPDATE_MACHINE_URL, HttpMethod.POST, httpEntity, String.class);
-
-        if (responseEntity.getStatusCode() != null) {
-            throw new IllegalArgumentException("获取token失败" + responseEntity.getBody());
-        }
-        JSONObject tokenObj = JSONObject.parseObject(responseEntity.getBody());
-
-        if (!tokenObj.containsKey("code") || ResultVo.CODE_OK != tokenObj.getInteger("code")) {
-            throw new IllegalArgumentException("获取token失败" + responseEntity.getBody());
-        }
-
-        JSONArray data = tokenObj.getJSONArray("data");
-        MachineDto tMachineDto = null;
-        for (int dataIndex = 0; dataIndex < data.size(); dataIndex++) {
-            for (MachineDto tmpMachineDto : machineDtos) {
-                if (!data.getJSONObject(dataIndex).getString("devSn").equals(tmpMachineDto.getMachineCode())) {
-                    continue;
-                }
-                tMachineDto = new MachineDto();
-                tMachineDto.setMachineId(tmpMachineDto.getMachineId());
-                tMachineDto.setState("1".equals(data.getJSONObject(dataIndex).getString("connectionStatus"))
-                        ? MachineDto.MACHINE_STATE_ON : MachineDto.MACHINE_STATE_OFF);
-                machineInnerServiceSMOImpl.updateMachineState(tMachineDto);
-            }
-        }
-
-
-        logger.debug("调用吸墨信息:" + responseEntity);
-    }
-}

+ 0 - 201
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoGetOpenDoorLogAdapt.java

@@ -1,201 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.job.adapt.ximoIot;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.client.RestTemplate;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.dto.community.CommunityDto;
-import com.java110.dto.file.FileDto;
-import com.java110.dto.machine.MachineDto;
-import com.java110.dto.owner.OwnerDto;
-import com.java110.dto.task.TaskDto;
-import com.java110.intf.common.IFileInnerServiceSMO;
-import com.java110.intf.common.IFileRelInnerServiceSMO;
-import com.java110.intf.common.IMachineInnerServiceSMO;
-import com.java110.intf.common.IMachineRecordInnerServiceSMO;
-import com.java110.intf.user.IOwnerInnerServiceSMO;
-import com.java110.job.quartz.TaskSystemQuartz;
-import com.java110.po.file.FileRelPo;
-import com.java110.po.machine.MachineRecordPo;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.ImageUtils;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @desc add by 吴学文 12:28
- */
-@Service("ximoGetOpenDoorLogAdapt")
-public class XimoGetOpenDoorLogAdapt extends TaskSystemQuartz {
-
-    private static Date preDate = null;
-
-    @Autowired
-    private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
-    @Autowired
-    private RestTemplate outRestTemplate;
-
-    @Autowired
-    private IMachineRecordInnerServiceSMO machineRecordInnerServiceSMOImpl;
-
-    @Autowired
-    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
-
-    @Autowired
-    private IFileInnerServiceSMO fileInnerServiceSMOImpl;
-
-    @Autowired
-    private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
-
-    @Override
-    protected void process(TaskDto taskDto) throws Exception {
-        // 获取小区
-        List<CommunityDto> communityDtos = getAllCommunity();
-
-        for (CommunityDto communityDto : communityDtos) {
-            queryOpenDoorLog(taskDto, communityDto);
-        }
-    }
-
-    private void queryOpenDoorLog(TaskDto taskDto, CommunityDto communityDto) {
-
-        if (preDate == null) {
-            preDate = new Date();
-        }
-
-        MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
-        postParameters.add("extCommunityUuid", communityDto.getCommunityId());
-        postParameters.add("startDateTime", DateUtil.getFormatTimeString(preDate, DateUtil.DATE_FORMATE_STRING_A));
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(preDate);
-        calendar.add(Calendar.SECOND, XimoIotConstant.DEFAULT_LOG_TIME);
-        postParameters.add("endDateTime", DateUtil.getFormatTimeString(calendar.getTime(), DateUtil.DATE_FORMATE_STRING_A));
-        postParameters.add("currPage", 1);
-        postParameters.add("pageSize", 200);
-        HttpHeaders httpHeaders = new HttpHeaders();
-        httpHeaders.add("Content-Type", "application/x-www-form-urlencoded");
-
-        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(postParameters, httpHeaders);
-        ResponseEntity<String> responseEntity = outRestTemplate.exchange(XimoIotConstant.UPDATE_MACHINE_URL, HttpMethod.GET, httpEntity, String.class);
-
-        if (responseEntity.getStatusCode() != null) {
-            throw new IllegalArgumentException("获取token失败" + responseEntity.getBody());
-        }
-        JSONObject tokenObj = JSONObject.parseObject(responseEntity.getBody());
-
-        if (!tokenObj.containsKey("code") || ResultVo.CODE_OK != tokenObj.getInteger("code")) {
-            throw new IllegalArgumentException("获取token失败" + responseEntity.getBody());
-        }
-
-        preDate = calendar.getTime();
-
-        JSONArray list = tokenObj.getJSONObject("data").getJSONArray("list");
-        MachineDto tMachineDto = null;
-        List<MachineRecordPo> machineRecordPos = new ArrayList<>();
-        for (int dataIndex = 0; dataIndex < list.size(); dataIndex++) {
-            saveMachineOpenDoor(list.getJSONObject(dataIndex), communityDto, machineRecordPos);
-        }
-
-        machineRecordInnerServiceSMOImpl.saveMachineRecords(machineRecordPos);
-        logger.debug("调用吸墨信息:" + responseEntity);
-    }
-
-    private void saveMachineOpenDoor(JSONObject jsonObject, CommunityDto communityDto, List<MachineRecordPo> machineRecordPos) {
-
-        String machineCode = jsonObject.getString("devSn");
-        MachineDto machineDto = new MachineDto();
-        machineDto.setCommunityId(communityDto.getCommunityId());
-        machineDto.setMachineCode(machineCode);
-        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
-
-        //设备不存在
-        if (machineDtos == null || machineDtos.size() < 1) {
-            return;
-        }
-
-        String ownerId = "";
-        String tel = "";
-        String idCard = "";
-
-        if (jsonObject.containsKey("empUuid")) {
-            OwnerDto ownerDto = new OwnerDto();
-            ownerDto.setOwnerId(jsonObject.getString("empUuid"));
-            ownerDto.setCommunityId(communityDto.getCommunityId());
-            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
-
-            if (ownerDtos != null && ownerDtos.size() > 0) {
-                ownerId = ownerDtos.get(0).getOwnerId();
-                tel = ownerDtos.get(0).getLink();
-                idCard = ownerDtos.get(0).getIdCard();
-            }
-        }
-
-        machineDto = machineDtos.get(0);
-
-        MachineRecordPo machineRecordPo = new MachineRecordPo();
-        machineRecordPo.setCommunityId(communityDto.getCommunityId());
-        machineRecordPo.setMachineCode(machineDto.getMachineCode());
-        machineRecordPo.setMachineId(machineDto.getMachineId());
-        machineRecordPo.setMachineRecordId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineRecordId));
-        machineRecordPo.setOpenTypeCd("21".equals(jsonObject.getString("eventType")) ? "1000" : "2000");
-        machineRecordPo.setName(jsonObject.getString("empName"));
-
-        machineRecordPo.setTel(tel);
-        machineRecordPo.setIdCard(idCard);
-        machineRecordPo.setRecordTypeCd("8888");
-        machineRecordPo.setFileTime(jsonObject.getString("eventTime"));
-
-        if (!jsonObject.containsKey("captureImage") || !jsonObject.getString("captureImage").startsWith("http")) {
-            return;
-        }
-
-        String img = ImageUtils.getBase64ByImgUrl(jsonObject.getString("captureImage"));
-        String fileId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id);
-
-        FileDto fileDto = new FileDto();
-        fileDto.setCommunityId(communityDto.getCommunityId());
-        fileDto.setFileId(fileId);
-        fileDto.setFileName(fileId);
-        fileDto.setContext(img);
-        fileDto.setSuffix("jpeg");
-        String fileName = fileInnerServiceSMOImpl.saveFile(fileDto);
-        JSONObject businessUnit = new JSONObject();
-        businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fileRelId));
-        businessUnit.put("relTypeCd", "60000");
-        businessUnit.put("saveWay", "ftp");
-        businessUnit.put("objId", machineRecordPo.getMachineRecordId());
-        businessUnit.put("fileRealName", fileId);
-        businessUnit.put("fileSaveName", fileName);
-        fileRelInnerServiceSMOImpl.saveFileRel(BeanConvertUtil.covertBean(businessUnit, FileRelPo.class));
-        machineRecordPo.setFileId(fileId);
-
-    }
-}