Browse Source

修复 bug

魏熙美 6 years ago
parent
commit
aafb37e139

+ 12
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserLicenseController.java View File

81
         return responseBean;
81
         return responseBean;
82
     }
82
     }
83
 
83
 
84
+    @ApiOperation(value = "获取用户车牌信息", notes = "获取用户车牌信息")
85
+    @ApiImplicitParams({
86
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token"),
87
+            @ApiImplicitParam(paramType = "path", dataTypeClass = String.class, name = "licenseId", value = "车牌id"),
88
+    })
89
+    @RequestMapping(value = "/license/user/{licenseId}", method = RequestMethod.GET)
90
+    public ResponseBean getUserLicenseAndUserId(HttpSession session, @PathVariable("licenseId") Integer licenseId) {
91
+        ResponseBean responseBean = new ResponseBean();
92
+        UserElement userElement = getUserElement(session);
93
+        responseBean = iTaUserLicenseService.getUserLicenseAndUserId(userElement, licenseId);
94
+        return responseBean;
95
+    }
84
 
96
 
85
 
97
 
86
 }
98
 }

+ 17
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpEquipmentMapper.java View File

82
             "where trne.community_id=#{communityId} and trne.unit_id=#{unitId} and te.equipment_type=#{equipmentType}")
82
             "where trne.community_id=#{communityId} and trne.unit_id=#{unitId} and te.equipment_type=#{equipmentType}")
83
     List<TpEquipment> selectByCommunityIdAndUnitId(@Param("communityId") Integer communityId, @Param("unitId") Integer unitId, @Param("equipmentType") Integer equipmentType);
83
     List<TpEquipment> selectByCommunityIdAndUnitId(@Param("communityId") Integer communityId, @Param("unitId") Integer unitId, @Param("equipmentType") Integer equipmentType);
84
 
84
 
85
+    /**
86
+     * 根据小区 和 单元号 查询所有人脸设备
87
+     * @param communityId
88
+     * @param unitId
89
+     * @return
90
+     */
91
+    @ResultMap("BaseResultMap")
92
+    @Select("select " +
93
+            "te.* " +
94
+            "from tp_unit_equipment trne left join tp_equipment te " +
95
+            "on trne.equipment_id = te.id " +
96
+            "LEFT JOIN tp_configuration tc ON te.uuid_id = tc.id " +
97
+            "where trne.community_id=#{communityId} and trne.unit_id=#{unitId} and te.equipment_type=#{equipmentType} " +
98
+            "AND tc.device_type = 1")
99
+    List<TpEquipment> selectByCommunityIdAndUnitIdAndFace(@Param("communityId") Integer communityId, @Param("unitId") Integer unitId, @Param("equipmentType") Integer equipmentType);
100
+
101
+
85
 }
102
 }

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserLicenseService.java View File

38
      */
38
      */
39
     ResponseBean deleteUserLicense(UserElement userElement, Integer licenseId);
39
     ResponseBean deleteUserLicense(UserElement userElement, Integer licenseId);
40
 
40
 
41
+    /**
42
+     * 查询 车牌
43
+     * @param userElement
44
+     * @param licenseId
45
+     * @return
46
+     */
47
+    ResponseBean getUserLicenseAndUserId(UserElement userElement, Integer licenseId);
48
+
41
 }
49
 }

+ 9
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java View File

15
 import com.community.huiju.service.ImageServiceI;
15
 import com.community.huiju.service.ImageServiceI;
16
 import com.google.common.collect.Maps;
16
 import com.google.common.collect.Maps;
17
 import lombok.extern.slf4j.Slf4j;
17
 import lombok.extern.slf4j.Slf4j;
18
+import org.apache.commons.collections.CollectionUtils;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.http.HttpEntity;
20
 import org.springframework.http.HttpEntity;
20
 import org.springframework.http.HttpHeaders;
21
 import org.springframework.http.HttpHeaders;
216
                 // 设备树
217
                 // 设备树
217
                 TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(communityId);
218
                 TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(communityId);
218
                 // 所有设备
219
                 // 所有设备
219
-                List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 4);
220
+                // List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 4);
221
+                List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitIdAndFace(communityId, unitId, 4);
220
                 List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
222
                 List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
221
                 StringBuilder doorUuids = new StringBuilder();
223
                 StringBuilder doorUuids = new StringBuilder();
222
                 StringBuilder deviceUuids = new StringBuilder();
224
                 StringBuilder deviceUuids = new StringBuilder();
