From e40889177c25035496c526dbc12a9665d5b61ceb Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 20 三月 2025 12:00:53 +0800
Subject: [PATCH] 优化小区房屋和小区业主 支持按小区查询数据

---
 service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java b/service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java
index a6f91e4..2b50914 100644
--- a/service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java
+++ b/service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java
@@ -16,6 +16,9 @@
 package com.java110.user.smo.impl;
 
 
+import com.java110.dto.community.CommunityDto;
+import com.java110.intf.community.ICommunityV1InnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
 import com.java110.user.dao.IStaffCommunityV1ServiceDao;
 import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
 import com.java110.dto.staffCommunity.StaffCommunityDto;
@@ -24,6 +27,7 @@
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.user.UserDto;
 import com.java110.dto.PageDto;
+import com.java110.utils.util.ListUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
@@ -45,28 +49,31 @@
     @Autowired
     private IStaffCommunityV1ServiceDao staffCommunityV1ServiceDaoImpl;
 
+    @Autowired
+    private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
 
     @Override
-    public int saveStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
+    public int saveStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo) {
         int saveFlag = staffCommunityV1ServiceDaoImpl.saveStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
         return saveFlag;
     }
 
-     @Override
-    public int updateStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
+    @Override
+    public int updateStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo) {
         int saveFlag = staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
         return saveFlag;
     }
 
-     @Override
-    public int deleteStaffCommunity(@RequestBody  StaffCommunityPo staffCommunityPo) {
-       staffCommunityPo.setStatusCd("1");
-       int saveFlag = staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
-       return saveFlag;
+    @Override
+    public int deleteStaffCommunity(@RequestBody StaffCommunityPo staffCommunityPo) {
+        staffCommunityPo.setStatusCd("1");
+        int saveFlag = staffCommunityV1ServiceDaoImpl.updateStaffCommunityInfo(BeanConvertUtil.beanCovertMap(staffCommunityPo));
+        return saveFlag;
     }
 
     @Override
-    public List<StaffCommunityDto> queryStaffCommunitys(@RequestBody  StaffCommunityDto staffCommunityDto) {
+    public List<StaffCommunityDto> queryStaffCommunitys(@RequestBody StaffCommunityDto staffCommunityDto) {
 
         //鏍¢獙鏄惁浼犱簡 鍒嗛〉淇℃伅
 
@@ -84,6 +91,35 @@
 
     @Override
     public int queryStaffCommunitysCount(@RequestBody StaffCommunityDto staffCommunityDto) {
-        return staffCommunityV1ServiceDaoImpl.queryStaffCommunitysCount(BeanConvertUtil.beanCovertMap(staffCommunityDto));    }
+        return staffCommunityV1ServiceDaoImpl.queryStaffCommunitysCount(BeanConvertUtil.beanCovertMap(staffCommunityDto));
+    }
+
+    @Override
+    public List<String> queryStaffCommunityIds(@RequestBody String staffId) {
+        List<String> communityIds = new ArrayList<>();
+        UserDto userDto = new UserDto();
+        userDto.setUserId(staffId);
+        List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
+        if (ListUtil.isNull(userDtos)) {
+            communityIds.add("-1");
+            return communityIds;
+        }
+
+        if (UserDto.LEVEL_CD_ADMIN.equals(userDtos.get(0).getLevelCd())) {
+            return communityIds;
+        }
+
+        StaffCommunityDto staffCommunityDto = new StaffCommunityDto();
+        staffCommunityDto.setStaffId(staffId);
+        List<StaffCommunityDto> staffCommunityDtos = queryStaffCommunitys(staffCommunityDto);
+        if (ListUtil.isNull(userDtos)) {
+            communityIds.add("-1");
+            return communityIds;
+        }
+        for (StaffCommunityDto tStaffCommunityDto : staffCommunityDtos) {
+            communityIds.add(tStaffCommunityDto.getCommunityId());
+        }
+        return communityIds;
+    }
 
 }

--
Gitblit v1.8.0