Kaynağa Gözat

小区楼查询改造支持条件查询

wuxw 7 yıl önce
ebeveyn
işleme
0b80ff5a11

+ 3 - 2
Api/src/main/java/com/java110/api/listener/floor/QueryFloorsListener.java

@@ -61,11 +61,12 @@ public class QueryFloorsListener extends AbstractServiceApiDataFlowListener {
         String communityId = reqJson.getString("communityId");
 
         ApiFloorVo apiFloorVo = new ApiFloorVo();
+
         //查询总记录数
-        int total = floorInnerServiceSMOImpl.queryFloorsCount(communityId);
+        int total = floorInnerServiceSMOImpl.queryFloorsCount(BeanConvertUtil.covertBean(reqJson, FloorDto.class));
         apiFloorVo.setTotal(total);
         if (total > 0) {
-            List<FloorDto> floorDtoList = floorInnerServiceSMOImpl.queryFloors(page, row, communityId);
+            List<FloorDto> floorDtoList = floorInnerServiceSMOImpl.queryFloors(BeanConvertUtil.covertBean(reqJson, FloorDto.class));
             apiFloorVo.setApiFloorDataVoList(BeanConvertUtil.covertBeanList(floorDtoList, ApiFloorDataVo.class));
         }
 

+ 9 - 0
CommunityService/src/main/java/com/java110/community/dao/IFloorServiceDao.java

@@ -88,6 +88,15 @@ public interface IFloorServiceDao {
      */
     List<Map> queryFloors(Map floorMap) throws DAOException;
 
+    /**
+     * 根据小区ID查询 小区楼数量
+     *
+     * @param info 小区ID
+     * @return 小区楼数量
+     * @throws DAOException 数据库异常信息
+     */
+    int queryFloorsCount(Map info) throws DAOException;
+
 
 
 }

+ 16 - 2
CommunityService/src/main/java/com/java110/community/dao/impl/FloorServiceDaoImpl.java

@@ -10,6 +10,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -115,8 +116,9 @@ public class FloorServiceDaoImpl extends BaseServiceDao implements IFloorService
     @Override
     public int queryFloorsCount(String communityId) throws DAOException {
         logger.debug("查询小区楼信息 入参 communityId : {}", communityId);
-
-        List<Map> businessFloorInfos = sqlSessionTemplate.selectList("floorServiceDaoImpl.queryFloorsCount", communityId);
+        Map info = new HashMap();
+        info.put("communityId", communityId);
+        List<Map> businessFloorInfos = sqlSessionTemplate.selectList("floorServiceDaoImpl.queryFloorsCount", info);
         if (businessFloorInfos.size() < 1) {
             return 0;
         }
@@ -133,5 +135,17 @@ public class FloorServiceDaoImpl extends BaseServiceDao implements IFloorService
         return businessFloorInfos;
     }
 
+    @Override
+    public int queryFloorsCount(Map info) throws DAOException {
+        logger.debug("查询小区楼信息 入参 info : {}", info);
+
+        List<Map> businessFloorInfos = sqlSessionTemplate.selectList("floorServiceDaoImpl.queryFloorsCount", info);
+        if (businessFloorInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessFloorInfos.get(0).get("count").toString());
+    }
+
 
 }

+ 40 - 0
CommunityService/src/main/java/com/java110/community/smo/impl/FloorInnerServiceSMOImpl.java

@@ -6,8 +6,11 @@ import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.core.smo.floor.IFloorInnerServiceSMO;
 import com.java110.core.smo.user.IUserInnerServiceSMO;
 import com.java110.dto.FloorDto;
+import com.java110.dto.PageDto;
+import com.java110.dto.UnitDto;
 import com.java110.dto.UserDto;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -75,6 +78,43 @@ public class FloorInnerServiceSMOImpl extends BaseServiceSMO implements IFloorIn
         return floorServiceDaoImpl.queryFloorsCount(communityId);
     }
 
