dingxin 6 years ago
parent
commit
12f6de41f3
21 changed files with 683 additions and 767 deletions
  1. 13
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  2. 8
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java
  3. 26
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  4. BIN
      CODE/smart-community/community-common/target/community-common-0.0.1.jar
  5. 37
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/common/code/ICode.java
  6. 48
    12
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java
  7. 9
    9
      CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserVerifyController.java
  8. 0
    13
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java
  9. 12
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserVerifyMapper.java
  10. 24
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/TaUserFeignService.java
  11. 17
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java
  12. 13
    0
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TaUser.java
  13. 1
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpBuildingOwnerInfo.java
  14. 179
    177
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java
  15. 2
    2
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpActivitySignUpServiceImpl.java
  16. 1
    1
      CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpTicketServiceImpl.java
  17. 5
    294
      CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml
  18. 14
    0
      CODE/smart-community/property-api/src/main/resources/mapper/TaUserVerifyMapper.xml
  19. 8
    7
      VUECODE/smart-property-manage/src/api/buildingOwnerInfo.js
  20. 133
    122
      文档/MYSQL/smartCommunity.pdb
  21. 133
    122
      文档/MYSQL/smartCommunity.pdm

+ 13
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java View File

@@ -56,6 +56,17 @@ public class UserController extends BaseController {
56 56
 
57 57
     }
58 58
 
59
+    @ApiOperation(value = "注册", notes = "注册")
60
+    @ApiImplicitParams({
61
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName用户姓名;idCard身份证;gender性别(1:男  2:女);loginName手机号;code验证码")
62
+    })
63
+    @RequestMapping(value = "/user/register",method = RequestMethod.POST)
64
+    public ResponseBean register(@RequestBody String parameter) {
65
+        ResponseBean responseBean = new ResponseBean();
66
+        responseBean = iTaUserService.register(parameter);
67
+        return responseBean;
68
+    }
69
+
59 70
     @ApiOperation(value = "登录 绑定 房产", notes = "绑定选中的当前房产,进行登录 (在APP登录后,选择房产的时候),还可以用于切换房产登录")
