Browse Source

后台展示 搜索耗时

wangdy 8 years ago
parent
commit
a9d88851e1

+ 4 - 0
src/main/webapp/WEB-INF/views/normal/adminWithNav.html

@@ -208,6 +208,10 @@
 			<li class="nav-header">推广管理</li>
 			<li class="nav-node"><a href="#ads/brand" ><i
 					class="fa fa-upload"></i><span> 品牌推广</span></a></li>
+
+			<li class="nav-header">搜索预览</li>
+			<li class="nav-node"><a href="#search/see" ><i
+					class="fa fa-upload"></i><span> 搜索预览</span></a></li>
 			<!--<li class="nav-node"><a href="#help/publish" ><i
 					class="fa fa-upload"></i><span> 产品推广</span></a></li>
 			<li class="nav-node"><a href="#help/publish" ><i

+ 7 - 0
src/main/webapp/resources/js/admin/app.js

@@ -721,6 +721,13 @@
             controller: 'adsBrandCtrl',
             controllerUrl: 'app/controllers/ads/ads_brand',
             title: '品牌推广'
+        })).state('searchSee', angularAMD.route({
+            //搜索预览
+            url : '/search/see',
+            templateUrl: 'static/view/admin/search/search_See.html',
+            controller: 'SearchSeeBrandCtrl',
+            controllerUrl: 'app/controllers/search/search_See',
+            title: '搜索预览'
         })).state('internalMessage', angularAMD.route({
 			// 消息列表
 			url: '/internalMessages',

+ 171 - 0
src/main/webapp/resources/js/admin/controllers/search/search_See.js

@@ -0,0 +1,171 @@
+define(['app/app'], function (app) {
+    'use strict';
+    app.register.controller('SearchSeeBrandCtrl', ['$scope', '$http', '$rootScope', 'SessionService', function($scope, $http, $rootScope, SessionService) {
+        $scope.searchType = 'original';// 搜索类型
+        $scope.searchType = {
+            original: false,
+            inaction: false,
+            proffing: false,
+            brand: false,
+            isCmp: function() {
+                var me = this;
+                return me.original || me.inaction || me.proffing;
+            }
+        };
+        if(SessionService.get('brand')) {
+            $scope.searchType.brand = true;
+        }
+
+        var componentSearchType = SessionService.get('component');
+        if(componentSearchType) {
+            $scope.searchType = angular.fromJson(componentSearchType);
+            $scope.searchType.isCmp = function() {
+                var me = this;
+                return me.original || me.inaction || me.proffing;
+            }
+        }
+
+        // 点击搜索库存、样品、呆滞
+        $scope.cmpTypeClick = function() {
+            if($scope.searchType.isCmp()) {
+                $scope.searchType.brand = false;
+            }
+        };
+
+        // 点击搜索品牌
+        $scope.brandTypeClick = function() {
+            if($scope.searchType.brand) {
+                $scope.searchType.original = false;
+                $scope.searchType.inaction = false;
+                $scope.searchType.proffing = false;
+            }
+        };
+
+        // 选搜索类型
+        $scope.setSearchType = function(t) {
+            $scope.searchType = t;
+        };
+
+        // 搜索
+        $scope.search = function() {
+            if($scope.keyword) {
+                if($scope.searchType.brand) {
+                    SessionService.set('brand', true);
+                    SessionService.unset('component');
+                    window.location.href = 'search?w=' + encodeURI(encodeURIComponent($scope.keyword)) + '&type=brand';
+                }else if($scope.searchType.isCmp()){
+                    SessionService.set('component', angular.toJson($scope.searchType));
+                    SessionService.unset('brand');
+                    window.location.href = 'search?w=' + encodeURI(encodeURIComponent($scope.keyword)) + '&type=component';
+                }else {
+                    SessionService.unset('component');
+                    SessionService.unset('brand');
+                    var timestart = (new Date()).valueOf();
+                    $http({
+                        method:'GET',
+                        url:'api/product/component/search/compGoods',
+                        params:{
+                            'keyword' : $scope.keyword
+                     }}).then(function (data) {
+                        $scope.result = data.data;
+                        $scope.result.time = (new Date()).valueOf() - timestart;
+                        console.log(data);
+                    },function (error) {
+                    });
+
+                    $http({
+                        method:'GET',
+                        url:'search/componentGoods/collect',
+                        params:{
+                            'keyword' : $scope.keyword,
+                            'collectList' : 'goods_kind',
+                            'paramJSON':{}
+                        }}).then(function (data) {
+                        $scope.result = data.data;
+                        $scope.kindtime = (new Date()).valueOf() - timestart;
+                        console.log(data);
+                    },function (error) {
+                    });
+
+
+
+                   // window.location.href = 'search?w=' + encodeURI(encodeURIComponent($scope.keyword)) + '&type=all';
+                }
+
+            }
+        };
+
+        // 搜索框获得焦点,显示联想框
+        $scope.onFocus = function() {
+            $scope.associate = true;
+            $scope.selectIndex = -1;
+            if(!$scope.keyword) $scope.keyword = '';
+        };
+
+        // 搜索框失去焦点,关闭联想框
+        $scope.onBlur = function() {
+            $scope.associate = false;
+        };
+
+        // 搜索框通过按键选取想要的联想词
+        $scope.onKeyup = function() {
+            if($scope.associates && $scope.associates.length) {
+                if(event.keyCode == 40) { //监听到按下键
+                    $scope.selectIndex ++;
+                    if($scope.selectIndex >= $scope.associates.length) $scope.selectIndex = 0;
+                    $scope.keyword = $scope.associates[$scope.selectIndex];
+                } else if(event.keyCode == 38) { //监听到按上键
+                    $scope.selectIndex --;
+                    if($scope.selectIndex < 0) $scope.selectIndex = $scope.associates.length - 1;
+                    $scope.keyword = $scope.keyword = $scope.associates[$scope.selectIndex];
+                } else if(event.keyCode == 13) { //确定键
+                    $scope.search();
+                }
+            }
+        };
+
+        // 输入框内容变化,获取新的联想词
+        $scope.onChange = function() {
+            if ($scope.keyword) {
+                var params = {
+                    keyword: $scope.keyword
+                };
+                if($rootScope.userInfo) {
+                    params.userUU = $rootScope.userInfo.userUU;
+                }
+                $http.get('search/similarKeywords', {
+                    params : params
+                }).success(function(data){
+                    $scope.associates = data;// 联想词数组
+                }).error(function(response) {
+
+                });
+            } else {
+                $scope.associates = [];// 联想词数组
+            }
+
+        };
+
+        // 点击联想词
+        $scope.onAssociateClick = function(component) {
+            $scope.keyword = component;
+            $scope.search();
+        };
+
+        // 鼠标进入联想词框,不能关闭联想词框
+        $scope.onAssociateEnter = function() {
+            $scope.associateEnter = true;
+        };
+
+        // 鼠标离开联想词框,可以关闭联想词框
+        $scope.onAssociateLeave = function() {
+            $scope.associateEnter = false;
+        };
+
+        // 热词
+        $scope.hotwords = [{name : 'SCT2080KEC', url :'product#/component/1100400300009990/'},
+            {name : '电池组', url : 'product#/kinds/346'},
+            {name : 'Vishay',url : 'product#/brand/30327265e42a871be050007f01003d96/'},
+            {name : 'Panasonic Battery', url : 'product#/brand/30327265e4e7871be050007f01003d96/'}];
+    }]);
+});

+ 70 - 0
src/main/webapp/resources/view/admin/search/search_See.html

@@ -0,0 +1,70 @@
+<style>
+    .row {
+        margin-bottom: 10px;
+    }
+</style>
+<div>
+    <div class="box-header well">
+        搜索预览
+    </div>
+    <div  class="box-content">
+        <div class="row">
+            <div class="col-xs-1">
+                <p style="margin-top: 8px; font-weight: bold;">
+                    共<span class="totalNum">{{result.total}}</span>条
+                </p>
+                <p style="margin-top: 8px; font-weight: bold;">
+                    共耗时<span class="totalNum">{{result.time}}</span>ms  ,kind共耗时 {{kindtime}} ms
+                </p>
+            </div>
+            <div class="col-xs-offset-4 col-xs-7">
+                <div class="input-group">
+                    <input type="search" style="width:80%;" class="form-control" ng-model="keyword" ng-change="onChange()" ng-search="search()" ng-focus="onFocus()" ng-blur="onBlur()" ng-keyup="onKeyup()"placeholder="型号/类目/品牌">
+                    <span class="input-group-btn">
+					<button ng-click="search()" class="btn btn-primary" type="button">搜索</button>
+				</span>
+                </div>
+                <ul class="association" ng-show="associate || associateEnter"  ng-class="{'none': !associate || !associateEnter}" ng-mouseenter="onAssociateEnter()" ng-mouseleave="onAssociateLeave()">
+                    <li ng-repeat="as in associates" ng-bind="as" ng-class="{'active': $index==selectIndex}"
+                        ng-click="onAssociateClick(as)"></li>
+                </ul>
+            </div>
+        </div>
+        <!--
+            <div class="row">
+                <div class="col-xs-offset-9 col-xs-4">
+                    <a class="btn btn-primary" ng-click="addKeyWord()"><i class="fa fa-plus"></i>添加关键词</a>
+                    <a class="btn btn-primary" ng-click="addKeyWords()"><i class="fa fa-plus"></i>批量添加关键词</a>
+                </div>
+            </div>
+            -->
+        <p ng-model="test"></p>
+        <table ng-table="logUsageTableParams"
+               class="table table-bordered table-striped table-hover" style="word-break:break-all; word-wrap:break-all;">
+            <thead>
+            <tr class="tr-default">
+                <th width="10%;" class="text-center">用户UU号</th>
+                <th width="7%;" class="text-center">用户名</th>
+                <th width="10%" class="text-center">标题</th>
+                <th width="30%" class="text-center">具体操作信息</th>
+                <th width="8%%" class="text-center">时间</th>
+                <th width="10%" class="text-center">ip</th>
+                <th width="10%" class="text-center">手机号</th>
+                <th width="15%" class="text-center">邮箱</th>
+            </tr>
+            </thead>
+            <tbody ng-repeat="logUsage in $data">
+            <tr class="text-center">
+                <td><span ng-bind="logUsage.userUU"></span></td>
+                <td><span ng-bind="logUsage.user.userName"></span></td>
+                <td><span ng-bind="logUsage.title"></span></td>
+                <td><span ng-bind="logUsage.message+logUsage.detail"></span></td>
+                <td><span ng-bind="logUsage.time | date:'yyyy-MM-dd HH:mm:ss'"></span></td>
+                <td><span ng-bind="logUsage.ip"></span></td>
+                <td><span ng-bind="logUsage.user.userTel"></span></td>
+                <td><span ng-bind="logUsage.user.userEmail"></span></td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+</div>

+ 11 - 0
src/test/java/com/uas/platform/b2c/DesTest.java

@@ -29,6 +29,17 @@ public class DesTest {
             b = des.encrypt("Select123!#%*(", "10101010");
             System.out.println(des.toHexString(b));
 
+            //旧版正式
+            b = des.encrypt("root", "10101010");
+            System.out.println(des.toHexString(b));
+
+            b = des.encrypt("jdbc:mysql://10.10.100.18:3306/mall_prod?characterEncoding=UTF-8", "10101010");
+            System.out.println(des.toHexString(b));
+            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
+
+            b = des.encrypt("select", "10101010");
+            System.out.println(des.toHexString(b));
+
 
 
         }catch (Exception e){