Browse Source

Merge remote-tracking branch 'origin/feature-201847-wangcz' into feature-201847-wangcz

yuj 7 years ago
parent
commit
05d287cb43

+ 27 - 6
src/main/java/com/uas/platform/b2c/common/account/model/User.java

@@ -2,9 +2,6 @@ package com.uas.platform.b2c.common.account.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import com.uas.platform.core.model.Constant;
-
-import java.util.*;
-
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;
@@ -12,9 +9,23 @@ import org.hibernate.annotations.NotFound;
 import org.hibernate.annotations.NotFoundAction;
 import org.springframework.util.CollectionUtils;
 
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.io.*;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * 用户信息
@@ -27,6 +38,16 @@ import java.io.Serializable;
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2c.common.account.model.User")
 public class User implements Serializable {
 
+	/**
+	 * 姓名长度限制
+	 */
+	public static final Integer MAX_NAME_LENGTH = 20;
+
+	/**
+	 * 邮箱长度限制
+	 */
+	public static final Integer MAX_EMAIL_LENGTH = 50;
+
 	/**
 	 * 
 	 */

+ 15 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -409,6 +409,7 @@ public class UserServiceImpl implements UserService {
 
 	@Override
 	public User addUser(User user, HttpServletRequest request) {
+        enableUserInfo(user);
 		List<User> users = userDao.findUserByUserTel(user.getUserTel().trim());
 		if (users.size() > 0) {
 			throw new IllegalOperatorException("电话号码重复,建议输入您自己的手机号");
@@ -452,6 +453,20 @@ public class UserServiceImpl implements UserService {
 		return user;
 	}
 
+	/**
+	 * 校验填写的用户信息
+	 *
+	 * @param user 前端传入的用户信息
+	 */
+	private void enableUserInfo(User user) {
+		if (user.getUserName().length() > User.MAX_NAME_LENGTH) {
+			throw new IllegalOperatorException("用户姓名请不要超过20个字符");
+		}
+		if (user.getUserEmail().length() > User.MAX_EMAIL_LENGTH) {
+			throw new IllegalOperatorException("用户邮箱请不要超过50个字符");
+		}
+	}
+
 	public void postToAccountCenter(final User user, final Enterprise enterprise) throws Exception {
 		// 同步账户中心
 		try {

+ 16 - 4
src/main/webapp/resources/js/usercenter/controllers/b2b/fa/arCheck.js

@@ -358,9 +358,9 @@
                               $defer.resolve(page.content);
                           }
                           $scope.infoCommon = page
-                          $scope.infoCommon.all = page.content.length
+                          $scope.infoCommon.all = page.content && page.content.length || 0
                           $scope.ALLList = page.content || []
-                          $scope.totalCount = page.totalElement;
+                          $scope.totalCount = page.totalElement || 0;
                       }, function (response) {
                           $scope.loading = false;
                           toaster.pop('error', '数据加载失败', response.data);
@@ -534,8 +534,20 @@
           // 默认本月
           $scope.sdateTo = new Date();
           $scope.sdateFrom = new Date($scope.sdateTo.getFullYear(), $scope.sdateTo.getMonth(), 1);
-          $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
-          $scope.thisMouthOut = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
+          if ($scope.sdateTo.getMonth() === 0) {
+              var _time  = new Date($scope.sdateTo)
+              _time.setMonth(_time.getMonth())
+              _time.setDate(1)
+              // _time.setMonth(_time.getMonth())
+              _time.setDate(_time.getDate() - 1)
+              $scope.thisMouth = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+              $scope.thisMouthOut = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+          } else {
+              $scope.thisMouth = $scope.sdateTo.getFullYear() + '-' + ($scope.sdateTo.getMonth())
+              $scope.thisMouthOut = $scope.sdateTo.getFullYear() + '-' + ($scope.sdateTo.getMonth())
+          }
+          // $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
+          // $scope.thisMouthOut = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
           $scope.condition.uuorname = '';
           // $scope.condition.dateFrom = '';
           // $scope.condition.dateTo = '';

+ 17 - 5
src/main/webapp/resources/js/vendor/controllers/b2b/apCheck.js

@@ -146,9 +146,9 @@ define(['app/app'], function (app) {
                           $defer.resolve(page.content);
                       }
                       $scope.infoCommon = page
-                      $scope.infoCommon.all = page.content.length
-                      $scope.ALLList = page.content
-                      $scope.totalCount = page.totalElement;
+                      $scope.infoCommon.all = page.content && page.content.length || 0
+                      $scope.ALLList = page.content || []
+                      $scope.totalCount = page.totalElement || 0;
                   }, function (response) {
                       $scope.loading = false;
                       toaster.pop('error', '数据加载失败', response.data);
@@ -322,8 +322,20 @@ define(['app/app'], function (app) {
       // 默认本月
       $scope.sdateTo = new Date();
       $scope.sdateFrom = new Date($scope.sdateTo.getFullYear(), $scope.sdateTo.getMonth(), 1);
-      $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
-      $scope.thisMouthOut = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
+      if ($scope.sdateTo.getMonth() === 0) {
+          var _time  = new Date($scope.sdateTo)
+          _time.setMonth(_time.getMonth())
+          _time.setDate(1)
+          // _time.setMonth(_time.getMonth())
+          _time.setDate(_time.getDate() - 1)
+          $scope.thisMouth = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+          $scope.thisMouthOut = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+      } else {
+          $scope.thisMouth = $scope.sdateTo.getFullYear() + '-' + ($scope.sdateTo.getMonth())
+          $scope.thisMouthOut = $scope.sdateTo.getFullYear() + '-' + ($scope.sdateTo.getMonth())
+      }
+      // $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
+      // $scope.thisMouthOut = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
       $scope.condition.uuorname = '';
       // $scope.condition.dateFrom = '';
       // $scope.condition.dateTo = '';

+ 11 - 0
src/test/java/com/uas/platform/b2c/javase/collection/ListTest.java

@@ -1,6 +1,9 @@
 package com.uas.platform.b2c.javase.collection;
 
 import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -56,4 +59,12 @@ public class ListTest {
         System.out.println(format);
 
     }
+
+    @Autowired
+    private RedisTemplate<String, String> redisTemplate;
+
+    @Test
+    public void redisTest() {
+        ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
+    }
 }