Explorar el Código

修复 资料库关联未更新异常

weiximei hace 6 años
padre
commit
569bb55668

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java Ver fichero

@@ -3,6 +3,7 @@ package com.community.huiju.dao;
3 3
 import com.community.huiju.model.TpBuildingOwnerInfo;
4 4
 import org.apache.ibatis.annotations.Mapper;
5 5
 import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.ResultMap;
6 7
 import org.apache.ibatis.annotations.Select;
7 8
 
8 9
 import java.util.List;
@@ -21,6 +22,7 @@ public interface TpBuildingOwnerInfoMapper {
21 22
 
22 23
     int updateByPrimaryKey(TpBuildingOwnerInfo record);
23 24
 
25
+    @ResultMap("BaseResultMap")
24 26
     @Select("select * from tp_building_owner_info where community_id=#{communityId} and owner_tel=#{ownerTel}")
25 27
     List<TpBuildingOwnerInfo> getByCommunityIdAndOwnerTel(@Param("communityId") Integer communityId, @Param("ownerTel") String ownerTel);
26 28
 }

+ 18
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Ver fichero

@@ -64,6 +64,7 @@ public class TaUserServiceImpl implements ITaUserService {
64 64
 
65 65
     @Transactional(rollbackFor = Exception.class)
66 66
     @Override
67
+    @Deprecated
67 68
     public ResponseBean login(TaUser user) {
68 69
         ResponseBean response = new ResponseBean();
69 70
         log.info("{} 手机号校验结果: {}",user.getLoginName(),AccountValidatorUtil.isPhone(user.getLoginName()));
@@ -200,20 +201,34 @@ public class TaUserServiceImpl implements ITaUserService {
200 201
         user.setCreateUser(user.getId());
201 202
         user.setUpdateUser(user.getId());
202 203
 
204
+        // 这里先默认 type=4 (未认证)
205
+        int roleType = 4;
206
+
203 207
         // 查询资料库
208
+        // TODO 这里默认List接收, 后期会有多个小区认证,可能会返回多条
204 209
         List<TpBuildingOwnerInfo> buildingOwnerInfoList = tpBuildingOwnerInfoMapper.getByCommunityIdAndOwnerTel(user.getCommunityId(), user.getLoginName());
205 210
         if (CollectionUtils.isNotEmpty(buildingOwnerInfoList)) {
211
+            // TODO 目前是一个业主对应单个小区, 所以取第一个
206 212
             TpBuildingOwnerInfo buildingOwnerInfo = buildingOwnerInfoList.get(0);
207 213
             user.setBuildingOwnerInfoId(buildingOwnerInfo.getId());
208 214
             user.setVerifyStatus("1");
215
+            // 标记位1, 业主身份
216
+            roleType = 1;
217
+
218
+            // 更新资料库的关联状态 和 认证状态
219
+            buildingOwnerInfo.setVerifyStatus("1");
220
+            buildingOwnerInfo.setPairStatus("1");
221
+            buildingOwnerInfo.setUpdateDate(new Date());
222
+            tpBuildingOwnerInfoMapper.updateByPrimaryKeySelective(buildingOwnerInfo);
223
+
209 224
         }
210 225
 
211 226
         // 更新
212 227
         taUserMapper.updateByPrimaryKeySelective(user);
213 228
 
214
-        // TODO 这里先默认 type=4 (未认证), 后期需要和 资料库对接
215
-        // TODO 资料库已经对接, 新注册的默认为 未认证, 后期需要改为只有匹配了资料库后才是业主
216
-        addOrUpdateUserRole(4,response,user,true);
229
+        // 这里默认 roleType=4 (未认证),  资料库认证后, 变为 1 (业主)
230
+        // 资料库已经对接, 新注册的默认为 未认证, 只有匹配了资料库后才是业主
231
+        addOrUpdateUserRole(roleType,response,user,true);
217 232
 
218 233
 
219 234
         // 推送海康

+ 2
- 2
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BuildingOwnerInfoController.java Ver fichero

@@ -74,7 +74,7 @@ public class BuildingOwnerInfoController extends BaseController {
74 74
     public ResponseBean update(@RequestBody String parameter, HttpSession session){
75 75
         ResponseBean responseBean = new ResponseBean();
76 76
         UserElement userElement = getUserElement(session);
77
-        responseBean = iBuildingOwnerInfoService.update(parameter,userElement.getId());
77
+        responseBean = iBuildingOwnerInfoService.update(parameter, userElement);
78 78
         return responseBean;
79 79
     }
80 80
 
@@ -90,7 +90,7 @@ public class BuildingOwnerInfoController extends BaseController {
90 90
     public ResponseBean add(@RequestBody String parameter, HttpSession session){
91 91
         ResponseBean responseBean = new ResponseBean();
92 92
         UserElement userElement = getUserElement(session);
93
-        responseBean = iBuildingOwnerInfoService.add(parameter,userElement.getId());
93
+        responseBean = iBuildingOwnerInfoService.add(parameter, userElement);
94 94
         return responseBean;
95 95
     }
96 96
 

+ 2
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/User.java Ver fichero

@@ -28,8 +28,9 @@ public class User implements Serializable {
28 28
     private Integer id;
29 29
 
30 30
     /**
31
-     * 小区id
31
+     * 小区id, 这字段作废不使用
32 32
      */
33
+    @Deprecated
33 34
     private Integer communityId;
34 35
 
35 36
     /**

+ 4
- 4
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBuildingOwnerInfoService.java Ver fichero

@@ -33,18 +33,18 @@ public interface IBuildingOwnerInfoService extends IService<TpBuildingOwnerInfo>
33 33
     /**
34 34
      * 修改 楼栋业主信息
35 35
      * @param parameter
36
-     * @param userId
36
+     * @param userElement
37 37
      * @return
38 38
      */
39
-    ResponseBean update(String parameter, Integer userId);
39
+    ResponseBean update(String parameter, UserElement userElement);
40 40
 
41 41
     /**
42 42
      * 添加 楼栋业主信息
43 43
      * @param parameter
44
-     * @param userId
44
+     * @param userElement
45 45
      * @return
46 46
      */
47
-    ResponseBean add(String parameter, Integer userId);
47
+    ResponseBean add(String parameter, UserElement userElement);
48 48
     
49 49
     /**
50 50
      * 根据excel获取相关信息

+ 11
- 11
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Ver fichero

@@ -128,7 +128,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
128 128
 
129 129
     @Override
130 130
     @Transactional(rollbackFor = Exception.class)
131
-    public ResponseBean update(String parameter, Integer userId) {
131
+    public ResponseBean update(String parameter, UserElement userElement) {
132 132
         ResponseBean responseBean = new ResponseBean();
133 133
 
134 134
         TpBuildingOwnerInfo tpBuildingOwnerInfo = JSONObject.parseObject(parameter, TpBuildingOwnerInfo.class);
@@ -144,7 +144,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
144 144
         }
145 145
 
146 146
         // 物业端的用户,也就是正在操作的物业人员
147
-        User user = userMapper.selectById(userId);
147
+        User user = userMapper.selectById(userElement.getId());
148 148
 
149 149
         /**
150 150
          * 修改的时候, 如果提交上来的数据和要被修改的数据是一样的! 直接返回操作成功!
@@ -154,7 +154,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
154 154
         boolean phoneBool = false;
155 155
 
156 156
         // 校验楼栋信息表
157
-        TpBuildingOwnerInfo selectBuild = getBuildingInfo(tpBuildingOwnerInfo, user.getCommunityId());
157
+        TpBuildingOwnerInfo selectBuild = getBuildingInfo(tpBuildingOwnerInfo, tpBuildingOwnerInfo.getCommunityId());
158 158
         // 如果数据查询到了, 并且手机号和传上来的手机号是一样的是, 代表就是原数据, 直接返回操作成功
159 159
         if (null != selectBuild && selectBuild.getOwnerTel().equals(tpBuildingOwnerInfo.getOwnerTel())) {
160 160
             tpBuildingOwnerInfoMapper.updateById(tpBuildingOwnerInfo);
@@ -167,7 +167,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
167 167
             // 校验楼栋信息表里面的业主手机号
168 168
             QueryWrapper<TpBuildingOwnerInfo> queryWrapperPhone = new QueryWrapper<>();
169 169
             queryWrapperPhone.eq("owner_tel", tpBuildingOwnerInfo.getOwnerTel());
170
-            TpBuildingOwnerInfo selectBuildPhone = getBuildingInfo(tpBuildingOwnerInfo, user.getCommunityId());
170
+            TpBuildingOwnerInfo selectBuildPhone = getBuildingInfo(tpBuildingOwnerInfo, tpBuildingOwnerInfo.getCommunityId());
171 171
 
172 172
             // 如果 通过手机号查询出来的楼栋信息数据的 id 和 传上来的 楼栋,单元,楼层,单元,户号 查询出来的数据的id 匹配, 那么就表示这个手机号已经绑定了其他的楼栋信息
173 173
             if (selectBuildPhone.getId().intValue() != selectBuild.getId().intValue()){
@@ -189,7 +189,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
189 189
         BeanTools.copyProperties(tpBuildingOwnerInfo, oldTpBuildingOwnerInfo);
190 190
 
191 191
         oldTpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
192
-        oldTpBuildingOwnerInfo.setUpdateUser(userId);
192
+        oldTpBuildingOwnerInfo.setUpdateUser(userElement.getId());
193 193
 
194 194
         int row = tpBuildingOwnerInfoMapper.updateById(oldTpBuildingOwnerInfo);
195 195
         if (row <= 0) {
@@ -223,12 +223,12 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
223 223
 
224 224
     @Override
225 225
     @Transactional(rollbackFor = Exception.class)
226
-    public ResponseBean add(String parameter, Integer userId) {
226
+    public ResponseBean add(String parameter, UserElement userElement) {
227 227
         ResponseBean responseBean = new ResponseBean();
228 228
 
229 229
         TpBuildingOwnerInfo tpBuildingOwnerInfo = JSONObject.parseObject(parameter, TpBuildingOwnerInfo.class);
230 230
         // 物业端的用户,也就是正在操作的物业人员
231
-        User user = userMapper.selectById(userId);
231
+        User user = userMapper.selectById(userElement.getId());
232 232
         if (!AccountValidatorUtil.isPhone(tpBuildingOwnerInfo.getOwnerTel())){
233 233
             responseBean.addError("请输入正取的手机号!");
234 234
             return responseBean;
@@ -244,7 +244,7 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
244 244
         }
245 245
 
246 246
         // 校验楼栋信息表
247
-        selectBuild = getBuildingInfo(tpBuildingOwnerInfo, user.getCommunityId());
247
+        selectBuild = getBuildingInfo(tpBuildingOwnerInfo, userElement.getCommunityId());
248 248
         if (null != selectBuild) {
249 249
             responseBean.addError("该楼层的户号,已存在!");
250 250
             return responseBean;
@@ -252,14 +252,14 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
252 252
 
253 253
         // 主键是自增的, 所以设置为 null
254 254
         tpBuildingOwnerInfo.setId(null);
255
-        tpBuildingOwnerInfo.setUpdateUser(userId);
255
+        tpBuildingOwnerInfo.setUpdateUser(userElement.getId());
256 256
         tpBuildingOwnerInfo.setUpdateDate(LocalDateTime.now());
257 257
         tpBuildingOwnerInfo.setCreateDate(LocalDateTime.now());
258
-        tpBuildingOwnerInfo.setCreateUser(userId);
258
+        tpBuildingOwnerInfo.setCreateUser(userElement.getId());
259 259
         tpBuildingOwnerInfo.setVerifyStatus("0");
260 260
 
261 261
         // 添加的时候, 默认是当前操作的小区
262
-        tpBuildingOwnerInfo.setCommunityId(user.getCommunityId());
262
+        tpBuildingOwnerInfo.setCommunityId(userElement.getCommunityId());
263 263
 
264 264
         int row = tpBuildingOwnerInfoMapper.insert(tpBuildingOwnerInfo);
265 265
         if (row <= 0) {