Przeglądaj źródła

优化小区房屋和小区业主 支持按小区查询数据

wuxw 1 rok temu
rodzic
commit
e40889177c
23 zmienionych plików z 559 dodań i 163 usunięć
  1. 9 0
      java110-bean/src/main/java/com/java110/dto/owner/OwnerDto.java
  2. 10 0
      java110-bean/src/main/java/com/java110/dto/privilege/PrivilegeUserDto.java
  3. 9 0
      java110-bean/src/main/java/com/java110/dto/room/RoomDto.java
  4. 9 0
      java110-bean/src/main/java/com/java110/dto/unit/UnitDto.java
  5. 12 0
      java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml
  6. 83 86
      java110-db/src/main/resources/mapper/user/OrgCommunityV1ServiceDaoImplMapper.xml
  7. 1 1
      java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml
  8. 12 0
      java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml
  9. 6 0
      java110-db/src/main/resources/mapper/user/PrivilegeUserV1ServiceDaoImplMapper.xml
  10. 3 0
      java110-interface/src/main/java/com/java110/intf/user/IStaffCommunityV1InnerServiceSMO.java
  11. 106 0
      service-community/src/main/java/com/java110/community/cmd/community/ListAdminCommunitysCmd.java
  12. 23 19
      service-community/src/main/java/com/java110/community/cmd/community/ListCommunitysCmd.java
  13. 27 20
      service-community/src/main/java/com/java110/community/cmd/community/ListMyEnteredCommunitysCmd.java
  14. 13 0
      service-community/src/main/java/com/java110/community/cmd/room/QueryAdminRoomCmd.java
  15. 17 5
      service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityUnitTreeCmd.java
  16. 13 1
      service-user/src/main/java/com/java110/user/cmd/owner/QueryAdminOwnersCmd.java
  17. 55 0
      service-user/src/main/java/com/java110/user/cmd/role/ListAStaffCommunityCmd.java
  18. 3 1
      service-user/src/main/java/com/java110/user/cmd/role/ListStaffCommunityCmd.java
  19. 5 2
      service-user/src/main/java/com/java110/user/cmd/role/ListStaffsNoRoleCmd.java
  20. 78 0
      service-user/src/main/java/com/java110/user/cmd/role/ListWaitAStaffCommunityCmd.java
  21. 6 5
      service-user/src/main/java/com/java110/user/cmd/user/QueryStaffInfosCmd.java
  22. 13 13
      service-user/src/main/java/com/java110/user/dao/impl/PrivilegeUserV1ServiceDaoImpl.java
  23. 46 10
      service-user/src/main/java/com/java110/user/smo/impl/StaffCommunityV1InnerServiceSMOImpl.java

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerDto.java

