Просмотр исходного кода

修复 删除楼栋资料 已认证和未认证, 修改 APP端手机号的时候同步楼栋资料

weiximei 6 лет назад
Родитель
Сommit
cc89831cbb

+ 21
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Просмотреть файл

@@ -309,6 +309,27 @@ public class TaUserServiceImpl implements ITaUserService {
309 309
             taUserMapper.updateLongName(taUser);
310 310
             response.addSuccess("修改成功");
311 311
             AppkeyCache.setCache(user.getLoginName(),"null");
312
+
313
+
314
+            /**
315
+             * 如果是家属或者租客,修改手机号, 就不允许修改资料库的信息
316
+             */
317
+
318
+            // 修改楼栋信息资料库的手机号
319
+            Map<String, Object> map = Maps.newHashMap();
320
+            map.put("communityId", user.getCommunityId());
321
+            map.put("userId", userId);
322
+            TaSysUserRole taSysUserRole = taSysUserRoleMapper.selectByCommunityIdAndUserId(map);
323
+            // 1 业主 2 租客 3 家属
324
+            // 只允许业主修改
325
+            if (taSysUserRole.getRoleId().intValue() == 1) {
326
+                // TODO 后期可能会有一个业主对应多个小区, 也就是会有多个资料, 具体看需求
327
+                // TODO 目前是一对一
328
+                TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectByPrimaryKey(user.getBuildingOwnerInfoId());
329
+                buildingOwnerInfo.setOwnerTel(phone);
330
+                tpBuildingOwnerInfoMapper.updateByPrimaryKeySelective(buildingOwnerInfo);
331
+            }
332
+
312 333
             return response;
313 334
         }else {
314 335
             response.addError("验证码错误或电话号码错误");

+ 1
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserController.java Просмотреть файл

@@ -55,7 +55,7 @@ public class UserController extends BaseController {
55 55
 	@ApiImplicitParams({
56 56
 			@ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "loginName手机号;code验证码;communityId小区Id")
57 57
 	})
58
-	@RequestMapping(value = "/user/login")
58
+	@RequestMapping(value = "/user/login", method = RequestMethod.POST)
59 59
 	public ResponseBean login(@RequestBody String parameter, HttpSession session){
60 60
 		ResponseBean responseBean = new ResponseBean();
61 61
 		JSONObject jsonObject = JSONObject.parseObject(parameter);

+ 59
- 37
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Просмотреть файл

@@ -580,51 +580,73 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
580 580
         return responseBean;
581 581
     }
582 582
 
583
+//    @Override
584
+//    @Transactional(rollbackFor = Exception.class)
585
+//    @Deprecated
586
+//    public ResponseBean deleteIds(List<Integer> ids, Integer propertyUserId) {
587
+//
588
+//        ResponseBean responseBean = new ResponseBean();
589
+//
590
+//        List<TpBuildingOwnerInfo> infoList = ids.stream().map(e->{
591
+//            TpBuildingOwnerInfo tpBuildingOwnerInfo = new TpBuildingOwnerInfo();
592
+//            tpBuildingOwnerInfo.setId(e);
593
+//            tpBuildingOwnerInfo.setVerifyStatus("2");
594
+//            tpBuildingOwnerInfo.setUpdateUser(propertyUserId);
595
+//            tpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
596
+//            return tpBuildingOwnerInfo;
597
+//        }).collect(Collectors.toList());
598
+//        boolean result = updateBatchById(infoList);
599
+//
600
+//        // APP 端用户
601
+//        List<TaUser> taUserList = Lists.newArrayList();
602
+//
603
+//        ids.forEach(e-> {
604
+//            TpBuildingOwnerInfo tpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(e);
605
+//            if (null != tpBuildingOwnerInfo) {
606
+//                // 查询 APP 端业主
607
+//                TaUser appOwnerUser = getByIdAndCommunityId(tpBuildingOwnerInfo.getOwnerTel(), tpBuildingOwnerInfo.getCommunityId());
608
+//                if (null != appOwnerUser) {
609
+//                    appOwnerUser.setVerifyStatus(2+"");
610
+//                    appOwnerUser.setUpdateDate(LocalDateTime.now());
611
+//                    taUserList.add(appOwnerUser);
612
+//                }
613
+//
614
+//            }
615
+//        });
616
+//
617
+//        if (null != taUserList && taUserList.size() > 0) {
618
+//            result = iTaUserService.updateBatchById(taUserList);
619
+//        }
620
+//
621
+//
622
+//        if (result) {
623
+//            responseBean.addSuccess("操作成功!");
624
+//        }else {
625
+//            responseBean.addError("操作失败!");
626
+//        }
627
+//
628
+//
629
+//        return responseBean;
630
+//    }
631
+
632
+
583 633
     @Override
584 634
     @Transactional(rollbackFor = Exception.class)
585 635
     public ResponseBean deleteIds(List<Integer> ids, Integer propertyUserId) {
586 636
 
587 637
         ResponseBean responseBean = new ResponseBean();
588
-
589
-        List<TpBuildingOwnerInfo> infoList = ids.stream().map(e->{
590
-            TpBuildingOwnerInfo tpBuildingOwnerInfo = new TpBuildingOwnerInfo();
591
-            tpBuildingOwnerInfo.setId(e);
592
-            tpBuildingOwnerInfo.setVerifyStatus("2");
593
-            tpBuildingOwnerInfo.setUpdateUser(propertyUserId);
594
-            tpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
595
-            return tpBuildingOwnerInfo;
596
-        }).collect(Collectors.toList());
597
-        boolean result = updateBatchById(infoList);
598
-
599
-        // APP 端用户
600
-        List<TaUser> taUserList = Lists.newArrayList();
601
-
602
-        ids.forEach(e-> {
603
-            TpBuildingOwnerInfo tpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(e);
604
-            if (null != tpBuildingOwnerInfo) {
605
-                // 查询 APP 端业主
606
-                TaUser appOwnerUser = getByIdAndCommunityId(tpBuildingOwnerInfo.getOwnerTel(), tpBuildingOwnerInfo.getCommunityId());
607
-                if (null != appOwnerUser) {
608
-                    appOwnerUser.setVerifyStatus(2+"");
609
-                    appOwnerUser.setUpdateDate(LocalDateTime.now());
610
-                    taUserList.add(appOwnerUser);
611
-                }
612
-
638
+        ids.stream().forEach(e->{
639
+            TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(e);
640
+            if ("1".equals(buildingOwnerInfo.getVerifyStatus())) {
641
+                throw new WisdomException("不能删除已认证的楼栋资料!");
642
+                /**
643
+                 * 批量删除的时候,只要存在一个已认证的楼栋资料, 就停止删除!
644
+                 */
613 645
             }
646
+            tpBuildingOwnerInfoMapper.deleteById(buildingOwnerInfo.getId());
614 647
         });
615 648
 
616
-        if (null != taUserList && taUserList.size() > 0) {
617
-            result = iTaUserService.updateBatchById(taUserList);
618
-        }
619
-
620
-
621
-        if (result) {
622
-            responseBean.addSuccess("操作成功!");
623
-        }else {
624
-            responseBean.addError("操作失败!");
625
-        }
626
-
627
-
649
+        responseBean.addSuccess("操作成功!");
628 650
         return responseBean;
629 651
     }
630 652