243
 
245
 
244
                 // 单元门口机
246
                 // 单元门口机
245
                 List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 3);
247
                 List<TpEquipment> visualEquipments = tpEquipmentMapper.selectByCommunityIdAndUnitId(communityId, unitId, 3);
246
-                List<String> visualList = visualEquipments.stream()
247
-                        .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
248
-                        .collect(Collectors.toList());
248
+                if (CollectionUtils.isNotEmpty(visualEquipments)) {
249
+                    List<String> visualList = visualEquipments.stream()
250
+                            .map(e-> tpConfigurationMapper.selectByPrimaryKey(e.getUuidId()).getConfigurationValue())
251
+                            .collect(Collectors.toList());
249
 //                List<String> visualList = new ArrayList<>();
252
 //                List<String> visualList = new ArrayList<>();
250
 //                visualList.add("10010100000");
253
 //                visualList.add("10010100000");
251
-                HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
254
+                    HKOpenApi.visualIntercom(tpEquipmentTree.getOpUserUuid(), 1, userIdList, visualList, tpEquipmentTree.getAppkey(), tpEquipmentTree.getSecret(), tpEquipmentTree.getHttpServer());
255
+                }
252
             } else {
256
             } else {
253
                 responseBean.addError("请录入正确图片");
257
                 responseBean.addError("请录入正确图片");
254
             }
258
             }

+ 20
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserLicenseServiceImpl.java View File

104
         //2. 更新车牌信息
104
         //2. 更新车牌信息
105
 
105
 
106
         taUserLicenses = taUserLicenses.stream().map(e-> {
106
         taUserLicenses = taUserLicenses.stream().map(e-> {
107
+            TaUserLicense userLicense = getTaUserLicense(e.getLicensePlate(), e);
108
+            userLicense.setUpdateDate(new Date());
109
+            userLicense.setUpdateUser(userElement.getId());
110
+            taUserLicenseMapper.updateByPrimaryKeySelective(userLicense);
107
             e.setUnitPrice(String.valueOf(Double.valueOf(e.getUnitPrice()) / 100));
111
             e.setUnitPrice(String.valueOf(Double.valueOf(e.getUnitPrice()) / 100));
108
             return e;
112
             return e;
109
         }).collect(Collectors.toList());
113
         }).collect(Collectors.toList());
140
         taUserLicense.setLicensePlate(carNo);
144
         taUserLicense.setLicensePlate(carNo);
141
         String price = String.valueOf(Double.valueOf(((BigDecimal) jsonParam.get("Cost")).toString()) * 100);
145
         String price = String.valueOf(Double.valueOf(((BigDecimal) jsonParam.get("Cost")).toString()) * 100);
142
         taUserLicense.setUnitPrice(price.substring(0, price.lastIndexOf(".")));
146
         taUserLicense.setUnitPrice(price.substring(0, price.lastIndexOf(".")));
143
-        taUserLicense.setCreateDate(new Date());
144
         taUserLicense.setParkingLot(String.valueOf(jsonParam.get("ParkingName")));
147
         taUserLicense.setParkingLot(String.valueOf(jsonParam.get("ParkingName")));
145
         taUserLicense.setRenewTime(Integer.valueOf(String.valueOf(jsonParam.get("RenewTime"))));
148
         taUserLicense.setRenewTime(Integer.valueOf(String.valueOf(jsonParam.get("RenewTime"))));
146
 
149
 
169
         responseBean.addSuccess("操作成功!");
172
         responseBean.addSuccess("操作成功!");
170
         return responseBean;
173
         return responseBean;
171
     }
174
     }
175
+
176
+    @Override
177
+    public ResponseBean getUserLicenseAndUserId(UserElement userElement, Integer licenseId) {
178
+        ResponseBean responseBean = new ResponseBean();
179
+
180
+        TaUserLicense taUserLicense = taUserLicenseMapper.selectByUserIdAndCommunityIdAndLicenseId(userElement.getCommunityId(), userElement.getId(), licenseId);
181
+        if (null == taUserLicense) {
182
+            responseBean.addError("没有关联此车牌!");
183
+            return responseBean;
184
+        }
185
+
186
+        taUserLicense = getTaUserLicense(taUserLicense.getLicensePlate(), taUserLicense);
187
+        taUserLicenseMapper.updateByPrimaryKeySelective(taUserLicense);
188
+        responseBean.addSuccess(taUserLicense);
189
+        return responseBean;
190
+    }
172
 }
191
 }