|
@@ -13,6 +13,7 @@ import com.community.huiju.service.IHKService;
|
13
|
13
|
import com.google.common.collect.Lists;
|
14
|
14
|
import com.google.common.collect.Maps;
|
15
|
15
|
import lombok.extern.slf4j.Slf4j;
|
|
16
|
+import org.apache.commons.collections.CollectionUtils;
|
16
|
17
|
import org.apache.commons.lang.StringUtils;
|
17
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
18
|
19
|
import org.springframework.stereotype.Service;
|
|
@@ -131,8 +132,14 @@ public class HKServiceImpl implements IHKService {
|
131
|
132
|
addOutDoorAuthMap.put("personIds", Arrays.asList(user.getHkUserId()));
|
132
|
133
|
addOutDoorAuthMap.put("secret", tpEquipmentTree.getSecret());
|
133
|
134
|
addOutDoorAuthMap.put("appkey", tpEquipmentTree.getAppkey());
|
134
|
|
- List<String> visualList = new ArrayList<>();
|
135
|
|
- visualList.add("10010100000");
|
|
135
|
+
|
|
136
|
+ // 单元门口机
|
|
137
|
+ List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(userVerify.getCommunityId(), userVerify.getUnitId(), 3);
|
|
138
|
+ List<String> visualList = visualEquipments.stream()
|
|
139
|
+ .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
|
|
140
|
+ .collect(Collectors.toList());
|
|
141
|
+// List<String> visualList = new ArrayList<>();
|
|
142
|
+// visualList.add("10010100000");
|
136
|
143
|
addOutDoorAuthMap.put("longNums", visualList);
|
137
|
144
|
// 可视对讲下发 权限
|
138
|
145
|
visualIntercomPermissions(addOutDoorAuthMap);
|
|
@@ -319,12 +326,28 @@ public class HKServiceImpl implements IHKService {
|
319
|
326
|
// 查询当前的房产
|
320
|
327
|
TaUserVerify userVerify = taUserVerifyMapper.selectByPrimaryKey(userVerifyId);
|
321
|
328
|
TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(userVerify.getCommunityId());
|
|
329
|
+ // 单元门口机
|
|
330
|
+ List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(userVerify.getCommunityId(), userVerify.getUnitId(), 3);
|
|
331
|
+
|
|
332
|
+ if (CollectionUtils.isEmpty(tpEquipments)) {
|
|
333
|
+ responseBean.addError("无设备信息!");
|
|
334
|
+ return responseBean;
|
|
335
|
+ }
|
|
336
|
+
|
|
337
|
+ String str = "";
|
|
338
|
+ for (TpEquipment e : tpEquipments) {
|
|
339
|
+ TpConfiguration tpConfiguration = tpConfigurationMapper.selectByPrimaryKey(e.getUuidId());
|
|
340
|
+ str += tpConfiguration.getConfigurationValue();
|
|
341
|
+ str += ",";
|
|
342
|
+ }
|
322
|
343
|
|
323
|
|
- // TODO 查询设备编号
|
|
344
|
+ // 查询设备编号
|
324
|
345
|
|
325
|
346
|
Map<String,Object> parMap = com.beust.jcommander.internal.Maps.newHashMap();
|
326
|
|
- parMap.put("longNums", "10010100000");
|
|
347
|
+ parMap.put("longNums", str);
|
327
|
348
|
parMap.put("openapi_ip_port_http", tpEquipmentTree.getHttpServer());
|
|
349
|
+ parMap.put("secret", tpEquipmentTree.getSecret());
|
|
350
|
+ parMap.put("appkey", tpEquipmentTree.getAppkey());
|
328
|
351
|
String data = HKOpenApi.syncControl(parMap);
|
329
|
352
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
330
|
353
|
int errorCode = jsonObject.getInteger("errorCode");
|