+    @Override
+    public List<FloorDto> queryFloors(@RequestBody  FloorDto floorDto) {
+
+        //校验是否传了 分页信息
+
+        int page = floorDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            floorDto.setPage((page - 1) * floorDto.getRow());
+            floorDto.setRow(page * floorDto.getRow());
+        }
+
+
+        List<FloorDto> floors = BeanConvertUtil.covertBeanList(
+                floorServiceDaoImpl.queryFloors(BeanConvertUtil.beanCovertMap(floorDto)), FloorDto.class);
+
+
+        if (floors == null || floors.size() == 0) {
+            return floors;
+        }
+
+        String[] userIds = getUserIds(floors);
+        //根据 userId 查询用户信息
+        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
+
+        for (FloorDto floor : floors) {
+            refreshFloor(floor, users);
+        }
+        return floors;
+    }
+
+    @Override
+    public int queryFloorsCount(@RequestBody FloorDto floorDto) {
+        return floorServiceDaoImpl.queryFloorsCount(BeanConvertUtil.beanCovertMap(floorDto));
+    }
+
+
     /**
      * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
      *

+ 42 - 0
WebService/src/main/java/com/java110/web/components/unit/SearchFloorComponent.java

@@ -0,0 +1,42 @@
+package com.java110.web.components.unit;
+
+import com.java110.core.context.IPageData;
+import com.java110.web.smo.IFloorServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+/**
+ * @ClassName searchFloor
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2019/4/30 11:16
+ * @Version 1.0
+ * add by wuxw 2019/4/30
+ **/
+
+@Component("searchFloor")
+public class SearchFloorComponent {
+
+    @Autowired
+    private IFloorServiceSMO floorServiceSMOImpl;
+
+    /**
+     * 查询小区楼信息
+     *
+     * @param pd
+     * @return 返回小区楼信息
+     */
+    public ResponseEntity<String> listFloor(IPageData pd) {
+        return floorServiceSMOImpl.listFloor(pd);
+    }
+
+
+    public IFloorServiceSMO getFloorServiceSMOImpl() {
+        return floorServiceSMOImpl;
+    }
+
+    public void setFloorServiceSMOImpl(IFloorServiceSMO floorServiceSMOImpl) {
+        this.floorServiceSMOImpl = floorServiceSMOImpl;
+    }
+}

+ 5 - 1
WebService/src/main/java/com/java110/web/smo/impl/FloorServiceSMOImpl.java

@@ -50,6 +50,9 @@ public class FloorServiceSMOImpl extends BaseComponentSMO implements IFloorServi
         int rows = Integer.parseInt(paramIn.getString("rows"));
         String communityId = paramIn.getString("communityId");
 
+        //小区楼编号
+        String floorNum = paramIn.getString("floorNum");
+
 
         //校验用户是否有权限
         super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.PRIVILEGE_FLOOR);
@@ -67,7 +70,8 @@ public class FloorServiceSMOImpl extends BaseComponentSMO implements IFloorServi
         super.checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate);
 
         responseEntity = this.callCenterService(restTemplate, pd, "",
-                ServiceConstant.SERVICE_API_URL + "/api/floor.queryFloors?row=" + rows + "&page=" + page + "&communityId=" + communityId,
+                ServiceConstant.SERVICE_API_URL + "/api/floor.queryFloors?row=" + rows + "&page=" + page + "&communityId="
+                        + communityId + "&floorNum=" + floorNum,
                 HttpMethod.GET);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {

+ 5 - 7
WebService/src/main/resources/components/search-floor/searchFloor.html

@@ -29,20 +29,18 @@
                                 <table class="table table-striped">
                                     <thead>
                                     <tr>
-                                        <th>员工编码</th>
-                                        <th>员工名称</th>
-                                        <th>手机号</th>
-                                        <th>性别</th>
+                                        <th>楼ID</th>
+                                        <th>名称</th>
+                                        <th>编号</th>
                                         <th>创建时间</th>
                                         <th>操作</th>
                                     </tr>
                                     </thead>
                                     <tbody>
                                     <tr v-for="floor in searchFloorInfo.floors">
-                                        <td>{{floor.userId}}</td>
+                                        <td>{{floor.floorId}}</td>
                                         <td>{{floor.name}}</td>
-                                        <td>{{floor.tel}}</td>
-                                        <td>{{floor.sex == 0 ? '男' : (staff.sex == 1 ?'女':'')}}</td>
+                                        <td>{{floor.floorNum}}</td>
                                         <td>{{vc.dateFormat(floor.createTime)}}</td>
                                         <td>
                                             <button class="btn btn-primary btn-xs" v-on:click="chooseFloor(floor)">选择</button>

+ 5 - 4
WebService/src/main/resources/components/search-floor/searchFloor.js

@@ -18,12 +18,13 @@
             });
         },
         methods:{
-            _loadAllFloorInfo:function(_page,_rows,_staffName){
+            _loadAllFloorInfo:function(_page,_rows,_floorNum){
                 var param = {
                     params:{
                         page:_page,
                         rows:_rows,
-                        staffName:_staffName
+                        communityId:vc.getCurrentCommunity().communityId,
+                        floorNum:_floorNum
                     }
                 };
 
@@ -39,7 +40,7 @@
                              }
                            );
             },
