魏熙美 6 anni fa
parent
commit
fd854a6884

+ 19
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpBuildingOwnerInfoMapper.java Vedi File

@@ -44,9 +44,27 @@ public interface TpBuildingOwnerInfoMapper {
44 44
     @ResultMap("BaseResultMap")
45 45
     @Select("select * from tp_building_owner_info where community_id=#{communityId}" +
46 46
             " and phase_id=#{phaseId} and building_id=#{buildingId} and unit_id=#{unitId}" +
47
-            " and level_id=#{levelId} and room_no_id=#{roomNoId} and verify_status=1")
47
+            " and level_id=#{levelId} and room_no_id=#{roomNoId}")
48 48
     TpBuildingOwnerInfo selectCommunityIdAndAddress(@Param("communityId") Integer communityId, @Param("phaseId") Integer phaseId,
49 49
                                                     @Param("buildingId") Integer building, @Param("unitId") Integer unitId,
50 50
                                                     @Param("levelId") Integer level, @Param("roomNoId") Integer roomNoId);
51 51
 
52
+    /*
53
+     * 根据 小区,期,楼栋,单元,楼层,户号, 手机号
54
+     * @param communityId
55
+     * @param phase
56
+     * @param building
57
+     * @param unit
58
+     * @param level
59
+     * @param roomNo
60
+     * @return
61
+     */
62
+    @ResultMap("BaseResultMap")
63
+    @Select("select * from tp_building_owner_info where community_id=#{communityId}" +
64
+            " and phase_id=#{phaseId} and building_id=#{buildingId} and unit_id=#{unitId}" +
65
+            " and level_id=#{levelId} and room_no_id=#{roomNoId} and owner_tel=#{phone}")
66
+    TpBuildingOwnerInfo selectCommunityAndAddressAndPhone(@Param("communityId") Integer communityId, @Param("phaseId") Integer phaseId,
67
+                                                          @Param("buildingId") Integer buildingId, @Param("unitId") Integer unitId,
68
+                                                          @Param("levelId") Integer levelId, @Param("roomNoId") Integer roomNoId,
69
+                                                          @Param("phone") String phone);
52 70
 }

+ 81
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserVerifyServicelmpl.java Vedi File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
5 5
 import com.community.commom.mode.ResponseBean;
6 6
 import com.community.commom.session.UserElement;
7 7
 import com.community.huiju.dao.*;
8
+import com.community.huiju.exception.WisdomException;
8 9
 import com.community.huiju.model.*;
9 10
 import com.community.huiju.service.TaUserVerifyServicel;
10 11
 import com.community.huiju.vo.TaUserVO;
@@ -12,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.stereotype.Service;
14 15
 
16
+import java.time.LocalDateTime;
15 17
 import java.util.Date;
16 18
 import java.util.List;
17 19
 
@@ -223,10 +225,89 @@ public class TaUserVerifyServicelmpl implements TaUserVerifyServicel {
223 225
             userVerify.setVerifyStatus(userVerifyStatus);
224 226
             userVerify.setRemark(remark);
225 227
             taUserVerifyMapper.updateByPrimaryKeySelective(userVerify);
228
+
229
+            // 获取这个被审核的用户
230
+            TaUser user = taUserMapper.selectByPrimaryKey(userVerify.getUserId());
231
+
232
+            // 往楼栋资料库插入数据
233
+            // 校验楼栋信息表
234
+            TpBuildingOwnerInfo selectBuild = getBuildingInfo(userElement, user.getLoginName());
235
+            if (null == selectBuild) {
236
+                // 插入楼栋信息数据
237
+                insertTpBuildingOwnerInfo(userElement, user, null);
238
+            }
239
+
226 240
             responseBean.addSuccess("操作成功!");
227 241
             return responseBean;
228 242
         }
229 243
         responseBean.addError("操作失败!");
230 244
         return responseBean;
231 245
     }