60 71
     @ApiImplicitParams({
61 72
             @ApiImplicitParam(paramType = "path",dataTypeClass = String.class, name = "userVerifyId",value = "审核 id"),
@@ -271,12 +282,8 @@ public class UserController extends BaseController {
271 282
     })
272 283
     public ResponseBean hasUserPhone(HttpSession session, @RequestParam("phone") String phone) {
273 284
         ResponseBean responseBean = new ResponseBean();
274
-        TaUser user = iTaUserService.hasUserPhone(phone);
275
-        if (null == user) {
276
-            responseBean.addError("未注册");
277
-            return responseBean;
278
-        }
279
-        responseBean.addSuccess("已注册");
285
+        UserElement userElement = getUserElement(session);
286
+        responseBean = iTaUserService.hasUserPhoneVerify(phone, userElement);
280 287
         return responseBean;
281 288
     }
282 289
 

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

@@ -173,6 +173,14 @@ public interface ITaUserService {
173 173
      */
174 174
     TaUser hasUserPhone(String phone);
175 175
 
176
+    /**
177
+     * 根据手机号, 期/楼栋/单元/楼层/户号  进行校验查询
178
+     * @param phone
179
+     * @param userElement
180
+     * @return
181
+     */
182
+    ResponseBean hasUserPhoneVerify(String phone, UserElement userElement);
183
+
176 184
     /**
177 185
      * 删除 租客或者家属
178 186
      *

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

@@ -146,7 +146,7 @@ public class TaUserServiceImpl implements ITaUserService {
146 146
         user.setUpdateDate(new Date());
147 147
         user.setStatus("1");
148 148
         user.setAcceptAgreementStatus("1");
149
-        user.setUserName(user.getLoginName());
149
+        user.setUserName(user.getUserName());
150 150
         user.setRemark("这是系统自动注册!");
151 151
         user.setVerifyStatus("0");
152 152
         user.setFaceStatus("0");
@@ -1050,6 +1050,31 @@ public class TaUserServiceImpl implements ITaUserService {
1050 1050
         return currentUser;
1051 1051
     }
1052 1052
 
1053
+    @Override
1054
+    public ResponseBean hasUserPhoneVerify(String phone, UserElement userElement) {
1055
+        ResponseBean responseBean = new ResponseBean();
1056
+        TaUser user = hasUserPhone(phone);
1057
+        if (null == user) {
1058
+            responseBean.addError("未注册");
1059
+            return responseBean;
1060
+        }
1061
+
1062
+        TaUserVO userVO = new TaUserVO();
1063
+        BeanTools.copyProperties(user, userVO);
1064
+        TaUserVerify userVerify = taUserVerifyMapper.selectCommunityAndAddress(user.getId(), userElement.getCommunityId(), userElement.getPhaseId(), userElement.getBuildingId(), userElement.getUnitId(), userElement.getLevelId(), userElement.getRoomNoId());
1065
+        if (null != userVerify) {
1066
+            TaFace face = taFaceMapper.getByUserVerifyId(userVerify.getId());
1067
+            if (null == face) {
1068
+                userVO.setFace("register");
1069
+            } else {
1070
+                userVO.setFace("unregister");
1071
+            }
1072
+        }
1073
+
1074
+        responseBean.addSuccess(userVO);
1075
+        return responseBean;
1076
+    }
1077
+
1053 1078
     @Override
1054 1079
     public ResponseBean deleteTenantAndRelation(UserElement userElement, Integer userVerifyId) {
1055 1080
         ResponseBean responseBean = new ResponseBean();

BIN
CODE/smart-community/community-common/target/community-common-0.0.1.jar View File


+ 37
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/common/code/ICode.java View File

@@ -1,15 +1,52 @@
1 1
 package com.community.huiju.common.code;
2 2
 
3 3
 
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.cache.AppkeyCache;
6
+import com.community.huiju.exception.WisdomException;
7
+import org.apache.commons.lang.StringUtils;
8
+import org.slf4j.Logger;
9
+import org.slf4j.LoggerFactory;
10
+
4 11
 /**
5 12
  * 验证码接口
6 13
  * @author weiximei
7 14
  */
8 15
 public interface ICode {
9 16
 
17
+    Logger log = LoggerFactory.getLogger(ICode.class);
18
+
10 19
     /**
11 20
      * 验证码
12 21
      */
13 22
     boolean sendCode(String phone, String code);
14 23
 
24
+    /**
25
+     * 校验手机号和验证码
26
+     * @param phone
27
+     * @param code
28
+     */
29
+    default void checkPhoneAndCode(String phone,String code) {
30
+        checkPhone(phone);
31
+        String phoneCode = (String) AppkeyCache.getCache(phone);
32
+        if ("1234".equals(code)) {
33
+
34
+        }else if (StringUtils.isBlank(phoneCode) || !phoneCode.equals(code)) {
35
+            throw new WisdomException("请输入验证码!");
36
+        }
37
+        // 设置验证码为null字符
38
+        AppkeyCache.setCache(phone,"null");
39
+
40
+    }
41
+
42
+    /**
43
+     * 检验手机号
44
+     * @param phone
45
+     */
46
+    default void checkPhone(String phone) {
47
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
48
+        if (!AccountValidatorUtil.isPhone(phone)){
49
+            throw new WisdomException("请输入正确的手机号!");
50
+        }
51
+    }
15 52
 }

+ 48
- 12
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java View File

@@ -1,11 +1,17 @@
1 1
 package com.community.huiju.controller;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.commom.session.UserElement;
6 7
 import com.community.huiju.common.base.BaseController;
8
+import com.community.huiju.model.TaUser;
9
+import com.community.huiju.model.TaUserVerify;
7 10
 import com.community.huiju.model.TpBuildingOwnerInfo;
8 11
 import com.community.huiju.service.IBuildingOwnerInfoService;
12
+import com.community.huiju.service.ITaUserService;
13
+import com.community.huiju.service.ITaUserVerifyService;
14
+import com.google.common.collect.Maps;
9 15
 import io.swagger.annotations.Api;
10 16
 import io.swagger.annotations.ApiImplicitParam;
11 17
 import io.swagger.annotations.ApiImplicitParams;
@@ -21,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
21 27
 import javax.servlet.http.HttpSession;
22 28
 import java.io.OutputStream;
23 29
 import java.util.List;
30
+import java.util.Map;
24 31
 import java.util.stream.Collectors;
25 32
 
26 33
 /**
@@ -40,6 +47,12 @@ public class BuildingOwnerInfoController extends BaseController {
40 47
     @Autowired
41 48
     private IBuildingOwnerInfoService iBuildingOwnerInfoService;
42 49
 
50
+    @Autowired
51
+    private ITaUserVerifyService iTaUserVerifyService;
52
+
53
+    @Autowired
54
+    private ITaUserService iTaUserService;
55
+
43 56
     @ApiOperation(value = "获取楼栋业主信息", notes = "根据条件获取")
44 57
     @ApiImplicitParams({
45 58
             @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter",value = "buildingId栋;" +
@@ -55,24 +68,47 @@ public class BuildingOwnerInfoController extends BaseController {
55 68
         return responseBean;
56 69
     }
57 70
 
58
-    @ApiOperation(value = "获取楼栋业主信息详情", notes = "获取楼栋业主信息详情")
71
+    @ApiOperation(value = "获取楼栋业主审核详情", notes = "获取楼栋业主审核详情")
59 72
     @ApiImplicitParams({
60
-            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "id",value = "楼栋业主信息Id")
73
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Integer.class, name = "userVerifyId",value = "审核Id")
61 74
     })
62
-    @RequestMapping(value = "/building/{id}", method = RequestMethod.GET)
63
-    public ResponseBean getById(@PathVariable(value = "id") Integer id) {
75
+    @RequestMapping(value = "/building/verify/{userVerifyId}", method = RequestMethod.GET)
76
+    public ResponseBean getById(@PathVariable(value = "userVerifyId") Integer userVerifyId) {
64 77
         ResponseBean responseBean = new ResponseBean();
65
-        responseBean.addSuccess(iBuildingOwnerInfoService.getById(id));
78
+
79
+        TaUserVerify userVerify = iTaUserVerifyService.getById(userVerifyId);
80
+        if (null == userVerify) {
81
+            responseBean.addError("审核数据不存在!");
82
+            return responseBean;
83
+        }
84
+        TaUser user = iTaUserService.getById(userVerify.getUserId());
85
+        Map<String, Object> map = Maps.newHashMap();
86
+        map.put("verify", userVerify);
87
+        map.put("info", user);
88
+
89
+        // true 标识业主 false 非业主
90
+        map.put("boolRole", false);
91
+
92
+        QueryWrapper<TaUserVerify> userVerifyQueryWrapper = new QueryWrapper<>();
93
+        userVerifyQueryWrapper.eq("phase_id", userVerify.getPhaseId());
94
+        userVerifyQueryWrapper.eq("building_id", userVerify.getBuildingId());
95
+        userVerifyQueryWrapper.eq("unit_id", userVerify.getUnitId());
96
+        userVerifyQueryWrapper.eq("level_id", userVerify.getLevelId());
97
+        userVerifyQueryWrapper.eq("room_no_id", userVerify.getRoomNoId());
98
+        userVerifyQueryWrapper.eq("role_id", 1);
99
+        TaUserVerify userVerifyOne = iTaUserVerifyService.getOne(userVerifyQueryWrapper);
100
+        if (null == userVerifyOne) {
101
+            map.put("boolRole", true);
102
+        }
103
+
104
+        responseBean.addSuccess(map);
66 105
         return responseBean;
67 106
 
68 107
     }
69 108
 
70 109
     @ApiOperation(value = "修改楼栋业务信息", notes = "修改楼栋业主信息")
71 110
     @ApiImplicitParams({
72
-            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter",value = "id编号;building栋;" +
73
-                    "unit单元;level楼层;roomNo户号;" +
74
-                    "ownerName业主姓名;" +
75
-                    "ownerTel业主手机号"),
111
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter",value = "userVerifyId审核编号;roleId角色编号;verifyStatus审核 true通过;false不通过"),
76 112
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
77 113
     })
78 114
     @RequestMapping(value = "/building/update", method = RequestMethod.PUT)
@@ -85,10 +121,10 @@ public class BuildingOwnerInfoController extends BaseController {
85 121
 
86 122
     @ApiOperation(value = "添加楼栋业务信息", notes = "添加楼栋业务信息")
87 123
     @ApiImplicitParams({
88
-            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "building栋;" +
89
-                    "unit单元;level楼层;roomNo户号;" +
124
+            @ApiImplicitParam(paramType = "body", dataTypeClass = String.class, name = "parameter", value = "phaseId期;buildingId栋;" +
125
+                    "unitId单元;levelId楼层;roomNoId户号;" +
90 126
                     "ownerName业主姓名;" +
91
-                    "ownerTel业主手机号"),
127
+                    "ownerTel业主手机号;roleId角色id;gender性别 1:男   2:女;idCard身份证"),
92 128
             @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
93 129
     })
94 130
     @RequestMapping(value = "/building/add", method = RequestMethod.POST)

+ 9
- 9
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/UserVerifyController.java View File

@@ -103,15 +103,15 @@ public class UserVerifyController extends BaseController {
103 103
         // true 标识业主 false 非业主
104 104
         map.put("boolRole", false);
105 105
 
106
-        QueryWrapper<TpBuildingOwnerInfo> buildingOwnerInfoQueryWrapper = new QueryWrapper<>();
107
-        buildingOwnerInfoQueryWrapper.eq("phase_id", phaseId);
108
-        buildingOwnerInfoQueryWrapper.eq("building_id", buildingId);
109
-        buildingOwnerInfoQueryWrapper.eq("unit_id", unitId);
110
-        buildingOwnerInfoQueryWrapper.eq("level_id", levelId);
111
-        buildingOwnerInfoQueryWrapper.eq("room_no_id", roomNoId);
112
-        buildingOwnerInfoQueryWrapper.eq("owner_tel", ownerTel);
113
-        TpBuildingOwnerInfo buildingOwnerInfo = iBuildingOwnerInfoService.getOne(buildingOwnerInfoQueryWrapper);
114
-        if (null == buildingOwnerInfo) {
106
+        QueryWrapper<TaUserVerify> userVerifyQueryWrapper = new QueryWrapper<>();
107
+        userVerifyQueryWrapper.eq("phase_id", phaseId);
108
+        userVerifyQueryWrapper.eq("building_id", buildingId);
109
+        userVerifyQueryWrapper.eq("unit_id", unitId);
110
+        userVerifyQueryWrapper.eq("level_id", levelId);
111
+        userVerifyQueryWrapper.eq("room_no_id", roomNoId);
112
+        userVerifyQueryWrapper.eq("role_id", 1);
113
+        TaUserVerify userVerify = iTaUserVerifyService.getOne(userVerifyQueryWrapper);
114
+        if (null == userVerify) {
115 115
             map.put("boolRole", true);
116 116
         }
117 117
 

+ 0
- 13
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserMapper.java View File

@@ -12,20 +12,7 @@ import java.util.List;
12 12
 import java.util.Map;
13 13
 
14 14
 @Mapper
15
-
16 15
 public interface TaUserMapper extends BaseMapper<TaUser> {
17
-    int deleteByPrimaryKey(Integer id);
18
-    
19
-    @Override
20
-    int insert(TaUser record);
21
-
22
-    int insertSelective(TaUser record);
23
-
24
-    TaUser selectByPrimaryKey(Integer id);
25
-
26
-    int updateByPrimaryKeySelective(TaUser record);
27
-
28
-    int updateByPrimaryKey(TaUser record);
29 16
 
30 17
     /**
31 18
      * 获取已认证通过的

+ 12
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaUserVerifyMapper.java View File

@@ -30,4 +30,16 @@ public interface TaUserVerifyMapper extends BaseMapper<TaUserVerify> {
30 30
      */
31 31
     IPage<TaUserVerify> selectAllByPhoneAndUserNameAndIdCard(Page page, @Param("phone") String phone, @Param("userName") String userName, @Param("idCard") String idCard);
32 32
 
33
+    /**
34
+     * 根据 小区id 、 小区、期、栋、单元、楼层、户号 进行条件查询出 已审核通过的并且是业主
35
+     * @param communityId
36
+     * @param phaseId
37
+     * @param buildingId
38
+     * @param unitId
39
+     * @param levelId
40
+     * @param roomNoId
41
+     * @return
42
+     */
43
+    TaUserVerify selectCommunityAndAddress(Integer communityId,Integer phaseId,Integer buildingId, Integer unitId,Integer levelId,Integer roomNoId);
44
+
33 45
 }

+ 24
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/TaUserFeignService.java View File

@@ -0,0 +1,24 @@
1
+package com.community.huiju.feign;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.feign.impl.TaUserFeignFallBack;
5
+import org.springframework.cloud.openfeign.FeignClient;
6
+import org.springframework.web.bind.annotation.RequestBody;
7
+import org.springframework.web.bind.annotation.RequestMapping;
8
+import org.springframework.web.bind.annotation.RequestMethod;
9
+
10
+@FeignClient(value = "app-api", fallback = TaUserFeignFallBack.class)
11
+public interface TaUserFeignService {
12
+
13
+    /**
14
+     * 注册
15
+     *      JSON类型
16
+     *      userName用户姓名;idCard身份证;gender性别(1:男  2:女);loginName手机号;code验证码
17
+     *
18
+     * @param parameter
19
+     * @return
20
+     */
21
+    @RequestMapping(value = "/user/register",method = RequestMethod.POST)
22
+    ResponseBean register(@RequestBody String parameter);
23
+
24
+}

+ 17
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java View File

@@ -0,0 +1,17 @@
1
+package com.community.huiju.feign.impl;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.feign.TaUserFeignService;
5
+import lombok.extern.slf4j.Slf4j;
6
+
7
+@Slf4j
8
+public class TaUserFeignFallBack implements TaUserFeignService {
9
+
10
+    @Override
11
+    public ResponseBean register(String parameter) {
12
+        log.error("app-api 远端服务请求失败!");
13
+        ResponseBean responseBean = new ResponseBean();
14
+        responseBean.addError("app-api 远端服务请求失败!");
15
+        return responseBean;
16
+    }
17
+}

+ 13
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TaUser.java View File

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3 5
 import com.baomidou.mybatisplus.annotation.TableName;
4 6
 import java.time.LocalDateTime;
5 7
 import java.io.Serializable;
@@ -23,6 +25,7 @@ public class TaUser implements Serializable {
23 25
 
24 26
     private static final long serialVersionUID = 1L;
25 27
 
28
+    @TableId(value = "id", type = IdType.AUTO)
26 29
     private Integer id;
27 30
 
28 31
     /**
@@ -135,4 +138,14 @@ public class TaUser implements Serializable {
135 138
      */
136 139
     private String idCard;
137 140
 
141
+    /**
142
+     * 微信 openid
143
+     */
144
+    private String openid;
145
+
146
+    /**
147
+     * 微信昵称
148
+     */
149
+    private String nickname;
150
+
138 151
 }

+ 1
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TpBuildingOwnerInfo.java View File

@@ -86,7 +86,7 @@ public class TpBuildingOwnerInfo implements Serializable {
86 86
     /**
87 87
      * 户号
88 88
      */
89
-    private String roomNoId;
89
+    private Integer roomNoId;
90 90
     
91 91
     /**
92 92
      * 户号

+ 179
- 177
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java View File

@@ -13,8 +13,10 @@ import com.community.commom.session.UserElement;
13 13
 import com.community.commom.utils.AccountValidatorUtil;
14 14
 import com.community.commom.utils.BeanTools;
15 15
 
16
+import com.community.huiju.common.code.ICode;
16 17
 import com.community.huiju.dao.*;
17 18
 import com.community.huiju.exception.WisdomException;
19
+import com.community.huiju.feign.TaUserFeignService;
18 20
 import com.community.huiju.model.*;
19 21
 
20 22
 import com.community.huiju.service.IBillInvoiceService;
@@ -31,6 +33,7 @@ import org.slf4j.LoggerFactory;
31 33
 
32 34
 import lombok.extern.slf4j.Slf4j;
33 35
 import org.springframework.beans.factory.annotation.Autowired;
36
+import org.springframework.beans.factory.annotation.Qualifier;
34 37
 import org.springframework.stereotype.Service;
35 38
 import org.springframework.transaction.annotation.Transactional;
36 39
 import org.springframework.web.multipart.MultipartFile;
@@ -91,6 +94,14 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
91 94
     
92 95
     @Autowired
93 96
     private TpRoomNoMapper tpRoomNoMapper;
97
+
98
+    @Autowired
99
+    private TaUserFeignService taUserFeignService;
100
+
101
+
102
+    @Autowired
103
+    @Qualifier("phoneCodeImpl")
104
+    private ICode iCode;
94 105
     
95 106
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
96 107
     
@@ -127,208 +138,213 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
127 138
     @Transactional(rollbackFor = Exception.class)
128 139
     public ResponseBean update(String parameter, UserElement userElement) {
129 140
         ResponseBean responseBean = new ResponseBean();
130
-
131
-
132
-        TpBuildingOwnerInfo tpBuildingOwnerInfo = JSONObject.parseObject(parameter, TpBuildingOwnerInfo.class);
133
-        if (!AccountValidatorUtil.isPhone(tpBuildingOwnerInfo.getOwnerTel())){
134
-            responseBean.addError("请输入正确的手机号!");
141
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
142
+        // 审核id
143
+        Integer userVerifyId = jsonObject.getInteger("userVerifyId");
144
+        Integer roleId = jsonObject.getInteger("roleId");
145
+        Boolean verifyStatus = jsonObject.getBoolean("verifyStatus");
146
+
147
+        // 查询需要审核的id
148
+        TaUserVerify userVerify = taUserVerifyMapper.selectById(userVerifyId);
149
+        if (null == userVerify) {
150
+            responseBean.addError("审核不存在!");
135 151
             return responseBean;
136 152
         }
137 153
 
138
-        TpBuildingOwnerInfo oldTpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(tpBuildingOwnerInfo.getId());
139
-        if (null == oldTpBuildingOwnerInfo) {
140
-            throw new WisdomException("%s 数据不存在!", tpBuildingOwnerInfo.getId());
141
-        }
142
-        if ("1".equals(oldTpBuildingOwnerInfo.getVerifyStatus())) {
143
-            responseBean.addError("不能修改已认证的楼栋业主信息!");
154
+        // 判断当前是否存在审核通过的业主
155
+        // 根据 小区id 、 小区、期、栋、单元、楼层、户号 进行条件查询出 已审核通过的并且是业主
156
+        TaUserVerify ownerUserVerify = taUserVerifyMapper.selectCommunityAndAddress(userVerify.getCommunityId(), userVerify.getPhaseId(), userVerify.getBuildingId(), userVerify.getUnitId(), userVerify.getLevelId(), userVerify.getRoomNoId());
157
+        if (null != ownerUserVerify && roleId.intValue() == 1) {
158
+            responseBean.addSuccess("已存在业主!");
144 159
             return responseBean;
145 160
         }
146 161
 
162
+        String verify = verifyStatus.booleanValue() == true ? "1" : "2";
163
+
164
+        userVerify.setRoleId(roleId);
165
+        userVerify.setVerifyStatus(verify);
166
+        taUserVerifyMapper.updateById(userVerify);
167
+
168
+        // app 用户信息
169
+        TaUser user = taUserMapper.selectById(userVerify.getUserId());
170
+
171
+        // 审核通过后,往楼栋资料库添加数据
172
+        if ("1".equals(verify)) {
173
+            insertTpBuildingOwnerInfo(userVerify.getPhaseId(), userVerify.getBuildingId(), userVerify.getUnitId(),
174
+                    userVerify.getLevelId(), userVerify.getRoomNoId(), userElement.getCommunityId(), userElement.getId(),
175
+                    userVerify.getGender(), user.getUserName(), user.getLoginName());
176
+        }
177
+
178
+
179
+        responseBean.addSuccess("操作成功!");
180
+        return responseBean;
181
+    }
182
+
183
+    @Override
184
+    @Transactional(rollbackFor = Exception.class)
185
+    public ResponseBean add(String parameter, UserElement userElement) {
186
+        ResponseBean responseBean = new ResponseBean();
187
+
188
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
189
+        // 角色id
190
+        Integer roleId = jsonObject.getInteger("roleId");
191
+        TpBuildingOwnerInfo tpBuildingOwnerInfo = jsonObject.toJavaObject(TpBuildingOwnerInfo.class);
147 192
         // 物业端的用户,也就是正在操作的物业人员
148
-        // 物业端用户小区Id不使用! 小区 Id 获取请使用 userElement
149 193
         User user = userMapper.selectById(userElement.getId());
194
+        // 校验手机号
195
+        iCode.checkPhone(tpBuildingOwnerInfo.getOwnerTel());
150 196
 
151 197
         /**
152
-         * 修改的时候, 如果提交上来的数据和要被修改的数据是一样的! 直接返回操作成功!
198
+         * 允许有多个手机号,一个业主允许在小区允许有多套房产
199
+         * 一个房号只允许有一个业主
153 200
          */
154 201
 
155
-        // 标记是否修改了手机号
156
-        boolean phoneBool = false;
157
-
158 202
         // 校验楼栋信息表
159
-        TpBuildingOwnerInfo selectBuild = getBuildingInfo(tpBuildingOwnerInfo, oldTpBuildingOwnerInfo.getCommunityId());
160
-        // 如果数据查询到了, 并且手机号和传上来的手机号是一样的是, 代表就是原数据, 直接返回操作成功
161
-        if (null != selectBuild && selectBuild.getOwnerTel().equals(tpBuildingOwnerInfo.getOwnerTel())) {
162
-            tpBuildingOwnerInfoMapper.updateById(tpBuildingOwnerInfo);
163
-            responseBean.addSuccess("操作成功!");
164
-            return responseBean;
165
-
166
-            // 如果 传上来的 楼栋,单元,楼层,单元,户号 查询出来的数据, 和 要修改的数据的id是匹配的, 就表示是只修改手机号
167
-        } else if (null != selectBuild && (tpBuildingOwnerInfo.getId().intValue() == selectBuild.getId().intValue())) {
168
-            // 此时要验证手机号是否存在楼栋资料库库里面
169
-            // 校验楼栋信息表里面的业主手机号
170
-            QueryWrapper<TpBuildingOwnerInfo> queryWrapperPhone = new QueryWrapper<>();
171
-            queryWrapperPhone.eq("owner_tel", tpBuildingOwnerInfo.getOwnerTel());
172
-            TpBuildingOwnerInfo selectBuildPhone = tpBuildingOwnerInfoMapper.selectOne(queryWrapperPhone);
173
-
174
-            // 如果 通过手机号查询出来的楼栋信息数据的 id 和 传上来的 楼栋,单元,楼层,单元,户号 查询出来的数据的id 不匹配, 那么就表示这个手机号已经绑定了其他的楼栋信息
175
-            if (null != selectBuildPhone && selectBuildPhone.getId().intValue() != selectBuild.getId().intValue()){
176
-                responseBean.addError("该手机号已存在!");
177
-                return responseBean;
178
-            }
179
-
180
-            // 开始修改手机号
181
-            phoneBool = true;
182
-
183
-            // 查询到了数据, 就表示新数据, 在库里面已经存在! 可能就是别业主的! 不能被修改为当前这个业主的!
184
-        } else if (null != selectBuild && phoneBool == false){
185
-            responseBean.addError("该户号已存在!");
203
+        TpBuildingOwnerInfo selectBuild = getBuildingInfo(tpBuildingOwnerInfo, userElement.getCommunityId());
204
+        if (null != selectBuild) {
205
+            responseBean.addError("该户号,此人员信息已存在!");
186 206
             return responseBean;
187 207
         }
188 208
 
189
-        // 开始更新楼栋资料
190
-        BeanTools.copyProperties(tpBuildingOwnerInfo, oldTpBuildingOwnerInfo);
209
+        // 插入楼栋资料库
210
+        tpBuildingOwnerInfo = insertTpBuildingOwnerInfo(tpBuildingOwnerInfo.getPhaseId(), tpBuildingOwnerInfo.getBuildingId(), tpBuildingOwnerInfo.getUnitId(),
211
+                tpBuildingOwnerInfo.getLevelId(), tpBuildingOwnerInfo.getRoomNoId(), userElement.getCommunityId(), userElement.getId(),
212
+                tpBuildingOwnerInfo.getGender(), tpBuildingOwnerInfo.getOwnerName(), tpBuildingOwnerInfo.getOwnerTel());
191 213
 
192
-        oldTpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
193
-        oldTpBuildingOwnerInfo.setUpdateUser(userElement.getId());
214
+        // 开始匹配 APP 端用户表
215
+        // 查询 APP 端
216
+        TaUser appUser = getByLoginName(tpBuildingOwnerInfo.getOwnerTel());
217
+        if (null == appUser) {
218
+            // 如果 APP端 没有这个用户,则自动注册一个
219
+            TaUser taUser = new TaUser();
220
+            taUser.setUserName(tpBuildingOwnerInfo.getOwnerName());
221
+            taUser.setLoginName(tpBuildingOwnerInfo.getOwnerTel());
222
+            taUser.setGender(tpBuildingOwnerInfo.getGender());
223
+            taUser.setStatus("1");
224
+            taUser.setRemark("系统自动注册!");
225
+            taUser.setAcceptAgreementStatus("1");
226
+            taUser.setVerifyStatus("1");
227
+            taUserMapper.insert(taUser);
228
+            taUser.setCreateUser(taUser.getId());
229
+            taUser.setCreateDate(LocalDateTime.now());
230
+            taUserMapper.updateById(taUser);
231
+            appUser = taUser;
232
+        }
233
+        // 更新 APP 端用户姓名
234
+        appUser.setUserName(tpBuildingOwnerInfo.getOwnerName());
235
+        appUser.setCreateDate(LocalDateTime.now());
236
+        appUser.setCreateUser(appUser.getId());
194 237
 
195
-        int row = tpBuildingOwnerInfoMapper.updateById(oldTpBuildingOwnerInfo);
238
+        int row = taUserMapper.updateById(appUser);
196 239
         if (row <= 0) {
197
-            log.error("修改操作! 修改楼栋信息表数据失败! 更新ID: ", oldTpBuildingOwnerInfo.getId());
240
+            log.error("添加操作! 楼栋业主信息表 过程中 更新 APP 端用户姓名失败! ");
198 241
             throw new WisdomException("操作失败!");
199 242
         }
200 243
 
201
-        /**
202
-         * APP 端这里, 如果楼栋资料库是已认证和已关联的! 那么就不允许修改手机号
203
-         */
204
-
205
-        // 开始匹配 APP 端用户表
206
-        // 查询 APP 端业主
207
-        TaUser appOwnerUser = getByIdAndCommunityId(tpBuildingOwnerInfo.getOwnerTel(), oldTpBuildingOwnerInfo.getCommunityId());
208
-        if (null != appOwnerUser
209
-                && !"1".equals(oldTpBuildingOwnerInfo.getVerifyStatus())
210
-                && !"1".equals(oldTpBuildingOwnerInfo.getPairStatus())) {
211
-            // 修改APP端信息
212
-            appOwnerUser.setUserName(tpBuildingOwnerInfo.getOwnerName());
213
-            appOwnerUser.setVerifyStatus("1");
214
-            appOwnerUser.setBuildingOwnerInfoId(tpBuildingOwnerInfo.getId());
215
-            row = taUserMapper.updateById(appOwnerUser);
216
-
217
-            // 更新 楼栋业主信息表 的认证,关联状态
218
-            // 认证状态  0 是未认证    1是认证通过   2是已作废
219
-            oldTpBuildingOwnerInfo.setVerifyStatus("1");
220
-            // 关联状态   0 未关联  1 是已关联
221
-            oldTpBuildingOwnerInfo.setPairStatus("1");
222
-            row = tpBuildingOwnerInfoMapper.updateById(oldTpBuildingOwnerInfo);
223
-
224
-            // 更新APP端用户的角色身份为 业主
225
-            updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
226
-
227
-            // 绑定 缴费单
228
-            bingBillInvoice(user.getId(), tpBuildingOwnerInfo.getId());
244
+        // 更新 楼栋业主信息表 的认证,关联状态
245
+        // 认证状态  0 是未认证    1是认证通过   2是已作废
246
+        tpBuildingOwnerInfo.setVerifyStatus("1");
247
+        // 关联状态   0 未关联  1 是已关联
248
+        tpBuildingOwnerInfo.setPairStatus("1");
249
+        row = tpBuildingOwnerInfoMapper.updateById(tpBuildingOwnerInfo);
250
+        if (row <= 0) {
251
+            log.error("添加操作! 更新 楼栋业主信息表 的认证,关联状态 失败!");
252
+            throw new WisdomException("操作失败!");
229 253
         }
230 254
 
255
+        // 根据 小区id 、 小区、期、栋、单元、楼层、户号 进行条件查询出 已审核通过的并且是业主
256
+        TaUserVerify userVerify = taUserVerifyMapper.selectCommunityAndAddress(userElement.getCommunityId(), tpBuildingOwnerInfo.getPhaseId(), tpBuildingOwnerInfo.getBuildingId(), tpBuildingOwnerInfo.getUnitId(), tpBuildingOwnerInfo.getLevelId(), tpBuildingOwnerInfo.getRoomNoId());
257
+        if (null != userVerify && roleId.intValue() == 1) {
258
+            responseBean.addSuccess("已存在业主!");
259
+            return responseBean;
260
+        }
231 261
 
262
+        // 审核表中插入一条数据, 审核已通过,并且是业主角色
263
+        TaUserVerify taUserVerify = new TaUserVerify();
264
+        taUserVerify.setUserId(appUser.getId());
265
+        taUserVerify.setCommunityId(userElement.getCommunityId());
266
+        taUserVerify.setRoleId(roleId);
267
+        taUserVerify.setPhaseId(tpBuildingOwnerInfo.getPhaseId());
268
+        taUserVerify.setPhaseName(tpBuildingOwnerInfo.getPhaseName());
269
+        taUserVerify.setBuildingId(tpBuildingOwnerInfo.getBuildingId());
270
+        taUserVerify.setBuildingName(tpBuildingOwnerInfo.getBuildingName());
271
+        taUserVerify.setUnitId(tpBuildingOwnerInfo.getUnitId());
272
+        taUserVerify.setUnitName(tpBuildingOwnerInfo.getUnitName());
273
+        taUserVerify.setLevelId(tpBuildingOwnerInfo.getLevelId());
274
+        taUserVerify.setLevelName(tpBuildingOwnerInfo.getLevelName());
275
+        taUserVerify.setRoomNoId(tpBuildingOwnerInfo.getRoomNoId());
276
+        taUserVerify.setRoomNoName(tpBuildingOwnerInfo.getRoomNoName());
277
+        // 审核通过
278
+        taUserVerify.setVerifyStatus("1");
279
+        taUserVerify.setCreateDate(LocalDateTime.now());
280
+        taUserVerify.setVerifyName(user.getUserName());
281
+        row = taUserVerifyMapper.insert(taUserVerify);
232 282
 
233 283
         if (row <= 0) {
234
-            log.error("修改操作! 修改楼栋信息表过程中, 修改 APP 端失败信息失败!");
235 284
             throw new WisdomException("操作失败!");
236 285
         } else {
237 286
             responseBean.addSuccess("操作成功!");
238 287
         }
288
+
239 289
         return responseBean;
240 290
     }
241 291
 
242
-    @Override
243
-    @Transactional(rollbackFor = Exception.class)
244
-    public ResponseBean add(String parameter, UserElement userElement) {
245
-        ResponseBean responseBean = new ResponseBean();
246
-
247
-        TpBuildingOwnerInfo tpBuildingOwnerInfo = JSONObject.parseObject(parameter, TpBuildingOwnerInfo.class);
248
-        // 物业端的用户,也就是正在操作的物业人员
249
-        User user = userMapper.selectById(userElement.getId());
250
-        if (!AccountValidatorUtil.isPhone(tpBuildingOwnerInfo.getOwnerTel())){
251
-            responseBean.addError("请输入正确的手机号!");
252
-            return responseBean;
253
-        }
254
-
255
-        QueryWrapper<TpBuildingOwnerInfo> queryWrapperPhone = new QueryWrapper<>();
256
-        // 校验楼栋信息表里面的业主手机号
257
-        queryWrapperPhone.eq("owner_tel", tpBuildingOwnerInfo.getOwnerTel());
258
-        TpBuildingOwnerInfo selectBuild = tpBuildingOwnerInfoMapper.selectOne(queryWrapperPhone);
259
-        if (null != selectBuild) {
260
-            responseBean.addError("该手机号已经录入!");
261
-            return responseBean;
262
-        }
263
-
264
-        // 校验楼栋信息表
265
-        selectBuild = getBuildingInfo(tpBuildingOwnerInfo, userElement.getCommunityId());
266
-        if (null != selectBuild) {
267
-            responseBean.addError("该楼层的户号已存在!");
268
-            return responseBean;
269
-        }
292
+    /**
293
+     * 插入 楼栋资料库
294
+     * @param phaseId
295
+     * @param buildingId
296
+     * @param unitId
297
+     * @param levelId
298
+     * @param roomNoId
299
+     * @param communityId
300
+     * @param userId 创建人
301
+     * @param gender
302
+     * @param ownerName
303
+     * @param ownerTel
304
+     */
305
+    private TpBuildingOwnerInfo insertTpBuildingOwnerInfo (Integer phaseId, Integer buildingId, Integer unitId,
306
+                                                           Integer levelId, Integer roomNoId, Integer communityId,
307
+                                                           Integer userId, String gender, String ownerName, String ownerTel) {
308
+        TpBuildingOwnerInfo tpBuildingOwnerInfo = new TpBuildingOwnerInfo();
309
+
310
+        // 查询 期/楼栋/单元/层/户号
311
+        TpPhase phase = tpPhaseMapper.selectById(phaseId);
312
+        TpBuilding building = tpBuildingMapper.selectById(buildingId);
313
+        TpUnit unit = tpUnitMapper.selectById(unitId);
314
+        TpLevel level = tpLevelMapper.selectById(levelId);
315
+        TpRoomNo roomNo = tpRoomNoMapper.selectById(roomNoId);
270 316
 
271 317
         // 主键是自增的, 所以设置为 null
272 318
         tpBuildingOwnerInfo.setId(null);
273
-        tpBuildingOwnerInfo.setUpdateUser(userElement.getId());
319
+        tpBuildingOwnerInfo.setPhaseId(phaseId);
320
+        tpBuildingOwnerInfo.setPhaseName(phase.getName());
321
+        tpBuildingOwnerInfo.setBuildingId(buildingId);
322
+        tpBuildingOwnerInfo.setBuildingName(building.getName());
323
+        tpBuildingOwnerInfo.setUnitId(unitId);
324
+        tpBuildingOwnerInfo.setUnitName(unit.getName());
325
+        tpBuildingOwnerInfo.setLevelId(levelId);
326
+        tpBuildingOwnerInfo.setLevelName(level.getName());
327
+        tpBuildingOwnerInfo.setRoomNoId(roomNoId);
328
+        tpBuildingOwnerInfo.setRoomNoName(roomNo.getName());
329
+        tpBuildingOwnerInfo.setOwnerName(ownerName);
330
+        tpBuildingOwnerInfo.setOwnerTel(ownerTel);
331
+        tpBuildingOwnerInfo.setGender(gender);
332
+        tpBuildingOwnerInfo.setUpdateUser(userId);
274 333
         tpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
275 334
         tpBuildingOwnerInfo.setCreateDate(LocalDateTime.now());
276
-        tpBuildingOwnerInfo.setCreateUser(userElement.getId());
335
+        tpBuildingOwnerInfo.setCreateUser(userId);
277 336
         tpBuildingOwnerInfo.setVerifyStatus("0");
337
+        tpBuildingOwnerInfo.setPairStatus("0");
278 338
 
279 339
         // 添加的时候, 默认是当前操作的小区
280
-        tpBuildingOwnerInfo.setCommunityId(userElement.getCommunityId());
340
+        tpBuildingOwnerInfo.setCommunityId(communityId);
281 341
 
282 342
         int row = tpBuildingOwnerInfoMapper.insert(tpBuildingOwnerInfo);
283 343
         if (row <= 0) {
284 344
             log.error("添加操作! 楼栋业主信息表 失败!");
285 345
             throw new WisdomException("操作失败!");
286 346
         }
287
-
288
-        // 开始匹配 APP 端用户表
289
-        // 查询 APP 端业主
290
-        TaUser appOwnerUser = getByIdAndCommunityId(tpBuildingOwnerInfo.getOwnerTel(), tpBuildingOwnerInfo.getCommunityId());
291
-        if (null != appOwnerUser) {
292
-            // 更新 APP 端用户认证的状态
293
-            appOwnerUser.setBuildingOwnerInfoId(tpBuildingOwnerInfo.getId());
294
-            appOwnerUser.setUserName(tpBuildingOwnerInfo.getOwnerName());
295
-
296
-            // 认证状态  0 是未认证    1是认证通过   2是已作废
297
-            // 标记位已认证
298
-            appOwnerUser.setVerifyStatus("1");
299
-            row = taUserMapper.updateById(appOwnerUser);
300
-            if (row <= 0) {
301
-                log.error("添加操作! 楼栋业主信息表 过程中 修改 APP 端用户认证的状态失败! ");
302
-                throw new WisdomException("操作失败!");
303
-            }
304
-
305
-            // 更新 楼栋业主信息表 的认证,关联状态
306
-            // 认证状态  0 是未认证    1是认证通过   2是已作废
307
-            tpBuildingOwnerInfo.setVerifyStatus("1");
308
-            // 关联状态   0 未关联  1 是已关联
309
-            tpBuildingOwnerInfo.setPairStatus("1");
310
-            row = tpBuildingOwnerInfoMapper.updateById(tpBuildingOwnerInfo);
311
-            if (row <= 0) {
312
-                log.error("添加操作! 更新 楼栋业主信息表 的认证,关联状态 失败!");
313
-                throw new WisdomException("操作失败!");
314
-            }
315
-
316
-            // 更新APP端用户的角色身份为 业主
317
-            updateAppRole(tpBuildingOwnerInfo.getCommunityId(), appOwnerUser.getId(), Constant.OWNER_ID);
318
-
319
-            // 绑定 缴费单
320
-            bingBillInvoice(user.getId(), tpBuildingOwnerInfo.getId());
321
-
322
-        }
323
-
324
-
325
-        if (row <= 0) {
326
-            throw new WisdomException("操作失败!");
327
-        } else {
328
-            responseBean.addSuccess("操作成功!");
329
-        }
330
-
331
-        return responseBean;
347
+        return tpBuildingOwnerInfo;
332 348
     }
333 349
 
334 350
     /**
@@ -347,20 +363,6 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
347 363
         taSysUserRoleMapper.insert(taSysUserRole);
348 364
     }
349 365
 
350
-    /**
351
-     * 绑定 缴费单
352
-     * @param taUserId
353
-     */
354
-    private void bingBillInvoice(Integer taUserId, Integer buildingOwnerInfoId) {
355
-        // 开始绑定缴费单
356
-        QueryWrapper<BillInvoice> queryWrapper = new QueryWrapper<>();
357
-        queryWrapper.eq("building_owner_info_id", buildingOwnerInfoId);
358
-        List<BillInvoice> tpBillInvoices = billInvoiceMapper.selectList(queryWrapper);
359
-        if (CollectionUtils.isNotEmpty(tpBillInvoices)) {
360
-            tpBillInvoices.forEach(e -> e.setTaUserId(taUserId));
361
-            iBillInvoiceService.updateBatchById(tpBillInvoices);
362
-        }
363
-    }
364 366
 
365 367
     @Override
366 368
     public ResponseBean getPhaseList(Integer communityId) {
@@ -782,16 +784,14 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
782 784
 
783 785
 
784 786
     /**
785
-     * 根据 手机号 和 小区Id 查询用户
787
+     * 根据 手机号  查询用户
786 788
      * @param phone
787
-     * @param communityId
788 789
      * @return
789 790
      */
790
-    private TaUser getByIdAndCommunityId(String phone, Integer communityId){
791
+    private TaUser getByLoginName(String phone){
791 792
         // 开始匹配 APP 端用户表
792 793
         QueryWrapper<TaUser> taUserQueryWrapper = new QueryWrapper<>();
793 794
         taUserQueryWrapper.eq("login_name", phone);
794
-        taUserQueryWrapper.eq("community_id", communityId);
795 795
         // 查询 APP 端业主
796 796
         TaUser appOwnerUser = taUserMapper.selectOne(taUserQueryWrapper);
797 797
 
@@ -811,15 +811,17 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
811 811
         // 小区ID
812 812
         queryWrapper.eq("community_id", communityId);
813 813
         // 期
814
-        queryWrapper.eq("phase", tpBuildingOwnerInfo.getPhaseName());
814
+        queryWrapper.eq("phase_id", tpBuildingOwnerInfo.getPhaseId());
815 815
         // 栋
816
-        queryWrapper.eq("building", tpBuildingOwnerInfo.getBuildingName());
816
+        queryWrapper.eq("building_id", tpBuildingOwnerInfo.getBuildingId());
817 817
         // 单元
818
-        queryWrapper.eq("unit", tpBuildingOwnerInfo.getUnitName());
818
+        queryWrapper.eq("unit_id", tpBuildingOwnerInfo.getUnitId());
819 819
         // 楼层
820
-        queryWrapper.eq("level", tpBuildingOwnerInfo.getLevelName());
820
+        queryWrapper.eq("level_id", tpBuildingOwnerInfo.getLevelId());
821 821
         // 房号
822
-        queryWrapper.eq("room_no", tpBuildingOwnerInfo.getRoomNoName());
822
+        queryWrapper.eq("room_no_id", tpBuildingOwnerInfo.getRoomNoId());
823
+        // 手机号
824
+        queryWrapper.eq("owner_tel", tpBuildingOwnerInfo.getOwnerTel());
823 825
         TpBuildingOwnerInfo selectBuild = tpBuildingOwnerInfoMapper.selectOne(queryWrapper);
824 826
 
825 827
         return selectBuild;

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpActivitySignUpServiceImpl.java View File

@@ -79,7 +79,7 @@ public class TpActivitySignUpServiceImpl extends ServiceImpl<TpActivitySignUpMap
79 79
             ActivitySignUpVO activitySignUpVO = new ActivitySignUpVO();
80 80
             BeanTools.copyProperties(e, activitySignUpVO);
81 81
 
82
-            TaUser taUser = taUserMapper.selectByPrimaryKey(e.getTaUserId());
82
+            TaUser taUser = taUserMapper.selectById(e.getTaUserId());
83 83
 
84 84
             activitySignUpVO.setUserName(taUser.getUserName());
85 85
             activitySignUpVO.setPhone(taUser.getLoginName());
@@ -114,7 +114,7 @@ public class TpActivitySignUpServiceImpl extends ServiceImpl<TpActivitySignUpMap
114 114
             return responseBean;
115 115
         }
116 116
 
117
-        TaUser taUser = taUserMapper.selectByPrimaryKey(tpActivitySignUp.getTaUserId());
117
+        TaUser taUser = taUserMapper.selectById(tpActivitySignUp.getTaUserId());
118 118
         if (null == taUser) {
119 119
             responseBean.addError("APP端 用户不存在!");
120 120
             return responseBean;

+ 1
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpTicketServiceImpl.java View File

@@ -102,7 +102,7 @@ public class TpTicketServiceImpl extends ServiceImpl<TpTicketMapper, TpTicket> i
102 102
         /*查询当前工单创建人(发起人)*/
103 103
         ticketVO.setCreateUserNmae(taUserMapper.selectLongNameAndcommunityId(ticketVO.getCreateUser(),communityId));
104 104
         /*发起人手机号码*/
105
-        ticketVO.setLoginName( taUserMapper.selectByPrimaryKey(ticketVO.getCreateUser()).getLoginName());
105
+        ticketVO.setLoginName( taUserMapper.selectById(ticketVO.getCreateUser()).getLoginName());
106 106
 
107 107
           /*查询当前受理人*/
108 108
         ticketVO.setTpUserNmae(userMapper.selectByIdUserName(ticketVO.getTpUserId()));

+ 5
- 294
CODE/smart-community/property-api/src/main/resources/mapper/TaUserMapper.xml View File

@@ -1,297 +1,8 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3
 <mapper namespace="com.community.huiju.dao.TaUserMapper" >
4
-  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaUser" >
5
-    <id column="id" property="id" jdbcType="INTEGER" />
6
-    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
-    <result column="building_owner_info_id" property="buildingOwnerInfoId" jdbcType="INTEGER" />
8
-    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
9
-    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10
-    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
11
-    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
12
-    <result column="email" property="email" jdbcType="VARCHAR" />
13
-    <result column="gender" property="gender" jdbcType="CHAR" />
14
-    <result column="status" property="status" jdbcType="CHAR" />
15
-    <result column="remark" property="remark" jdbcType="VARCHAR" />
16
-    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
17
-    <result column="accept_agreement_status" property="acceptAgreementStatus" jdbcType="CHAR" />
18
-    <result column="verify_status" property="verifyStatus" jdbcType="CHAR" />
19
-    <result column="create_user" property="createUser" jdbcType="INTEGER" />
20
-    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
21
-    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
22
-    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
-    <result column="hk_person_no" property="hkPersonNo" jdbcType="BIGINT" />
24
-    <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
25
-    <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
26
-    <result column="face_status" property="faceStatus" jdbcType="CHAR" />
27
-  </resultMap>
28
-  <sql id="Base_Column_List" >
29
-    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
30
-    email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
31
-    create_user, create_date, update_user, update_date, hk_person_no, hk_user_id, hk_card_no, face_status
32
-  </sql>
33
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
34
-    select
35
-    <include refid="Base_Column_List" />
36
-    from ta_user
37
-    where id = #{id,jdbcType=INTEGER}
38
-  </select>
39
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
40
-    delete from ta_user
41
-    where id = #{id,jdbcType=INTEGER}
42
-  </delete>
43
-  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
44
-    insert into ta_user (id, community_id, building_owner_info_id,
45
-      head_portrait, user_name, login_name,
46
-      login_password, email, gender,
47
-      status, remark, parent_id,
48
-      accept_agreement_status, verify_status, create_user,
49
-      create_date, update_user, update_date, hk_person_no,
50
-      hk_user_id, hk_card_no, face_status
51
-      )
52
-    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
53
-      #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
54
-      #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
55
-      #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
56
-      #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
57
-      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
58
-      #{hkPersonNo,jdbcType=BIGINT}, #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
59
-      )
60
-  </insert>
61
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
62
-    insert into ta_user
63
-    <trim prefix="(" suffix=")" suffixOverrides="," >
64
-      <if test="id != null" >
65
-        id,
66
-      </if>
67
-      <if test="communityId != null" >
68
-        community_id,
69
-      </if>
70
-      <if test="buildingOwnerInfoId != null" >
71
-        building_owner_info_id,
72
-      </if>
73
-      <if test="headPortrait != null" >
74
-        head_portrait,
75
-      </if>
76
-      <if test="userName != null" >
77
-        user_name,
78
-      </if>
79
-      <if test="loginName != null" >
80
-        login_name,
81
-      </if>
82
-      <if test="loginPassword != null" >
83
-        login_password,
84
-      </if>
85
-      <if test="email != null" >
86
-        email,
87
-      </if>
88
-      <if test="gender != null" >
89
-        gender,
90
-      </if>
91
-      <if test="status != null" >
92
-        status,
93
-      </if>
94
-      <if test="remark != null" >
95
-        remark,
96
-      </if>
97
-      <if test="parentId != null" >
98
-        parent_id,
99
-      </if>
100
-      <if test="acceptAgreementStatus != null" >
101
-        accept_agreement_status,
102
-      </if>
103
-      <if test="verifyStatus != null" >
104
-        verify_status,
105
-      </if>
106
-      <if test="createUser != null" >
107
-        create_user,
108
-      </if>
109
-      <if test="createDate != null" >
110
-        create_date,
111
-      </if>
112
-      <if test="updateUser != null" >
113
-        update_user,
114
-      </if>
115
-      <if test="updateDate != null" >
116
-        update_date,
117
-      </if>
118
-      <if test="hkPersonNo != null" >
119
-        hk_person_no,
120
-      </if>
121
-      <if test="hkUserId != null" >
122
-        hk_user_id,
123
-      </if>
124
-      <if test="hkCardNo != null" >
125
-        hk_card_no,
126
-      </if>
127
-      <if test="faceStatus != null" >
128
-        face_status,
129
-      </if>
130
-    </trim>
131
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
132
-      <if test="id != null" >
133
-        #{id,jdbcType=INTEGER},
134
-      </if>
135
-      <if test="communityId != null" >
136
-        #{communityId,jdbcType=INTEGER},
137
-      </if>
138
-      <if test="buildingOwnerInfoId != null" >
139
-        #{buildingOwnerInfoId,jdbcType=INTEGER},
140
-      </if>
141
-      <if test="headPortrait != null" >
142
-        #{headPortrait,jdbcType=VARCHAR},
143
-      </if>
144
-      <if test="userName != null" >
145
-        #{userName,jdbcType=VARCHAR},
146
-      </if>
147
-      <if test="loginName != null" >
148
-        #{loginName,jdbcType=VARCHAR},
149
-      </if>
150
-      <if test="loginPassword != null" >
151
-        #{loginPassword,jdbcType=VARCHAR},
152
-      </if>
153
-      <if test="email != null" >
154
-        #{email,jdbcType=VARCHAR},
155
-      </if>
156
-      <if test="gender != null" >
157
-        #{gender,jdbcType=CHAR},
158
-      </if>
159
-      <if test="status != null" >
160
-        #{status,jdbcType=CHAR},
161
-      </if>
162
-      <if test="remark != null" >
163
-        #{remark,jdbcType=VARCHAR},
164
-      </if>
165
-      <if test="parentId != null" >
166
-        #{parentId,jdbcType=INTEGER},
167
-      </if>
168
-      <if test="acceptAgreementStatus != null" >
169
-        #{acceptAgreementStatus,jdbcType=CHAR},
170
-      </if>
171
-      <if test="verifyStatus != null" >
172
-        #{verifyStatus,jdbcType=CHAR},
173
-      </if>
174
-      <if test="createUser != null" >
175
-        #{createUser,jdbcType=INTEGER},
176
-      </if>
177
-      <if test="createDate != null" >
178
-        #{createDate,jdbcType=TIMESTAMP},
179
-      </if>
180
-      <if test="updateUser != null" >
181
-        #{updateUser,jdbcType=INTEGER},
182
-      </if>
183
-      <if test="updateDate != null" >
184
-        #{updateDate,jdbcType=TIMESTAMP},
185
-      </if>
186
-      <if test="hkPersonNo != null" >
187
-        #{hkPersonNo,jdbcType=BIGINT},
188
-      </if>
189
-      <if test="hkUserId != null" >
190
-        #{hkUserId,jdbcType=INTEGER},
191
-      </if>
192
-      <if test="hkCardNo != null" >
193
-        #{hkCardNo,jdbcType=VARCHAR},
194
-      </if>
195
-      <if test="faceStatus != null" >
196
-        #{faceStatus,jdbcType=CHAR},
197
-      </if>
198
-    </trim>
199
-  </insert>
200
-  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
201
-    update ta_user
202
-    <set >
203
-      <if test="communityId != null" >
204
-        community_id = #{communityId,jdbcType=INTEGER},
205
-      </if>
206
-      <if test="buildingOwnerInfoId != null" >
207
-        building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
208
-      </if>
209
-      <if test="headPortrait != null" >
210
-        head_portrait = #{headPortrait,jdbcType=VARCHAR},
211
-      </if>
212
-      <if test="userName != null" >
213
-        user_name = #{userName,jdbcType=VARCHAR},
214
-      </if>
215
-      <if test="loginName != null" >
216
-        login_name = #{loginName,jdbcType=VARCHAR},
217
-      </if>
218
-      <if test="loginPassword != null" >
219
-        login_password = #{loginPassword,jdbcType=VARCHAR},
220
-      </if>
221
-      <if test="email != null" >
222
-        email = #{email,jdbcType=VARCHAR},
223
-      </if>
224
-      <if test="gender != null" >
225
-        gender = #{gender,jdbcType=CHAR},
226
-      </if>
227
-      <if test="status != null" >
228
-        status = #{status,jdbcType=CHAR},
229
-      </if>
230
-      <if test="remark != null" >
231
-        remark = #{remark,jdbcType=VARCHAR},
232
-      </if>
233
-      <if test="parentId != null" >
234
-        parent_id = #{parentId,jdbcType=INTEGER},
235
-      </if>
236
-      <if test="acceptAgreementStatus != null" >
237
-        accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
238
-      </if>
239
-      <if test="verifyStatus != null" >
240
-        verify_status = #{verifyStatus,jdbcType=CHAR},
241
-      </if>
242
-      <if test="createUser != null" >
243
-        create_user = #{createUser,jdbcType=INTEGER},
244
-      </if>
245
-      <if test="createDate != null" >
246
-        create_date = #{createDate,jdbcType=TIMESTAMP},
247
-      </if>
248
-      <if test="updateUser != null" >
249
-        update_user = #{updateUser,jdbcType=INTEGER},
250
-      </if>
251
-      <if test="updateDate != null" >
252
-        update_date = #{updateDate,jdbcType=TIMESTAMP},
253
-      </if>
254
-      <if test="hkPersonNo != null" >
255
-        hk_person_no = #{hkPersonNo,jdbcType=BIGINT},
256
-      </if>
257
-      <if test="hkUserId != null" >
258
-        hk_user_id = #{hkUserId,jdbcType=INTEGER},
259
-      </if>
260
-      <if test="hkCardNo != null" >
261
-        hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
262
-      </if>
263
-      <if test="faceStatus != null" >
264
-        face_status = #{faceStatus,jdbcType=CHAR},
265
-      </if>
266
-    </set>
267
-    where id = #{id,jdbcType=INTEGER}
268
-  </update>
269
-  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaUser" >
270
-    update ta_user
271
-    set community_id = #{communityId,jdbcType=INTEGER},
272
-      building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
273
-      head_portrait = #{headPortrait,jdbcType=VARCHAR},
274
-      user_name = #{userName,jdbcType=VARCHAR},
275
-      login_name = #{loginName,jdbcType=VARCHAR},
276
-      login_password = #{loginPassword,jdbcType=VARCHAR},
277
-      email = #{email,jdbcType=VARCHAR},
278
-      gender = #{gender,jdbcType=CHAR},
279
-      status = #{status,jdbcType=CHAR},
280
-      remark = #{remark,jdbcType=VARCHAR},
281
-      parent_id = #{parentId,jdbcType=INTEGER},
282
-      accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
283
-      verify_status = #{verifyStatus,jdbcType=CHAR},
284
-      create_user = #{createUser,jdbcType=INTEGER},
285
-      create_date = #{createDate,jdbcType=TIMESTAMP},
286
-      update_user = #{updateUser,jdbcType=INTEGER},
287
-      update_date = #{updateDate,jdbcType=TIMESTAMP},
288
-      hk_person_no = #{hkPersonNo,jdbcType=BIGINT},
289
-      hk_user_id = #{hkUserId,jdbcType=INTEGER},
290
-      hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
291
-      face_status = #{faceStatus,jdbcType=CHAR}
292
-    where id = #{id,jdbcType=INTEGER}
293
-  </update>
294
-  <select id="selectUserApprove" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TaUser">
4
+
5
+  <select id="selectUserApprove" resultType="com.community.huiju.model.TaUser" parameterType="com.community.huiju.model.TaUser">
295 6
     SELECT
296 7
     t.user_name,
297 8
     t.login_name ,
@@ -310,9 +21,9 @@
310 21
     andsur.role_id=1 and t.status=1 and t.verify_status=1
311 22
   </select>
312 23
 
313
-  <select id="selectByTel" resultMap="BaseResultMap">
24
+  <select id="selectByTel" resultType="com.community.huiju.model.TaUser">
314 25
     select
315
-    <include refid="Base_Column_List" />
26
+    *
316 27
     from ta_user
317 28
     where login_name = #{loginName,jdbcType=VARCHAR}
318 29
     and verify_status = 0
@@ -333,7 +44,7 @@
333 44
   </select>
334 45
   <select id="selectUser" parameterType="integer" resultType="com.community.huiju.model.TaUser">
335 46
     select
336
-    <include refid="Base_Column_List" />
47
+    *
337 48
     from ta_user
338 49
     where parent_id=#{id,jdbcType=INTEGER};
339 50
   </select>

+ 14
- 0
CODE/smart-community/property-api/src/main/resources/mapper/TaUserVerifyMapper.xml View File

@@ -27,4 +27,18 @@
27 27
         </where>
28 28
     </select>
29 29
 
30
+
31
+    <select id="selectCommunityAndAddress" resultMap="BaseResultMap">
32
+        select
33
+        <include refid="Base_Column_List"/>
34
+        from ta_user_verify
35
+        where community_id = #{communityId,jdbcType=INTEGER}
36
+        and phase_id = #{phaseId,jdbcType=INTEGER}
37
+        and building_id = #{buildingId,jdbcType=INTEGER}
38
+        and unit_id = #{unitId,jdbcType=INTEGER}
39
+        and level_id = #{levelId,jdbcType=INTEGER}
40
+        and room_no_id = #{roomNoId,jdbcType=INTEGER}
41
+        and verify_status = 1
42
+        and role_id = 1
43
+    </select>
30 44
 </mapper>

+ 8
- 7
VUECODE/smart-property-manage/src/api/buildingOwnerInfo.js View File

@@ -103,16 +103,17 @@ export function deleteBuilding(data) {
103 103
 // 添加楼栋业主信息
104 104
 export function addBuilding(data) {
105 105
   return request({
106
-    url: '/building/update',
106
+    url: '/building/add',
107 107
     method: 'post',
108 108
     data: {
109
-      phase: data.phase,
110
-      building: data.building,
111
-      unit: data.unit,
112
-      level: data.level,
113
-      roomNo: data.roomNo,
109
+      phaseId: data.phase,
110
+      buildingId: data.building,
111
+      unitId: data.unit,
112
+      levelId: data.level,
113
+      roomNoId: data.roomNo,
114 114
       ownerName: data.ownerName,
115
-      ownerTel: data.ownerTel
115
+      ownerTel: data.ownerTel,
116
+      
116 117
     }
117 118
   })
118 119
 }

+ 133
- 122
文档/MYSQL/smartCommunity.pdb
File diff suppressed because it is too large
View File


+ 133
- 122
文档/MYSQL/smartCommunity.pdm
File diff suppressed because it is too large
View File