-            chooseStaff:function(_floor){
+            chooseFloor:function(_floor){
                 vc.emit('floorInfo','chooseFloor',_floor);
                 vc.emit('unit','_loadUnits',{
                     floorId:_floor.floorId
@@ -50,7 +51,7 @@
                 vc.component._loadAllFloorInfo(1,10,vc.component.searchFloorInfo._currentFloorNum);
             },
             _refreshSearchFloorData:function(){
-                vc.component.searchFloorInfo._currentFloorName = "";
+                vc.component.searchFloorInfo._currentFloorNum = "";
             }
         }
 

+ 5 - 24
WebService/src/main/resources/components/unit-select-floor/unitSelectFloor.html

@@ -16,42 +16,23 @@
                 <div class="row">
                     <div class="col-sm-3">
                         <div class="form-group">
-                            <label class="col-form-label" >员工ID:</label>
+                            <label class="col-form-label" >小区楼ID:</label>
                             <label class="">{{floorInfo.floorId}}</label>
                         </div>
                     </div>
                     <div class="col-sm-3">
                         <div class="form-group">
-                            <label class="col-form-label">员工名称:</label>
+                            <label class="col-form-label">名称:</label>
                             <label class="">{{floorInfo.name}}</label>
                         </div>
                     </div>
                     <div class="col-sm-3">
                         <div class="form-group">
-                            <label class="col-form-label" >手机号:</label>
-                            <label class="">{{floorInfo.tel}}</label>
-                        </div>
-                    </div>
-                    <div class="col-sm-3">
-                        <div class="form-group">
-                            <label class="col-form-label" >邮箱:</label>
-                            <label class="">{{floorInfo.email}}</label>
-                        </div>
-                    </div>
-                </div>
-                <div class="row">
-                    <div class="col-sm-3">
-                        <div class="form-group">
-                            <label class="col-form-label" >性别:</label>
-                            <label class="">{{floorInfo.sex == 0 ? '男' : (floorInfo.sex == 1 ?'女':'')}}</label>
-                        </div>
-                    </div>
-                    <div class="col-sm-9">
-                        <div class="form-group">
-                            <label class="col-form-label">地址:</label>
-                            <label class="">{{floorInfo.address}}</label>
+                            <label class="col-form-label" >编号:</label>
+                            <label class="">{{floorInfo.floorNum}}</label>
                         </div>
                     </div>
+
                 </div>
             </div>
         </div>

+ 1 - 4
WebService/src/main/resources/components/unit-select-floor/unitSelectFloor.js

@@ -8,10 +8,7 @@
             floorInfo:{
                 floorId:"",
                 name:"",
-                tel:"",
-                email:"",
-                sex:"",
-                address:"",
+                floorNum:""
             }
         },
         _initMethod:function(){

+ 2 - 2
WebService/src/main/resources/views/unitFlow.html

@@ -5,7 +5,7 @@
       xmlns:vc="http://www.thymeleaf.org">
 <head>
     <meta charset="UTF-8"/>
-    <title>员工权限|java110</title>
+    <title>小区单元|java110</title>
     <vc:create name="commonTop"></vc:create>
 </head>
 <body>
@@ -20,7 +20,7 @@
         </div>
         <!-- id="component" -->
         <div  class="wrapper wrapper-content animated fadeInRight">
-            <vc:create name="staffPrivilege"></vc:create>
+            <vc:create name="unit"></vc:create>
         </div>
 
 

+ 11 - 1
java110-bean/src/main/java/com/java110/dto/FloorDto.java

@@ -11,7 +11,7 @@ import java.util.Date;
  * @Version 1.0
  * add by wuxw 2019/4/24
  **/
-public class FloorDto implements Serializable {
+public class FloorDto extends PageDto implements Serializable {
 
 
     /**
@@ -19,6 +19,8 @@ public class FloorDto implements Serializable {
      */
     private String floorId;
 
+    private String communityId;
+
     /**
      * 编号
      */
@@ -93,4 +95,12 @@ public class FloorDto implements Serializable {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
 }

+ 70 - 24
java110-config/src/main/resources/mapper/floor/FloorServiceDaoImplMapper.xml

@@ -78,30 +78,34 @@ floor_id,name,status_cd,remark,b_id,user_id,floor_num
 
     <!-- 查询小区楼信息 add by wuxw 2018-07-03 -->
     <select id="getFloorInfo" parameterType="Map" resultType="Map">
-        select  t.floor_id,t.name,t.status_cd,t.remark,t.b_id,t.user_id,t.floor_num 
-from f_floor t 
-where 1 =1 
-<if test="floorId !=null and floorId != ''">
-   and t.floor_id= #{floorId}
-</if> 
-<if test="name !=null and name != ''">
-   and t.name= #{name}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="userId !=null and userId != ''">
-   and t.user_id= #{userId}
-</if> 
-<if test="floorNum !=null and floorNum != ''">
-   and t.floor_num= #{floorNum}
-</if> 
+        select  t.floor_id,t.floor_id floorId,t.name,t.status_cd, t.status_cd statusCd,t.remark,t.b_id,
+        t.b_id bId,t.user_id, t.user_id userId,t.floor_num ,t.floor_num floorNum
+        from f_floor t
+        where 1 =1
+        <if test="floorId !=null and floorId != ''">
+           and t.floor_id= #{floorId}
+        </if>
+        <if test="name !=null and name != ''">
+           and t.name= #{name}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+           and t.status_cd= #{statusCd}
+        </if>
+        <if test="remark !=null and remark != ''">
+           and t.remark= #{remark}
+        </if>
+        <if test="bId !=null and bId != ''">
+           and t.b_id= #{bId}
+        </if>
+        <if test="userId !=null and userId != ''">
+           and t.user_id= #{userId}
+        </if>
+        <if test="floorNum !=null and floorNum != ''">
+           and t.floor_num= #{floorNum}
+        </if>
+        <if test="page != -1">
+            limit page,row
+        </if>
 
     </select>
 
@@ -141,6 +145,27 @@ and t.b_id= #{bId}
         WHERE f.`floor_id` = cm.`member_id`
             AND cm.`member_type_cd` = '390001200004'
             AND cm.`community_id` = #{communityId}
+            <if test="floorId !=null and floorId != ''">
+                and f.floor_id= #{floorId}
+            </if>
+            <if test="name !=null and name != ''">
+                and f.name= #{name}
+            </if>
+            <if test="statusCd !=null and statusCd != ''">
+                and f.status_cd= #{statusCd}
+            </if>
+            <if test="remark !=null and remark != ''">
+                and f.remark= #{remark}
+            </if>
+            <if test="bId !=null and bId != ''">
+                and f.b_id= #{bId}
+            </if>
+            <if test="userId !=null and userId != ''">
+                and f.user_id= #{userId}
+            </if>
+            <if test="floorNum !=null and floorNum != ''">
+                and f.floor_num= #{floorNum}
+            </if>
             AND f.`status_cd` = '0'
             AND cm.`status_cd` = '0'
     </select>
@@ -160,6 +185,27 @@ and t.b_id= #{bId}
         WHERE f.`floor_id` = cm.`member_id`
             AND cm.`member_type_cd` = '390001200004'
             AND cm.`community_id` = #{communityId}
+            <if test="floorId !=null and floorId != ''">
+                and f.floor_id= #{floorId}
+            </if>
+            <if test="name !=null and name != ''">
+                and f.name= #{name}
+            </if>
+            <if test="statusCd !=null and statusCd != ''">
+                and f.status_cd= #{statusCd}
+            </if>
+            <if test="remark !=null and remark != ''">
+                and f.remark= #{remark}
+            </if>
+            <if test="bId !=null and bId != ''">
+                and f.b_id= #{bId}
+            </if>
+            <if test="userId !=null and userId != ''">
+                and f.user_id= #{userId}
+            </if>
+            <if test="floorNum !=null and floorNum != ''">
+                and f.floor_num= #{floorNum}
+            </if>
             AND f.`status_cd` = '0'
             AND cm.`status_cd` = '0'
             LIMIT #{page}, #{row}

+ 21 - 0
java110-core/src/main/java/com/java110/core/smo/floor/IFloorInnerServiceSMO.java

@@ -2,7 +2,9 @@ package com.java110.core.smo.floor;
 
 import com.java110.core.feign.FeignConfiguration;
 import com.java110.dto.FloorDto;
+import com.java110.dto.UnitDto;
 import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -42,4 +44,23 @@ public interface IFloorInnerServiceSMO {
      */
     @RequestMapping(value = "/queryFloorsCount", method = RequestMethod.GET)
     int queryFloorsCount(@RequestParam("communityId") String communityId);
+
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param floorDto 数据对象分享
+     * @return UnitDto 对象数据
+     */
+    @RequestMapping(value = "/queryFloors", method = RequestMethod.POST)
+    List<FloorDto> queryFloors(@RequestBody FloorDto floorDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param floorDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryFloorsCount", method = RequestMethod.POST)
+    int queryFloorsCount(@RequestBody FloorDto floorDto);
 }