Просмотр исходного кода

处理用户操作日志问题

liusw 8 лет назад
Родитель
Сommit
59812bf7c6

+ 8 - 2
src/main/java/com/uas/platform/b2c/common/account/controller/UsageLogController.java

@@ -35,11 +35,17 @@ public class UsageLogController {
 	 * @return
 	 */
 	@RequestMapping(method = RequestMethod.GET)
-	public Page<UsageLog> getAllByPage(PageParams params,@ApiParam(required = true, value = "用户名") String userName) {
+	public Page<UsageLog> getAllByPage(PageParams params,@ApiParam(required = true, value = "用户名") String userName, String userTel, String email) {
 		PageInfo info = new PageInfo(params);
-		if (userName!=null && !userName.equals("")) {
+		if (userName != null && !userName.equals("")) {
 			info.filter("user.userName", userName);
 		}
+		if (userTel != null && !userTel.equals("")) {
+			info.filter("user.userTel", userTel);
+		}
+		if (email != null && !email.equals("")) {
+			info.filter("user.userEmail", email);
+		}
 		if(info.getSort() == null)
 			info.sorting("time", Sort.Direction.DESC);
 		return usageLogService.findAllByPageInfo(info);

+ 2 - 2
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -216,7 +216,7 @@ public class UserController {
 				session.setAttribute("checkTime", System.currentTimeMillis());
 				session.setAttribute("newUserEmail",newUserEmail);
 				assert logger != null;
-				logger.log("用户信息", "发送用户邮箱地址,UU:" + user.getUserUU());
+				logger.log("用户信息", "修改用户邮箱,邮箱地址为:" + newUserEmail + ", 验证码为:" + checkCode);
 				return new ResponseEntity<>(HttpStatus.OK);
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -360,7 +360,7 @@ public class UserController {
 				session.setAttribute("telCheckTime", System.currentTimeMillis());
 				session.setAttribute("newUserTel", newUserTel);
 				assert logger != null;
-				logger.log("用户信息", "发送手机验证码,UU:" + user.getUserUU());
+				logger.log("用户信息", "修改用户手机号,手机号为:" + newUserTel + ", 验证码为:"+ checkCode);
 				return new ResponseEntity<>(HttpStatus.OK);
 			} catch (Exception e) {
 				e.printStackTrace();

+ 12 - 3
src/main/java/com/uas/platform/b2c/common/account/model/UsageLog.java

@@ -194,14 +194,20 @@ public class UsageLog extends BufferedLogable implements Serializable {
 	}
 
 	public String getUserTel() {
-		if(user != null && user.getUserTel()!=null){
+		if (user == null) {
+			return null;
+		}
+		if(user.getUserTel()!=null){
 			return user.getUserTel().substring(0,user.getUserTel().length()-(user.getUserTel().substring(3)).length())+"****"+user.getUserTel().substring(7);
 		}
 		return user.getUserTel();
 	}
 
 	public String getUserEmail() {
-		if(user != null && user.getUserEmail()!=null){
+		if (user == null) {
+			return null;
+		}
+		if(user.getUserEmail()!=null){
 			String email = user.getUserEmail();
 			int index = org.apache.commons.lang.StringUtils.indexOf(user.getUserEmail(), "@");
 			if (index <= 1)
@@ -213,7 +219,10 @@ public class UsageLog extends BufferedLogable implements Serializable {
 	}
 
 	public String getUserName() {
-		if(user.getUserName() != null && user.getUserName() != null){
+		if (user == null) {
+			return null;
+		}
+		if(user.getUserName() != null){
 			return user.getUserName().substring(0,1)+"**";
 		}
 		return user.getUserName();

+ 7 - 1
src/main/java/com/uas/platform/b2c/trade/seek/controller/SeekQualityBuyerController.java

@@ -1,5 +1,7 @@
 package com.uas.platform.b2c.trade.seek.controller;
 
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.b2c.trade.seek.model.SeekPurchase;
 import com.uas.platform.b2c.trade.seek.model.SeekQualityBuyer;
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -44,7 +47,10 @@ public class SeekQualityBuyerController {
      */
     @RequestMapping(value = "/getBuyerPageInfo", method = RequestMethod.GET)
     public Page<SeekQualityBuyer> getBuyerPageInfo(PageParams params) {
-        logger.log("求购", "分页获取优质采购商列表,参数为" + params);
+        User user = SystemSession.getUser();
+        if (!StringUtils.isEmpty(user)) {
+            logger.log("求购", "分页获取优质采购商列表");
+        }
         PageInfo info = new PageInfo(params);
         return seekQualityBuyerService.getBuyerPageInfo(info);
     }

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

@@ -18,6 +18,12 @@ define(['app/app'], function (app) {
           if($scope.search == 2){
             param.userName = $scope.searchContent;
           }
+          if($scope.search == 3){
+              param.userTel = $scope.searchContent;
+          }
+          if($scope.search == 4){
+              param.email = $scope.searchContent;
+          }
         }
         logUsage.getAllByPage(param, function (data) {
           params.total(data.totalElements);

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

@@ -20,6 +20,8 @@
 						<option value="">请选择查询条件</option>
 						<option value="1">UU号</option>
 						<option value="2">用户名</option>
+						<option value="3">手机号</option>
+						<option value="4">邮箱</option>
 					</select>
 				<input type="search" style="width:80%;" class="form-control" ng-model="searchContent"
 					ng-search="onSearch()" placeholder="请输入搜索内容">