@@ -42,6 +42,7 @@ public class OwnerDto extends PageDto implements Serializable {
 
 
     private String communityId;
+    private String[] communityIds;
     private String communityName;
     private String sCommunityTel;
 
@@ -659,4 +660,12 @@ public class OwnerDto extends PageDto implements Serializable {
     public void setPersonRoleName(String personRoleName) {
         this.personRoleName = personRoleName;
     }
+
+    public String[] getCommunityIds() {
+        return communityIds;
+    }
+
+    public void setCommunityIds(String[] communityIds) {
+        this.communityIds = communityIds;
+    }
 }

+ 10 - 0
java110-bean/src/main/java/com/java110/dto/privilege/PrivilegeUserDto.java

@@ -25,6 +25,8 @@ public class PrivilegeUserDto extends PageDto implements Serializable {
     private String userName;
     private String roleName;
 
+    private String levelCd;
+
     private Date createTime;
     private String[] orgIds;
 
@@ -118,4 +120,12 @@ public class PrivilegeUserDto extends PageDto implements Serializable {
     public void setOrgIds(String[] orgIds) {
         this.orgIds = orgIds;
     }
+
+    public String getLevelCd() {
+        return levelCd;
+    }
+
+    public void setLevelCd(String levelCd) {
+        this.levelCd = levelCd;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/room/RoomDto.java

@@ -51,6 +51,7 @@ public class RoomDto extends PageDto implements Serializable {
     private String apartment;
     private String apartmentName;
     private String communityId;
+    private String[] communityIds;
 
     private String communityName;
     private String floorId;
@@ -599,4 +600,12 @@ public class RoomDto extends PageDto implements Serializable {
     public void setCommunityName(String communityName) {
         this.communityName = communityName;
     }
+
+    public String[] getCommunityIds() {
+        return communityIds;
+    }
+
+    public void setCommunityIds(String[] communityIds) {
+        this.communityIds = communityIds;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/unit/UnitDto.java

@@ -25,6 +25,7 @@ public class UnitDto extends PageDto implements Serializable {
     private String[] unitIds;
 
     private String communityId;
+    private String[] communityIds;
 
     /**
      * 编号
@@ -194,4 +195,12 @@ public class UnitDto extends PageDto implements Serializable {
     public void setCommunityName(String communityName) {
         this.communityName = communityName;
     }
+
+    public String[] getCommunityIds() {
+        return communityIds;
+    }
+
+    public void setCommunityIds(String[] communityIds) {
+        this.communityIds = communityIds;
+    }
 }

+ 12 - 0
java110-db/src/main/resources/mapper/community/RoomServiceDaoImplMapper.xml

@@ -394,6 +394,12 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
+        <if test="communityIds != null">
+            and t.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="floorNum !=null and floorNum != ''">
             and f.`floor_num`= #{floorNum}
         </if>
@@ -714,6 +720,12 @@
         <if test="communityId !=null and communityId != ''">
             AND t.`community_id` = #{communityId}
         </if>
+        <if test="communityIds != null">
+            and t.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="floorId !=null and floorId != ''">
             and f.`floor_id`= #{floorId}
         </if>

+ 83 - 86
java110-db/src/main/resources/mapper/user/OrgCommunityV1ServiceDaoImplMapper.xml

@@ -5,111 +5,108 @@
 <mapper namespace="orgCommunityV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存组织小区信息 add by wuxw 2018-07-03 -->
     <insert id="saveOrgCommunityInfo" parameterType="Map">
         insert into u_org_community(
-org_name,community_name,community_id,store_id,org_id,org_community_id
-) values (
-#{orgName},#{communityName},#{communityId},#{storeId},#{orgId},#{orgCommunityId}
-)
+        org_name,community_name,community_id,store_id,org_id,org_community_id
+        ) values (
+        #{orgName},#{communityName},#{communityId},#{storeId},#{orgId},#{orgCommunityId}
+        )
     </insert>
 
 
-
     <!-- 查询组织小区信息 add by wuxw 2018-07-03 -->
     <select id="getOrgCommunityInfo" parameterType="Map" resultType="Map">
-        select  t.org_name,t.org_name orgName,t.community_name,t.community_name communityName,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.store_id,t.store_id storeId,t.org_id,t.org_id orgId,t.org_community_id,t.org_community_id orgCommunityId 
-from u_org_community t 
-where 1 =1 
-<if test="orgName !=null and orgName != ''">
-   and t.org_name= #{orgName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="orgId !=null and orgId != ''">
-   and t.org_id= #{orgId}
-</if> 
-<if test="orgCommunityId !=null and orgCommunityId != ''">
-   and t.org_community_id= #{orgCommunityId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.org_name,t.org_name orgName,t.community_name,t.community_name communityName,t.status_cd,t.status_cd
+        statusCd,t.community_id,t.community_id communityId,t.store_id,t.store_id storeId,t.org_id,t.org_id
+        orgId,t.org_community_id,t.org_community_id orgCommunityId
+        from u_org_community t
+        where 1 =1
+        <if test="orgName !=null and orgName != ''">
+            and t.org_name= #{orgName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="orgId !=null and orgId != ''">
+            and t.org_id= #{orgId}
+        </if>
+        <if test="orgCommunityId !=null and orgCommunityId != ''">
+            and t.org_community_id= #{orgCommunityId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改组织小区信息 add by wuxw 2018-07-03 -->
     <update id="updateOrgCommunityInfo" parameterType="Map">
-        update  u_org_community t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="orgName !=null and orgName != ''">
-, t.org_name= #{orgName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-, t.community_name= #{communityName}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-, t.store_id= #{storeId}
-</if> 
-<if test="orgId !=null and orgId != ''">
-, t.org_id= #{orgId}
-</if> 
- where 1=1 <if test="orgCommunityId !=null and orgCommunityId != ''">
-and t.org_community_id= #{orgCommunityId}
-</if> 
+        update u_org_community t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="orgName !=null and orgName != ''">
+            , t.org_name= #{orgName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            , t.community_name= #{communityName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        <if test="orgId !=null and orgId != ''">
+            , t.org_id= #{orgId}
+        </if>
+        where 1=1
+        <if test="orgCommunityId !=null and orgCommunityId != ''">
+            and t.org_community_id= #{orgCommunityId}
+        </if>
 
     </update>
 
     <!-- 查询组织小区数量 add by wuxw 2018-07-03 -->
-     <select id="queryOrgCommunitysCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from u_org_community t 
-where 1 =1 
-<if test="orgName !=null and orgName != ''">
-   and t.org_name= #{orgName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="orgId !=null and orgId != ''">
-   and t.org_id= #{orgId}
-</if> 
-<if test="orgCommunityId !=null and orgCommunityId != ''">
-   and t.org_community_id= #{orgCommunityId}
-</if> 
+    <select id="queryOrgCommunitysCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from u_org_community t
+        where 1 =1
+        <if test="orgName !=null and orgName != ''">
+            and t.org_name= #{orgName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="orgId !=null and orgId != ''">
+            and t.org_id= #{orgId}
+        </if>
+        <if test="orgCommunityId !=null and orgCommunityId != ''">
+            and t.org_community_id= #{orgCommunityId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 1 - 1
java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml

@@ -43,7 +43,7 @@
         <if test="storeId !=null and storeId != ''">
             and t.store_id= #{storeId}
         </if>
-        <if test="storeTypeCd !=null and storeId = '800900000003'">
+        <if test="storeTypeCd == '800900000003'">
             and t.store_id not in ('400000000000000001','400000000000000002')
         </if>
 

+ 12 - 0
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -190,6 +190,12 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
+        <if test="communityIds != null">
+            and t.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="idCard !=null and idCard != ''">
             and t.id_card = #{idCard}
         </if>
@@ -277,6 +283,12 @@
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
+        <if test="communityIds != null">
+            and t.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="idCard !=null and idCard != ''">
             and t.id_card = #{idCard}
         </if>

+ 6 - 0
java110-db/src/main/resources/mapper/user/PrivilegeUserV1ServiceDaoImplMapper.xml

@@ -180,6 +180,9 @@
         <if test="userName !=null and userName != ''">
             and t.name like concat('%', #{userName},'%')
         </if>
+        <if test="levelCd !=null and levelCd != ''">
+            and t.level_cd = #{levelCd}
+        </if>
         and su.store_id = #{storeId}
         <if test="orgIds != null and orgIds.length > 0">
             and uosr.org_id in
@@ -211,6 +214,9 @@
         <if test="userName !=null and userName != ''">
             and t.name like concat('%', #{userName},'%')
         </if>
+        <if test="levelCd !=null and levelCd != ''">
+            and t.level_cd = #{levelCd}
+        </if>
         and su.store_id = #{storeId}
         <if test="orgIds != null and orgIds.length > 0">
             and uosr.org_id in

+ 3 - 0
java110-interface/src/main/java/com/java110/intf/user/IStaffCommunityV1InnerServiceSMO.java

@@ -64,4 +64,7 @@ public interface IStaffCommunityV1InnerServiceSMO {
      */
     @RequestMapping(value = "/queryStaffCommunitysCount", method = RequestMethod.POST)
     int queryStaffCommunitysCount(@RequestBody StaffCommunityDto staffCommunityDto);
+
+    @RequestMapping(value = "/queryStaffCommunityIds", method = RequestMethod.POST)
+    List<String> queryStaffCommunityIds(@RequestBody String staffId);
 }

+ 106 - 0
service-community/src/main/java/com/java110/community/cmd/community/ListAdminCommunitysCmd.java

@@ -0,0 +1,106 @@
+package com.java110.community.cmd.community;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.doc.annotation.*;
+import com.java110.dto.area.AreaDto;
+import com.java110.dto.community.CommunityDto;
+import com.java110.intf.common.IAreaInnerServiceSMO;
+import com.java110.intf.community.ICommunityInnerServiceSMO;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.vo.ResultVo;
+import com.java110.vo.api.community.ApiCommunityDataVo;
+import com.java110.vo.api.community.ApiCommunityVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 运营查询小区
+ */
+@Java110Cmd(serviceCode = "community.listAdminCommunitys")
+public class ListAdminCommunitysCmd extends Cmd {
+
+    @Autowired
+    private IAreaInnerServiceSMO areaInnerServiceSMOImpl;
+
+    @Autowired
+    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        super.validatePageInfo(reqJson);
+        super.validateAdmin(context);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        CommunityDto communityDto = BeanConvertUtil.covertBean(reqJson, CommunityDto.class);
+
+        String staffId = CmdContextUtils.getUserId(context);
+
+        List<String> communityIds = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunityIds(staffId);
+
+        if (!ListUtil.isNull(communityIds)) {
+            communityDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
+        }
+
+        int count = communityInnerServiceSMOImpl.queryCommunitysCount(communityDto);
+
+        List<CommunityDto> communityDtos = null;
+        CommunityDto apiCommunityDataVo = null;
+        if (count > 0) {
+            communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+            refreshCommunityCity(communityDtos);
+        } else {
+            communityDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, communityDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+
+    /**
+     * 刷新cityName
+     *
+     * @param communitys
+     */
+    private void refreshCommunityCity(List<CommunityDto> communitys) {
+        List<String> areaCodes = new ArrayList<>();
+        for (CommunityDto communityDataVo : communitys) {
+            areaCodes.add(communityDataVo.getCityCode());
+        }
+        if (ListUtil.isNull(areaCodes)) {
+            return;
+        }
+        AreaDto areaDto = new AreaDto();
+        areaDto.setAreaCodes(areaCodes.toArray(new String[areaCodes.size()]));
+        List<AreaDto> areaDtos = areaInnerServiceSMOImpl.getProvCityArea(areaDto);
+        for (CommunityDto communityDataVo : communitys) {
+            for (AreaDto tmpAreaDto : areaDtos) {
+                if (communityDataVo.getCityCode().equals(tmpAreaDto.getAreaCode())) {
+                    communityDataVo.setCityName(tmpAreaDto.getProvName() + tmpAreaDto.getCityName() + tmpAreaDto.getAreaName());
+                    break;
+                }
+                communityDataVo.setCityName("未知");
+            }
+        }
+    }
+
+}

Plik diff jest za duży
+ 23 - 19
service-community/src/main/java/com/java110/community/cmd/community/ListCommunitysCmd.java


+ 27 - 20
service-community/src/main/java/com/java110/community/cmd/community/ListMyEnteredCommunitysCmd.java

@@ -2,11 +2,13 @@ package com.java110.community.cmd.community;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.community.CommunityDto;
 import com.java110.dto.privilege.RoleCommunityDto;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
 import com.java110.dto.store.StoreDto;
 import com.java110.dto.user.UserDto;
 import com.java110.intf.community.ICommunityInnerServiceSMO;
@@ -16,6 +18,7 @@ import com.java110.utils.constant.StateConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import com.java110.vo.api.community.ApiCommunityDataVo;
@@ -37,7 +40,7 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
     private IOrgStaffRelInnerServiceSMO orgStaffRelInnerServiceSMOImpl;
 
     @Autowired
-    private IRoleCommunityV1InnerServiceSMO roleCommunityV1InnerServiceSMOImpl;
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
 
     @Autowired
     private IOrgInnerServiceSMO orgInnerServiceSMOImpl;
@@ -51,12 +54,14 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
 
-        if (!reqJson.containsKey("storeId") || StringUtil.isEmpty(reqJson.getString("storeId"))) {
-            reqJson.put("storeId", cmdDataFlowContext.getReqHeaders().get("store-id"));
+        String storeId = reqJson.getString("storeId");
+        String userId = reqJson.getString("userId");
+        if (StringUtil.isEmpty(storeId)) {
+            reqJson.put("storeId", CmdContextUtils.getStoreId(cmdDataFlowContext));
         }
 
-        if (!reqJson.containsKey("userId") || StringUtil.isEmpty(reqJson.getString("userId"))) {
-            reqJson.put("userId", cmdDataFlowContext.getReqHeaders().get("user-id"));
+        if (StringUtil.isEmpty(userId)) {
+            reqJson.put("userId", CmdContextUtils.getUserId(cmdDataFlowContext));
         }
 
         Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含商户信息");
@@ -85,7 +90,8 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
 
         int count = 0;
         List<ApiCommunityDataVo> communitys = null;
-        if(UserDto.LEVEL_CD_ADMIN.equals(userDtos.get(0).getLevelCd())){
+        ApiCommunityDataVo tmpApiCommunityDataVo = null;
+        if (UserDto.LEVEL_CD_ADMIN.equals(userDtos.get(0).getLevelCd())) {
             CommunityDto communityDto = BeanConvertUtil.covertBean(reqJson, CommunityDto.class);
             communityDto.setMemberId(reqJson.getString("storeId"));
             communityDto.setAuditStatusCd(StateConstant.AGREE_AUDIT);
@@ -98,19 +104,21 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
             } else {
                 communitys = new ArrayList<>();
             }
-        }else{
-            RoleCommunityDto orgCommunityDto = BeanConvertUtil.covertBean(reqJson, RoleCommunityDto.class);
-            orgCommunityDto.setStaffId(userDtos.get(0).getUserId());
-            count = roleCommunityV1InnerServiceSMOImpl.queryRoleCommunitysNameCount(orgCommunityDto);
+        } else {
+            StaffCommunityDto staffCommunityDto = BeanConvertUtil.covertBean(reqJson, StaffCommunityDto.class);
+            staffCommunityDto.setStaffId(userDtos.get(0).getUserId());
+            count = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitysCount(staffCommunityDto);
             if (count > 0) {
-                List<RoleCommunityDto> roleCommunityDtos = roleCommunityV1InnerServiceSMOImpl.queryRoleCommunitysName(orgCommunityDto);
-                communitys = BeanConvertUtil.covertBeanList(roleCommunityDtos, ApiCommunityDataVo.class);
-                for (RoleCommunityDto tmpOrgCommunityDto : roleCommunityDtos) {
-                    for (ApiCommunityDataVo tmpApiCommunityDataVo : communitys) {
-                        if (tmpOrgCommunityDto.getCommunityId().equals(tmpApiCommunityDataVo.getCommunityId())) {
-                            tmpApiCommunityDataVo.setName(tmpOrgCommunityDto.getCommunityName());
-                        }
-                    }
+                List<StaffCommunityDto> staffCommunityDtos = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitys(staffCommunityDto);
+                communitys = new ArrayList<>();
+                for (StaffCommunityDto tmpStaffCommunityDto : staffCommunityDtos) {
+                    tmpApiCommunityDataVo = new ApiCommunityDataVo();
+                    tmpApiCommunityDataVo.setCommunityId(tmpStaffCommunityDto.getCommunityId());
+                    tmpApiCommunityDataVo.setName(tmpStaffCommunityDto.getCommunityName());
+                    tmpApiCommunityDataVo.setStoreId(tmpStaffCommunityDto.getStoreId());
+                    tmpApiCommunityDataVo.setStoreName(tmpStaffCommunityDto.getStoreName());
+                    tmpApiCommunityDataVo.setState("1100");
+                    communitys.add(tmpApiCommunityDataVo);
                 }
             } else {
                 communitys = new ArrayList<>();
@@ -118,7 +126,7 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
 
         }
         //兼容 系统刚开始没有小区时
-        if (communitys.size() < 1 && (StoreDto.STORE_TYPE_ADMIN.equals(storeDtos.get(0).getStoreTypeCd()) || StoreDto.STORE_TYPE_DEV.equals(storeDtos.get(0).getStoreTypeCd()))) {
+        if (ListUtil.isNull(communitys) && (StoreDto.STORE_TYPE_ADMIN.equals(storeDtos.get(0).getStoreTypeCd()) || StoreDto.STORE_TYPE_DEV.equals(storeDtos.get(0).getStoreTypeCd()))) {
             ApiCommunityDataVo apiCommunityDataVo = new ApiCommunityDataVo();
             apiCommunityDataVo.setCommunityId("-1");
             apiCommunityDataVo.setName("默认小区");
@@ -127,7 +135,6 @@ public class ListMyEnteredCommunitysCmd extends Cmd {
             communitys.add(apiCommunityDataVo);
         }
 
-        //if(communitys.size() < 1 && )
         ApiCommunityVo apiCommunityVo = new ApiCommunityVo();
         apiCommunityVo.setTotal(count);
         apiCommunityVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));

+ 13 - 0
service-community/src/main/java/com/java110/community/cmd/room/QueryAdminRoomCmd.java

@@ -3,6 +3,7 @@ package com.java110.community.cmd.room;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.community.bmo.room.IQueryRoomStatisticsBMO;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
@@ -10,6 +11,7 @@ import com.java110.dto.owner.OwnerRoomRelDto;
 import com.java110.dto.room.RoomDto;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.ListUtil;
@@ -35,6 +37,9 @@ public class QueryAdminRoomCmd extends Cmd {
     @Autowired
     private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
         super.validateAdmin(context);
@@ -53,6 +58,14 @@ public class QueryAdminRoomCmd extends Cmd {
         //todo 计算楼栋单元房屋编号
         computeFloorUnitRoomNum(reqJson, roomDto);
 
+        String staffId = CmdContextUtils.getUserId(context);
+
+        List<String> communityIds = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunityIds(staffId);
+
+        if (!ListUtil.isNull(communityIds)) {
+            roomDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
+        }
+
         int count = roomInnerServiceSMOImpl.queryRoomsCount(roomDto);
         List<RoomDto> roomDtos = null;
         if (count > 0) {

+ 17 - 5
service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityUnitTreeCmd.java

@@ -3,12 +3,14 @@ package com.java110.report.cmd.community;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.room.RoomDto;
 import com.java110.dto.unit.UnitDto;
 import com.java110.intf.report.IReportCommunityInnerServiceSMO;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
@@ -27,6 +29,10 @@ public class QueryCommunityUnitTreeCmd extends Cmd {
     @Autowired
     private IReportCommunityInnerServiceSMO reportCommunityInnerServiceSMOImpl;
 
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
         // must be administrator
@@ -39,7 +45,13 @@ public class QueryCommunityUnitTreeCmd extends Cmd {
         List<UnitDto> unitDtos = null;
 
         UnitDto unitDto = new UnitDto();
+        String staffId = CmdContextUtils.getUserId(context);
 
+        List<String> communityIds = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunityIds(staffId);
+
+        if (!ListUtil.isNull(communityIds)) {
+            unitDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
+        }
 
         unitDtos = reportCommunityInnerServiceSMOImpl.queryCommunityUnitTree(unitDto);
         JSONArray communitys = new JSONArray();
@@ -82,7 +94,7 @@ public class QueryCommunityUnitTreeCmd extends Cmd {
         JSONArray floors = community.getJSONArray("children");
         JSONObject floorInfo = null;
         for (UnitDto tmpUnitDto : unitDtos) {
-            if(!community.getString("communityId").equals(tmpUnitDto.getCommunityId())){
+            if (!community.getString("communityId").equals(tmpUnitDto.getCommunityId())) {
                 continue;
             }
             if (!hasInFloor(tmpUnitDto, floors)) {
@@ -90,7 +102,7 @@ public class QueryCommunityUnitTreeCmd extends Cmd {
                 floorInfo.put("id", "f_" + tmpUnitDto.getFloorId());
                 floorInfo.put("floorId", tmpUnitDto.getFloorId());
                 floorInfo.put("communityId", community.getString("communityId"));
-                floorInfo.put("text", tmpUnitDto.getFloorNum()+"栋");
+                floorInfo.put("text", tmpUnitDto.getFloorNum() + "栋");
                 floorInfo.put("icon", "/img/floor.png");
                 floorInfo.put("children", new JSONArray());
                 floors.add(floorInfo);
@@ -110,17 +122,17 @@ public class QueryCommunityUnitTreeCmd extends Cmd {
         JSONArray units = floor.getJSONArray("children");
         JSONObject unitInfo = null;
         for (UnitDto tmpUnitDto : unitDtos) {
-            if(!floor.getString("communityId").equals(tmpUnitDto.getCommunityId())){
+            if (!floor.getString("communityId").equals(tmpUnitDto.getCommunityId())) {
                 continue;
             }
-            if(!floor.getString("floorId").equals(tmpUnitDto.getFloorId())){
+            if (!floor.getString("floorId").equals(tmpUnitDto.getFloorId())) {
                 continue;
             }
             if (!hasInUnit(tmpUnitDto, units)) {
                 unitInfo = new JSONObject();
                 unitInfo.put("id", "u_" + tmpUnitDto.getUnitId());
                 unitInfo.put("unitId", tmpUnitDto.getUnitId());
-                unitInfo.put("text", tmpUnitDto.getUnitNum()+"单元");
+                unitInfo.put("text", tmpUnitDto.getUnitNum() + "单元");
                 unitInfo.put("icon", "/img/unit.png");
                 units.add(unitInfo);
             }

+ 13 - 1
service-user/src/main/java/com/java110/user/cmd/owner/QueryAdminOwnersCmd.java

@@ -14,10 +14,12 @@ import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.community.IMenuInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
 import com.java110.user.bmo.owner.IQueryOwnerStatisticsBMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +44,9 @@ public class QueryAdminOwnersCmd extends Cmd {
     @Autowired
     private IQueryOwnerStatisticsBMO queryOwnerStatisticsBMOImpl;
 
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         super.validateAdmin(cmdDataFlowContext);
@@ -51,12 +56,19 @@ public class QueryAdminOwnersCmd extends Cmd {
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-        String userId = CmdContextUtils.getUserId(cmdDataFlowContext);
 
         //todo 根据房屋查询时 先用 房屋信息查询 业主ID
         freshRoomId(reqJson);
         OwnerDto ownerDto = BeanConvertUtil.covertBean(reqJson, OwnerDto.class);
 
+        String staffId = CmdContextUtils.getUserId(cmdDataFlowContext);
+
+        List<String> communityIds = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunityIds(staffId);
+
+        if (!ListUtil.isNull(communityIds)) {
+            ownerDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
+        }
+
         int row = reqJson.getInteger("row");
         //查询总记录数
         int total = ownerInnerServiceSMOImpl.queryOwnersCount(ownerDto);

+ 55 - 0
service-user/src/main/java/com/java110/user/cmd/role/ListAStaffCommunityCmd.java

@@ -0,0 +1,55 @@
+package com.java110.user.cmd.role;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "role.listAStaffCommunity")
+public class ListAStaffCommunityCmd extends Cmd {
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+        super.validateAdmin(cmdDataFlowContext);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        String storeId = CmdContextUtils.getStoreId(cmdDataFlowContext);
+        StaffCommunityDto staffCommunityDto = BeanConvertUtil.covertBean(reqJson, StaffCommunityDto.class);
+        staffCommunityDto.setStoreId(storeId);
+        int count = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitysCount(staffCommunityDto);
+
+        List<StaffCommunityDto> staffCommunityDtos = null;
+
+        if (count > 0) {
+            staffCommunityDtos = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitys(staffCommunityDto);
+        } else {
+            staffCommunityDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, staffCommunityDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 3 - 1
service-user/src/main/java/com/java110/user/cmd/role/ListStaffCommunityCmd.java

@@ -17,6 +17,7 @@ package com.java110.user.cmd.role;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
@@ -62,8 +63,9 @@ public class ListStaffCommunityCmd extends Cmd {
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
+        String storeId = CmdContextUtils.getStoreId(cmdDataFlowContext);
         StaffCommunityDto staffCommunityDto = BeanConvertUtil.covertBean(reqJson, StaffCommunityDto.class);
-
+        staffCommunityDto.setStoreId(storeId);
         int count = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitysCount(staffCommunityDto);
 
         List<StaffCommunityDto> staffCommunityDtos = null;

+ 5 - 2
service-user/src/main/java/com/java110/user/cmd/role/ListStaffsNoRoleCmd.java

@@ -17,10 +17,12 @@ import com.java110.intf.user.IPrivilegeUserV1InnerServiceSMO;
 import com.java110.intf.user.IUserV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.kafka.listener.ListenerUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -65,6 +67,7 @@ public class ListStaffsNoRoleCmd extends Cmd {
         privilegeUserDto.setUserName(reqJson.getString("searchUserName"));
         privilegeUserDto.setPage(Integer.parseInt(reqJson.getString("page")));
         privilegeUserDto.setRow(Integer.parseInt(reqJson.getString("row")));
+        privilegeUserDto.setLevelCd(UserDto.LEVEL_CD_STAFF);
 
         // 判断是不是管理员,管理员反馈 物业 的所角色
         UserDto userDto = new UserDto();
@@ -79,12 +82,12 @@ public class ListStaffsNoRoleCmd extends Cmd {
             basePrivilegeDto.setResource("/viewAllOrganization");
             basePrivilegeDto.setUserId(userId);
             List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto);
-            if (privileges.size() == 0) {
+            if (ListUtil.isNull(privileges)) {
                 //查询员工所属二级组织架构
                 OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
                 orgStaffRelDto.setStaffId(reqJson.getString("userId"));
                 List<OrgStaffRelDto> orgStaffRelDtos = iOrgStaffRelInnerServiceSMO.queryOrgInfoByStaffIdsNew(orgStaffRelDto);
-                if (orgStaffRelDtos.size() > 0) {
+                if (!ListUtil.isNull(orgStaffRelDtos)) {
                     List<String> haveOrgList = new ArrayList<String>();
                     for (OrgStaffRelDto orgStaffRelDto1 : orgStaffRelDtos) {
                         OrgDto orgDto1 = new OrgDto();

+ 78 - 0
service-user/src/main/java/com/java110/user/cmd/role/ListWaitAStaffCommunityCmd.java

@@ -0,0 +1,78 @@
+package com.java110.user.cmd.role;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.PageDto;
+import com.java110.dto.community.CommunityDto;
+import com.java110.dto.staffCommunity.StaffCommunityDto;
+import com.java110.intf.community.ICommunityInnerServiceSMO;
+import com.java110.intf.user.IStaffCommunityV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "role.listWaitAStaffCommunity")
+public class ListWaitAStaffCommunityCmd extends Cmd {
+
+    @Autowired
+    private IStaffCommunityV1InnerServiceSMO staffCommunityV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        super.validatePageInfo(reqJson);
+        super.validateAdmin(context);
+
+        Assert.hasKeyAndValue(reqJson, "staffId", "必填,请填写角色");
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        String storeId = CmdContextUtils.getStoreId(context);
+        StaffCommunityDto staffCommunityDto = new StaffCommunityDto();
+        staffCommunityDto.setStaffId(reqJson.getString("staffId"));
+        staffCommunityDto.setStoreId(storeId);
+        staffCommunityDto.setPage(PageDto.DEFAULT_PAGE);
+        List<StaffCommunityDto> staffCommunityDtos = staffCommunityV1InnerServiceSMOImpl.queryStaffCommunitys(staffCommunityDto);
+        List<String> communityIds = new ArrayList<>();
+        for (StaffCommunityDto tmpStaffCommunityDto : staffCommunityDtos) {
+            communityIds.add(tmpStaffCommunityDto.getCommunityId());
+        }
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setStoreId(storeId);
+        if (!ListUtil.isNull(communityIds)) {
+            communityDto.setNotInCommunityId(communityIds.toArray(new String[communityIds.size()]));
+        }
+        communityDto.setAuditStatusCd("1100");
+        communityDto.setPage(reqJson.getIntValue("page"));
+        communityDto.setRow(reqJson.getIntValue("row"));
+        int count = communityInnerServiceSMOImpl.queryCommunitysCount(communityDto);
+
+        List<CommunityDto> communitys = null;
+
+        if (count > 0) {
+            communitys = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+        } else {
+            communitys = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, communitys);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 6 - 5
service-user/src/main/java/com/java110/user/cmd/user/QueryStaffInfosCmd.java

@@ -102,6 +102,7 @@ public class QueryStaffInfosCmd extends Cmd {
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
         UserDto userDto = BeanConvertUtil.covertBean(reqJson, UserDto.class);
+        userDto.setLevelCd(UserDto.LEVEL_CD_STAFF); // 这里只查员工不查管理员
         String userId = context.getReqHeaders().get("user-id");
         // 判断是不是管理员,管理员反馈 物业 的所角色
         UserDto userDto1 = new UserDto();
@@ -142,7 +143,7 @@ public class QueryStaffInfosCmd extends Cmd {
                 fileRelDto.setObjId(apiStaffDataVo.getUserId());
                 fileRelDto.setRelTypeCd("12000"); //员工图片
                 List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto);
-                if (fileRelDtos != null && fileRelDtos.size() > 0) {
+                if (!ListUtil.isNull(fileRelDtos)) {
                     List<String> urls = new ArrayList<>();
                     for (FileRelDto fileRel : fileRelDtos) {
                         urls.add(fileRel.getFileRealName());
@@ -165,7 +166,7 @@ public class QueryStaffInfosCmd extends Cmd {
     }
 
     private void refreshOrgs(List<ApiStaffDataVo> staffs, String storeId) {
-        if (staffs == null || staffs.size() < 1) {
+        if (ListUtil.isNull(staffs)) {
             return;
         }
         List<String> staffIds = new ArrayList<>();
@@ -175,14 +176,14 @@ public class QueryStaffInfosCmd extends Cmd {
         OrgDto orgDto = new OrgDto();
         orgDto.setStoreId(storeId);
         List<OrgDto> orgDtos = orgV1InnerServiceSMOImpl.queryOrgs(orgDto);
-        if (orgDtos == null || orgDtos.size() < 1) {
+        if (ListUtil.isNull(orgDtos)) {
             return;
         }
         OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
         orgStaffRelDto.setStaffIds(staffIds.toArray(new String[staffIds.size()]));
         orgStaffRelDto.setStoreId(storeId);
         List<OrgStaffRelDto> orgStaffRels = orgStaffRelV1InnerServiceSMOImpl.queryOrgStaffRels(orgStaffRelDto);
-        if (orgStaffRels == null || orgStaffRels.size() < 1) {
+        if (ListUtil.isNull(orgStaffRels)) {
             return;
         }
         for (ApiStaffDataVo apiStaffDataVo : staffs) {
@@ -193,7 +194,7 @@ public class QueryStaffInfosCmd extends Cmd {
                 OrgDto org = new OrgDto();
                 org.setOrgId(tmpOrgStaffRelDto.getOrgId());
                 List<OrgDto> orgs = orgV1InnerServiceSMOImpl.queryOrgs(org);
-                if (orgs == null || orgs.size() < 1) {
+                if (ListUtil.isNull(orgs)) {
                     continue;
                 }
                 apiStaffDataVo.setOrgId(tmpOrgStaffRelDto.getOrgId());

+ 13 - 13
service-user/src/main/java/com/java110/user/dao/impl/PrivilegeUserV1ServiceDaoImpl.java

@@ -100,54 +100,54 @@ public class PrivilegeUserV1ServiceDaoImpl extends BaseServiceDao implements IPr
     public int queryPrivilegeUsersCount(Map info) {
         logger.debug("查询 queryPrivilegeUsersCount 入参 info : {}",info);
 
-        List<Map> businessPrivilegeUserInfos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUsersCount", info);
-        if (businessPrivilegeUserInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUsersCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessPrivilegeUserInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     @Override
     public List<Map> queryPrivilegeUserInfos(Map info) {
         logger.debug("查询 getPrivilegeUserInfo 入参 info : {}",info);
 
-        List<Map> businessPrivilegeUserInfos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUserInfos",info);
+        List<Map> infos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUserInfos",info);
 
-        return businessPrivilegeUserInfos;
+        return infos;
     }
 
     @Override
     public int queryPrivilegeUserInfoCount(Map info) {
         logger.debug("查询 queryPrivilegeUsersCount 入参 info : {}",info);
 
-        List<Map> businessPrivilegeUserInfos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUserInfoCount", info);
-        if (businessPrivilegeUserInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryPrivilegeUserInfoCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessPrivilegeUserInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     @Override
     public int queryStaffsNoRoleCount(Map info) {
         logger.debug("查询 queryStaffsNoRoleCount 入参 info : {}",info);
 
-        List<Map> businessPrivilegeUserInfos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryStaffsNoRoleCount", info);
-        if (businessPrivilegeUserInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryStaffsNoRoleCount", info);
+        if (infos.size() < 1) {
             return 0;
         }
 
-        return Integer.parseInt(businessPrivilegeUserInfos.get(0).get("count").toString());
+        return Integer.parseInt(infos.get(0).get("count").toString());
     }
 
     @Override
     public List<Map> queryStaffsNoRoleInfos(Map info) {
         logger.debug("查询 queryStaffsNoRoleInfos 入参 info : {}",info);
 
-        List<Map> businessPrivilegeUserInfos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryStaffsNoRoleInfos",info);
+        List<Map> infos = sqlSessionTemplate.selectList("privilegeUserV1ServiceDaoImpl.queryStaffsNoRoleInfos",info);
 
-        return businessPrivilegeUserInfos;
+        return infos;
     }
 
 

+ 46 - 10
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.utils.util.BeanConvertUtil;
 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 @@ public class StaffCommunityV1InnerServiceSMOImpl extends BaseServiceSMO implemen
     @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 @@ public class StaffCommunityV1InnerServiceSMOImpl extends BaseServiceSMO implemen
 
     @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;
+    }
 
 }