246
+
247
+    /**
248
+     * 查询 楼栋信息
249
+     *      根据小区Id, 栋,单元,楼层,房号, 手机号
250
+     * @param userElement
251
+     * @param phone
252
+     * @return
253
+     */
254
+    private TpBuildingOwnerInfo getBuildingInfo(UserElement userElement, String phone) {
255
+
256
+        TpBuildingOwnerInfo selectBuild = tpBuildingOwnerInfoMapper.selectCommunityAndAddressAndPhone(userElement.getCommunityId(),
257
+                userElement.getPhaseId(), userElement.getBuildingId(), userElement.getUnitId(), userElement.getLevelId(),
258
+                userElement.getRoomNoId(), phone);
259
+
260
+        return selectBuild;
261
+    }
262
+
263
+    /**
264
+     * 插入 楼栋资料库
265
+     *
266
+     * @param userElement
267
+     * @param user
268
+     * @param userId 创建人
269
+     */
270
+    private TpBuildingOwnerInfo insertTpBuildingOwnerInfo (UserElement userElement, TaUser user, Integer userId) {
271
+        TpBuildingOwnerInfo tpBuildingOwnerInfo = new TpBuildingOwnerInfo();
272
+        // 查询 期/楼栋/单元/层/户号
273
+        TpPhase phase = tpPhaseMapper.selectByPrimaryKey(userElement.getPhaseId());
274
+        TpBuilding building = tpBuildingMapper.selectByPrimaryKey(userElement.getBuildingId());
275
+        TpUnit unit = tpUnitMapper.selectByPrimaryKey(userElement.getUnitId());
276
+        TpLevel level = tpLevelMapper.selectByPrimaryKey(userElement.getLevelId());
277
+        TpRoomNo roomNo = tpRoomNoMapper.selectByPrimaryKey(userElement.getRoomNoId());
278
+
279
+
280
+        // 主键是自增的, 所以设置为 null
281
+        tpBuildingOwnerInfo.setId(null);
282
+        tpBuildingOwnerInfo.setPhaseId(phase.getId());
283
+        tpBuildingOwnerInfo.setPhaseName(phase.getName());
284
+        tpBuildingOwnerInfo.setBuildingId(building.getId());
285
+        tpBuildingOwnerInfo.setBuildingName(building.getName());
286
+        tpBuildingOwnerInfo.setUnitId(unit.getId());
287
+        tpBuildingOwnerInfo.setUnitName(unit.getName());
288
+        tpBuildingOwnerInfo.setLevelId(level.getId());
289
+        tpBuildingOwnerInfo.setLevelName(level.getName());
290
+        tpBuildingOwnerInfo.setRoomNoId(roomNo.getId());
291
+        tpBuildingOwnerInfo.setRoomNoName(roomNo.getName());
292
+        tpBuildingOwnerInfo.setOwnerName(user.getUserName());
293
+        tpBuildingOwnerInfo.setOwnerTel(user.getLoginName());
294
+        tpBuildingOwnerInfo.setGender(user.getGender());
295
+        // tpBuildingOwnerInfo.setUpdateUser(userId);
296
+        tpBuildingOwnerInfo.setUpdateDate(new Date());
297
+        tpBuildingOwnerInfo.setCreateDate(new Date());
298
+        // tpBuildingOwnerInfo.setCreateUser(userId);
299
+        tpBuildingOwnerInfo.setVerifyStatus("1");
300
+        tpBuildingOwnerInfo.setPairStatus("1");
301
+
302
+        // 添加的时候, 默认是当前操作的小区
303
+        tpBuildingOwnerInfo.setCommunityId(userElement.getCommunityId());
304
+
305
+        int row = tpBuildingOwnerInfoMapper.insertSelective(tpBuildingOwnerInfo);
306
+        if (row <= 0) {
307
+            log.error("添加操作! 楼栋业主信息表 失败!");
308
+            throw new WisdomException("操作失败!");
309
+        }
310
+        return tpBuildingOwnerInfo;
311
+    }
312
+
232 313
 }

+ 8
- 7
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Vedi File

@@ -734,16 +734,17 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
734 734
     @Transactional(rollbackFor = Exception.class)
735 735
     public ResponseBean deleteIds(List<Integer> ids, Integer propertyUserId) {
736 736
 
737
+        /**
738
+         * 楼栋资料删除的是 审核表里面的数据
739
+         */
740
+
737 741
         ResponseBean responseBean = new ResponseBean();
738 742
         ids.stream().forEach(e->{
739
-            TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(e);
740
-            if ("1".equals(buildingOwnerInfo.getVerifyStatus())) {
741
-                throw new WisdomException("不能删除已认证的楼栋资料!");
742
-                /**
743
-                 * 批量删除的时候,只要存在一个已认证的楼栋资料, 就停止删除!
744
-                 */
743
+            TaUserVerify userVerify = taUserVerifyMapper.selectById(e);
744
+            if ("1".equals(userVerify.getVerifyStatus())) {
745
+                throw new WisdomException("不能删除已审核的资料!");
745 746
             }
746
-            tpBuildingOwnerInfoMapper.deleteById(buildingOwnerInfo.getId());
747
+            taUserVerifyMapper.deleteById(e);
747 748
         });
748 749
 
749 750
         responseBean.addSuccess("操作成功!");