Sfoglia il codice sorgente

Merge branch 'liusw-log-v1.0.11.10' into dev-mysql

liusw 8 anni fa
parent
commit
0bfa2a228f

+ 9 - 5
src/main/java/com/uas/platform/b2c/common/account/controller/UsageLogController.java

@@ -1,17 +1,19 @@
 package com.uas.platform.b2c.common.account.controller;
 
 import com.uas.platform.b2c.common.account.model.UsageLog;
-import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.service.UsageLogService;
-import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
+import com.wordnik.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Sort;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
 
 /**
@@ -33,8 +35,11 @@ public class UsageLogController {
 	 * @return
 	 */
 	@RequestMapping(method = RequestMethod.GET)
-	public Page<UsageLog> getAllByPage(PageParams params) {
+	public Page<UsageLog> getAllByPage(PageParams params,@ApiParam(required = true, value = "用户名") String userName) {
 		PageInfo info = new PageInfo(params);
+		if (userName!=null && !userName.equals("")) {
+			info.filter("user.userName", userName);
+		}
 		if(info.getSort() == null)
 			info.sorting("time", Sort.Direction.DESC);
 		return usageLogService.findAllByPageInfo(info);
@@ -52,5 +57,4 @@ public class UsageLogController {
 			info.sorting("time", Sort.Direction.DESC);
 		return usageLogService.findAllByPageInfo(info);
 	}
-
 }

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

@@ -164,6 +164,8 @@
 					class="fa fa-flag"></i><span> 批量修改器件类目</span></a></li>
 			<li class="nav-node"><a href="#/kindAdvice"><i
 					class="fa fa-flag"></i><span> 用户类目维护建议</span></a></li>
+			<li class="nav-node"><a href="#/logUsage"><i
+					class="fa fa-flag"></i><span>用户操作日志</span></a></li>
 
 			<li class="nav-header">禁用信息</li>
 			<li class="nav-node"><a href="#/disable/brand"><i

+ 10 - 3
src/main/webapp/resources/js/admin/app.js

@@ -1,4 +1,4 @@
- define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage'], function(angularAMD) {
+ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage','common/query/logUsage'], function(angularAMD) {
 	'use strict';
 
 	 /**
@@ -8,7 +8,7 @@
 		 return this.length > 0 ? this[this.length - 1] : null;
 	 };
 
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery' ,'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery' ,'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices','logUsageServices']);
 	app.init = function() {
 		angularAMD.bootstrap(app);
 	};
@@ -591,7 +591,14 @@
 			controller: 'SlideImageCtrl',
 			controllerUrl: 'app/controllers/operation/SlideImageCtrl',
 			title: '轮播图片管理'
-		})).state('logisticsCompany', angularAMD.route({
+		})).state('logUsage', angularAMD.route({
+      //用户操作日志
+      url: '/logUsage',
+      templateUrl: 'static/view/admin/logUsage.html',
+      controller: 'LogUsageCtrl',
+      controllerUrl: 'app/controllers/LogUsageCtrl',
+      title: '用户操作日志'
+    })).state('logisticsCompany', angularAMD.route({
 			// 首页展示(快递公司管理)
 			url: '/logistics/company',
 			templateUrl: 'static/view/admin/logistics/logistics_company.html',

+ 44 - 0
src/main/webapp/resources/js/admin/controllers/LogUsageCtrl.js

@@ -0,0 +1,44 @@
+define(['app/app'], function (app) {
+  'use strict';
+  app.register.controller('LogUsageCtrl', ['$scope', 'ngTableParams', 'logUsage', 'toaster', 'BaseService','$modal', function ($scope, ngTableParams, logUsage, toaster, BaseService,$modal) {
+    //table设置
+    $scope.logUsageTableParams = new ngTableParams({
+      page : 1,
+      count : 20
+    }, {
+      total : 0,
+      getData : function ($defer, params) {
+        $scope.paginationParams = params;
+        const param = BaseService.parseParams(params.url());
+        //param.status = $scope.status;
+        if($scope.search !=null){
+          if($scope.search == 1){
+            param.userUu = $scope.searchContent;
+          }
+          if($scope.search == 2){
+            param.userName = $scope.searchContent;
+          }
+        }
+        logUsage.getAllByPage(param, function (data) {
+          params.total(data.totalElements);
+          $defer.resolve(data.content);
+        }, function (response) {
+          toaster.pop('error', '获取用户操作日志失败');
+        });
+      }
+    });
+
+    //搜索
+    $scope.onSearch = function(){
+      if(!$scope.search){
+        toaster.pop('error', '请选择搜索条件');
+        return;
+      }
+      if($scope.searchContent==null){
+        toaster.pop('error', '请输入搜索内容');
+        return;
+      }
+      $scope.logUsageTableParams.reload();
+    }
+  }]);
+});

+ 11 - 0
src/main/webapp/resources/js/common/query/logUsage.js

@@ -0,0 +1,11 @@
+define([ 'ngResource' ], function() {
+	angular.module('logUsageServices', [ 'ngResource' ]).factory('logUsage', ['$resource', 'BaseService', function($resource, BaseService) {
+		const rootPath = BaseService.getRootPath();
+		return $resource('log/usage', {}, {
+      getAllByPage:{
+      	url:'log/usage/:userUu',
+				method:'GET'
+			}
+		});
+}])
+});

+ 69 - 0
src/main/webapp/resources/view/admin/logUsage.html

@@ -0,0 +1,69 @@
+<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">{{paginationParams.total()}}</span>条
+				</p>
+			</div>
+			<div class="col-xs-offset-4 col-xs-7">
+				<div class="input-group">
+					<select ng-model="search" style="width:20%;" class="form-control">
+						<option value="">请选择查询条件</option>
+						<option value="1">UU号</option>
+						<option value="2">用户名</option>
+					</select>
+				<input type="search" style="width:80%;" class="form-control" ng-model="searchContent"
+					ng-search="onSearch()" placeholder="请输入搜索内容">
+				<span class="input-group-btn">
+					<button ng-click="onSearch()" class="btn btn-primary" type="button">搜索</button>
+				</span>
+			</div>
+			</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>