Explorar o código

侦听加入缓存逻辑判断

wuxw %!s(int64=7) %!d(string=hai) anos
pai
achega
144648aa5e

+ 29 - 15
WebService/src/main/resources/components/room/room.html

@@ -7,42 +7,54 @@
             <div class="ibox">
                 <div class="ibox-content">
 
-                    <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
+                    <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="10">
                         <thead>
                         <tr>
                             <th>房屋ID</th>
-                            <th data-hide="phone">名称</th>
-                            <th data-hide="phone">联系方式</th>
-                            <th data-hide="phone">地址</th>
-                            <th data-hide="phone">地标</th>
-                            <th data-hide="phone,tablet" >城市编码</th>
-                            <th data-hide="phone">状态</th>
+                            <th data-hide="phone">房屋编号</th>
+                            <th data-hide="phone">单元</th>
+                            <th data-hide="phone">楼层</th>
+                            <th data-hide="phone">房间数</th>
+                            <th data-hide="phone" >户型</th>
+                            <th data-hide="phone">建筑面积</th>
+                            <th data-hide="phone">单价</th>
+                            <th data-hide="phone">创建员工</th>
+                            <th data-hide="phone">备注</th>
                             <th class="text-right">操作</th>
 
                         </tr>
                         </thead>
                         <tbody>
-                        <tr v-for="room in roomInfo.roomDataInfo">
+                        <tr v-for="room in roomInfo.rooms">
                             <td>
-                                {{room.communityId}}
+                                {{room.roomId}}
                             </td>
                             <td>
-                                {{room.name}}
+                                {{room.roomNum}}
                             </td>
                             <td>
-                                {{room.tel}}
+                                {{room.unitName}}
                             </td>
                             <td>
-                                {{room.address}}
+                                {{room.layer}}
                             </td>
                             <td>
-                                {{room.nearbyLandmarks}}
+                                {{room.section}}
                             </td>
                             <td>
-                                {{room.cityCode}}
+                                {{room.apartment}}
                             </td>
                             <td>
-                                {{room.statusCd}}
+                                {{room.builtUpArea}}
+                            </td>
+                            <td>
+                                {{room.unitPrice}}
+                            </td>
+                            <td>
+                                {{room.userName}}
+                            </td>
+                            <td>
+                                {{room.remark}}
                             </td>
                             <td class="text-right">
                                 <div class="btn-group">
@@ -59,6 +71,8 @@
                         </tr>
                         </tfoot>
                     </table>
+                    <!-- 分页 -->
+                    <vc:create name="pagination"></vc:create>
 
                 </div>
             </div>

+ 27 - 10
WebService/src/main/resources/components/room/room.js

@@ -2,10 +2,15 @@
     入驻小区
 **/
 (function(vc){
+    var DEFAULT_PAGE = 1;
+    var DEFAULT_ROWS = 10;
     vc.extends({
         data:{
             roomInfo:{
-                roomDataInfo:[],
+                rooms:[],
+                total:0,
+                records:1,
+                floorId:'',
             }
         },
         _initMethod:function(){
@@ -16,31 +21,43 @@
                   vc.component.listRoom();
             });
             vc.on('room','loadData',function(_param){
-                vc.component.listRoom(_param);
+                vc.component.roomInfo.floorId = _param.floorId;
+                vc.component.listRoom(DEFAULT_PAGE,DEFAULT_ROWS);
+            });
+            vc.on('pagination','page_event',function(_currentPage){
+                vc.component.listRoom(_currentPage,DEFAULT_ROWS);
             });
         },
         methods:{
-            listRoom:function(){
+            listRoom:function(_page,_rows){
                 var param = {
                     params:{
-                        msg:this.message
+                        page:_page,
+                        rows:_rows,
+                        communityId:vc.getCurrentCommunity().communityId,
+                        floorId:vc.component.roomInfo.floorId
                     }
-
-               }
+                }
                //发送get请求
                vc.http.get('room',
                             'listRoom',
                              param,
                              function(json,res){
-                                vc.component.roomInfo.roomDataInfo=JSON.parse(json);
+                                var listRoomData =JSON.parse(json);
+
+                                vc.component.roomInfo.total = listRoomData.total;
+                                vc.component.roomInfo.records = listRoomData.records;
+                                vc.component.roomInfo.rooms = listRoomData.rooms;
+
+                                vc.emit('pagination','init',{
+                                    total:vc.component.roomInfo.records,
+                                    currentPage:_page
+                                });
                              },function(errInfo,error){
                                 console.log('请求失败处理');
                              }
                            );
             },
-            _openAddRoomModal:function(){
-                //vc.emit('storeEnterCommunity','openStoreEnterCommunity',{});
-            },
             _openDelRoomModel:function(_community){
                 //vc.emit('storeExitCommunity','openStoreExitCommunityModal',_community);
             }

+ 7 - 4
java110-event/src/main/java/com/java110/event/service/api/ServiceDataFlowEventPublishing.java

@@ -31,17 +31,17 @@ public class ServiceDataFlowEventPublishing extends LoggerEngine {
     private static Executor taskExecutor;
 
     //默认 线程数 100
-    private final static int DEFAULT_THREAD_NUM = 100;
+    private static final int DEFAULT_THREAD_NUM = 100;
 
     /**
      * 保存侦听实例信息,一般启动时加载
      */
-    private final static List<String> listeners = new ArrayList<String>();
+    private static final List<String> listeners = new ArrayList<String>();
 
     /**
      * 根据 事件类型查询侦听
      */
-    private final static Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>();
+    private static final Map<String, List<ServiceDataFlowListener>> cacheListenersMap = new HashMap<String, List<ServiceDataFlowListener>>();
 
     /**
      * 添加 侦听,这个只有启动时,单线程 处理,所以是线程安全的
@@ -95,8 +95,11 @@ public class ServiceDataFlowEventPublishing extends LoggerEngine {
         //这里排序
         DataFlowListenerOrderComparator.sort(dataFlowListeners);
 
+
         //将数据放入缓存中
-        cacheListenersMap.put(needCachedServiceCode, dataFlowListeners);
+        if (dataFlowListeners.size() > 0) {
+            cacheListenersMap.put(needCachedServiceCode, dataFlowListeners);
+        }
         return dataFlowListeners;
     }