|
@@ -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;
|