Bladeren bron

修复 bug

魏熙美 6 jaren geleden
bovenliggende
commit
aafb37e139

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

@@ -81,6 +81,18 @@ public class UserLicenseController extends BaseController {
81 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 Bestand weergeven

@@ -82,4 +82,21 @@ public interface TpEquipmentMapper {
82 82
             "where trne.community_id=#{communityId} and trne.unit_id=#{unitId} and te.equipment_type=#{equipmentType}")
83 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 Bestand weergeven

@@ -38,4 +38,12 @@ public interface ITaUserLicenseService {
38 38
      */
39 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 Bestand weergeven

@@ -15,6 +15,7 @@ import com.community.huiju.service.IHKService;
15 15
 import com.community.huiju.service.ImageServiceI;
16 16
 import com.google.common.collect.Maps;
17 17
 import lombok.extern.slf4j.Slf4j;
18
+import org.apache.commons.collections.CollectionUtils;
18 19
 import org.springframework.beans.factory.annotation.Autowired;
19 20
 import org.springframework.http.HttpEntity;
20 21
 import org.springframework.http.HttpHeaders;
@@ -216,7 +217,8 @@ public class FaceServicelimpl implements FaceServiceI {
216 217
                 // 设备树
217 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 222
                 List<Map<String, Object>> equipmentUUID = getEquipmentUUID(tpEquipments);
221 223
                 StringBuilder doorUuids = new StringBuilder();
222 224
                 StringBuilder deviceUuids = new StringBuilder();
@@ -243,12 +245,14 @@ public class FaceServicelimpl implements FaceServiceI {
243 245
 
244 246
                 // 单元门口机
245 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 252
 //                List<String> visualList = new ArrayList<>();
250 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 256
             } else {
253 257
                 responseBean.addError("请录入正确图片");
254 258
             }

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

@@ -104,6 +104,10 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
104 104
         //2. 更新车牌信息
105 105
 
106 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 111
             e.setUnitPrice(String.valueOf(Double.valueOf(e.getUnitPrice()) / 100));
108 112
             return e;
109 113
         }).collect(Collectors.toList());
@@ -140,7 +144,6 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
140 144
         taUserLicense.setLicensePlate(carNo);
141 145
         String price = String.valueOf(Double.valueOf(((BigDecimal) jsonParam.get("Cost")).toString()) * 100);
142 146
         taUserLicense.setUnitPrice(price.substring(0, price.lastIndexOf(".")));
143
-        taUserLicense.setCreateDate(new Date());
144 147
         taUserLicense.setParkingLot(String.valueOf(jsonParam.get("ParkingName")));
145 148
         taUserLicense.setRenewTime(Integer.valueOf(String.valueOf(jsonParam.get("RenewTime"))));
146 149
 
@@ -169,4 +172,20 @@ public class TaUserLicenseServiceImpl implements ITaUserLicenseService {
169 172
         responseBean.addSuccess("操作成功!");
170 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
 }