Kaynağa Gözat

Merge remote-tracking branch 'origin/release-201818-wangcz' into release-201818-wangcz

yujia 7 yıl önce
ebeveyn
işleme
44494d62e9

+ 14 - 3
pom.xml

@@ -217,6 +217,14 @@
 			<groupId>org.hibernate</groupId>
 			<artifactId>hibernate-ehcache</artifactId>
 		</dependency>
+
+
+		<dependency>
+			<groupId>com.github.debop</groupId>
+			<artifactId>hibernate-redis</artifactId>
+			<version>2.3.1</version>
+		</dependency>
+
 		<!-- jdbc -->
 		<dependency>
 			<groupId>com.oracle</groupId>
@@ -273,14 +281,17 @@
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-core</artifactId>
+			<version>2.9.6</version>
 		</dependency>
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-databind</artifactId>
+			<version>2.9.6</version>
 		</dependency>
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-annotations</artifactId>
+			<version>2.9.6</version>
 		</dependency>
 		<dependency>
 			<groupId>com.alibaba</groupId>
@@ -532,8 +543,8 @@
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
 				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
+					<source>1.8</source>
+					<target>1.8</target>
 				</configuration>
 			</plugin>
 			<plugin>
@@ -652,7 +663,7 @@
 				<version>2.2</version>
 				<configuration>
 					<port>8080</port>
-					<path>/platform-b2c</path>
+					<path>/</path>
 					<uriEncoding>utf-8</uriEncoding>
 				</configuration>
 			</plugin>

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

@@ -6,9 +6,7 @@ import com.uas.platform.b2c.common.account.model.*;
 import com.uas.platform.b2c.common.account.service.UserService;
 import com.uas.platform.b2c.core.config.MessageConf;
 import com.uas.platform.b2c.core.support.SystemSession;
-import com.uas.platform.b2c.core.utils.ThreadUtils;
 import com.uas.platform.b2c.trade.util.BoundedExecutor;
-import com.uas.platform.core.concurrent.IRunnable;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.model.PageInfo;
@@ -16,6 +14,7 @@ import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.util.AgentUtils;
 import com.uas.platform.core.util.encry.Md5Utils;
 import com.uas.sso.entity.UserView;
+import com.uas.sso.util.AccountUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
@@ -24,7 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
-import com.uas.sso.util.AccountUtils;
+
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
@@ -77,6 +76,13 @@ public class UserServiceImpl implements UserService {
 	@Autowired
 	private UserLoginTimeDao userLoginTimeDao;
 
+	private BoundedExecutor executor;
+
+	{
+		ExecutorService executorService = Executors.newCachedThreadPool();
+		executor = new BoundedExecutor(executorService, 1000);
+	}
+
 	@Override
 	public User findUserByUserUU(Long uu) {
 		List<User> users = userDao.findUserByUserUU(uu);
@@ -201,10 +207,17 @@ public class UserServiceImpl implements UserService {
 			enterpriseDao.callInitProcedure(SystemSession.getUser().getEnterprise().getUu());
 		}
 		userDao.save(user);
+		Enterprise enterprise = SystemSession.getUser().getEnterprise();
+
+		//判断是否个人用户
+		if(enterprise == null){
+			throw new RuntimeException("个人账户不能新增企业用户");
+		}
+		// 同步账户中心
 		try {
-			postToAccountCenter(user);
+			postToAccountCenter(user, enterprise);
 		} catch (Exception e) {
-			throw new SystemException(e.getMessage());
+			e.printStackTrace();
 		}
 	}
 	@Override
@@ -278,8 +291,16 @@ public class UserServiceImpl implements UserService {
 			userOld.setUserEmail(user.getUserEmail());
 			userOld.setUserTel(user.getUserTel());
 			userOld.setUserName(user.getUserName());
+
+			Enterprise enterprise = SystemSession.getUser().getEnterprise();
+
+			//判断是否个人用户
+			if(enterprise == null){
+				throw new RuntimeException("个人账户不能新增企业用户");
+			}
+
 			try {
-				postToAccountCenter(userOld);
+				postToAccountCenter(userOld, enterprise);
 			} catch (Exception e) {
 //				throw new RuntimeException(e.getMessage());
 			}
@@ -415,12 +436,21 @@ public class UserServiceImpl implements UserService {
 		return user;
 	}
 
-	public void postToAccountCenter(User user) throws Exception {
-		//判断是否个人用户
-		if(SystemSession.getUser().getEnterprise()==null){
-			throw new RuntimeException("个人账户不能新增企业用户");
-		}else{
-			AccountUtils.addUser(user.getUserUU(),SystemSession.getUser().getEnterprise().getUu());
+	public void postToAccountCenter(final User user, final Enterprise enterprise) throws Exception {
+		// 同步账户中心
+		try {
+			executor.submitTask(new Runnable() {
+				@Override
+				public void run() {
+					try {
+						AccountUtils.addUser(user.getUserUU(),enterprise.getUu());
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+				}
+			});
+		} catch (Exception e) {
+			throw new SystemException(e.getMessage());
 		}
 	}
 	@Override
@@ -432,9 +462,6 @@ public class UserServiceImpl implements UserService {
 			userDao.flush();
 			final Long enUU = SystemSession.getUser().getEnterprise().getUu();
 			// 同步账户中心
-			ExecutorService executorService = Executors.newCachedThreadPool();
-			BoundedExecutor executor = new BoundedExecutor(executorService, 1000);
-
 			try {
 				executor.submitTask(new Runnable() {
 					@Override

+ 2 - 0
src/main/java/com/uas/platform/b2c/core/utils/ThreadUtils.java

@@ -58,6 +58,8 @@ public class ThreadUtils {
 		}
 
 		public void run() {
+			// shutdown()后,不能再提交新的任务进去;但是awaitTermination()后,可以继续提交。
+			// awaitTermination()是阻塞的,返回结果是线程池是否已停止(true/false);shutdown()不阻塞。
 			threadPool.shutdown();
 			try {
 				threadPool.awaitTermination(timeout, TimeUnit.SECONDS);

+ 27 - 0
src/main/resources/dev/redisson.yaml

@@ -0,0 +1,27 @@
+# redisson configuration for redis servers
+# see : https://github.com/mrniko/redisson/wiki/2.-Configuration
+
+singleServerConfig:
+  idleConnectionTimeout: 10000
+  pingTimeout: 1000
+  connectTimeout: 1000
+  timeout: 1000
+  retryAttempts: 3
+  retryInterval: 1000
+  reconnectionTimeout: 3000
+  failedAttempts: 3
+  password: null
+  subscriptionsPerConnection: 5
+  clientName: null
+  address: ["redis://192.168.253.6:6379"]
+  subscriptionConnectionMinimumIdleSize: 1
+  subscriptionConnectionPoolSize: 25
+  connectionMinimumIdleSize: 5
+  connectionPoolSize: 100
+  database: 0
+  dnsMonitoring: false
+  dnsMonitoringInterval: 5000
+threads: 0
+codec: !<org.redisson.codec.SnappyCodec> {}
+useLinuxNativeEpoll: false
+eventLoopGroup: null

+ 27 - 0
src/main/resources/prod/redisson.yaml

@@ -0,0 +1,27 @@
+# redisson configuration for redis servers
+# see : https://github.com/mrniko/redisson/wiki/2.-Configuration
+
+singleServerConfig:
+  idleConnectionTimeout: 10000
+  pingTimeout: 1000
+  connectTimeout: 1000
+  timeout: 1000
+  retryAttempts: 3
+  retryInterval: 1000
+  reconnectionTimeout: 3000
+  failedAttempts: 3
+  password: null
+  subscriptionsPerConnection: 5
+  clientName: null
+  address: ["redis://10.10.0.200:6379"]
+  subscriptionConnectionMinimumIdleSize: 1
+  subscriptionConnectionPoolSize: 25
+  connectionMinimumIdleSize: 5
+  connectionPoolSize: 100
+  database: 0
+  dnsMonitoring: false
+  dnsMonitoringInterval: 5000
+threads: 0
+codec: !<org.redisson.codec.SnappyCodec> {}
+useLinuxNativeEpoll: false
+eventLoopGroup: null

+ 3 - 2
src/main/resources/spring/context.xml

@@ -128,9 +128,10 @@
 		</property>
 		<property name="jpaProperties">
 			<props>
-				<prop key="hibernate.cache.provider_configuration_file_resource_path">classpath:spring/ehcache.xml</prop>
-				<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
+				<prop key="hibernate.cache.provider_configuration_file_resource_path">classpath:spring/hibernate-redis.properties</prop>
+				<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.redis.hibernate4.SingletonRedisRegionFactory
 				</prop>
+                <prop key="hibernate.cache.region_prefix">hibernate</prop>
 				<prop key="hibernate.cache.use_query_cache">true</prop>
 				<prop key="hibernate.cache.use_second_level_cache">true</prop>
 				<prop key="hibernate.generate_statistics">true</prop>

+ 26 - 0
src/main/resources/spring/hibernate-redis.properties

@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2017. Sunghyouk Bae <sunghyouk.bae@gmail.com>
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+redisson-config=classpath:${profile}/redisson.yaml
+#
+# Cache Expiry settings
+# 'hibernate' is second cache prefix
+# 'common', 'account' is actual region name
+#
+# default = 120 seconds (2 minutes) (see RedisCacheUtil.DEFAULT_EXPIRY_IN_SECONDS)
+#
+redis.expiryInSeconds.default=120
+redis.expiryInSeconds.hibernate.common=0
+redis.expiryInSeconds.hibernate.com.uas.platform.b2c.model.User=10

+ 27 - 0
src/main/resources/test/redisson.yaml

@@ -0,0 +1,27 @@
+# redisson configuration for redis servers
+# see : https://github.com/mrniko/redisson/wiki/2.-Configuration
+
+singleServerConfig:
+  idleConnectionTimeout: 10000
+  pingTimeout: 1000
+  connectTimeout: 1000
+  timeout: 1000
+  retryAttempts: 3
+  retryInterval: 1000
+  reconnectionTimeout: 3000
+  failedAttempts: 3
+  password: null
+  subscriptionsPerConnection: 5
+  clientName: null
+  address: ["redis://192.168.253.6:6379"]
+  subscriptionConnectionMinimumIdleSize: 1
+  subscriptionConnectionPoolSize: 25
+  connectionMinimumIdleSize: 5
+  connectionPoolSize: 100
+  database: 0
+  dnsMonitoring: false
+  dnsMonitoringInterval: 5000
+threads: 0
+codec: !<org.redisson.codec.SnappyCodec> {}
+useLinuxNativeEpoll: false
+eventLoopGroup: null

+ 20 - 15
src/main/webapp/resources/view/vendor/forstore/vendor-invoice.html

@@ -77,6 +77,11 @@
         color: #5078cb;
         cursor: pointer;
     }
+    .invoice-com tbody>tr>td{
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+    }
     /*无记录与记录条数*/
     .table>tbody>tr.record-num td{
         padding: 0;
@@ -402,44 +407,44 @@
             </div>
         </div>
         <div class="vendor-invoice-content">
-            <table class="invoice-com-tab table" ng-table="billRecordTableParam">
+            <table class="invoice-com-tab table invoice-com" ng-table="billRecordTableParam" style="table-layout: fixed;">
                 <thead>
                 <tr>
-                    <th width="70">申请时间</th>
-                    <th width="90">订单号</th>
-                    <th width="90">开票金额(¥)</th>
-                    <th width="55" class="select-line">
+                    <th width="90">申请时间</th>
+                    <th width="185">订单号</th>
+                    <th width="110">开票金额(¥)</th>
+                    <th width="60" class="select-line">
                         <select class="select-adder form-control" style="position: relative;left: 6px;" ng-change="billTypeSearch(billType)" ng-model="billType">
                             <option value="1">类型</option>
                             <option value="2">普票</option>
                             <option value="3">专票</option>
                         </select>
                     </th>
-                    <th width="120">发票抬头</th>
-                    <th width="50">收票人</th>
-                    <th width="160">收票地址</th>
-                    <th width="50">联系电话</th>
+                    <th width="145">发票抬头</th>
+                    <th width="70">收票人</th>
+                    <th width="205">收票地址</th>
+                    <th width="125">联系电话</th>
                 </tr>
                 </thead>
                 <tbody>
                 <tr ng-repeat="item in billData track by $index">
-                    <td ng-bind="item.createTime | date : 'yyyy-MM-dd'"></td>
+                    <td ng-bind="item.createTime | date : 'yyyy-MM-dd'" title="{{item.createTime | date : 'yyyy-MM-dd'}}"></td>
                     <td>
                         <span ng-repeat="(col, orderid) in item.orderids.split(',')">
-                            <a ng-href="vendor#/purchase/detail/{{item.purchaseids.split(',')[col] | EncryptionFilter}}" ng-bind="orderid" target="_blank" class="link-order"></a>
+                            <a ng-href="vendor#/purchase/detail/{{item.purchaseids.split(',')[col] | EncryptionFilter}}" ng-bind="orderid" title="{{orderid}}" target="_blank" class="link-order"></a>
                         </span>
                     </td>
-                    <td ng-bind="item.price"></td>
+                    <td ng-bind="item.price" title="{{item.price}}"></td>
                     <td style="padding: 0;">
                         <span ng-bind="item.invoicetype==1206?'普票':'专票'"></span>
                         <b ng-click="lookInvoiceInfo(item)" class="invoice-info">开票信息</b></td>
-                    <td ng-bind="item.invoicetitle"></td>
-                    <td ng-bind="item.receiverName"></td>
+                    <td ng-bind="item.invoicetitle" title="{{item.invoicetitle}}"></td>
+                    <td ng-bind="item.receiverName" title="{{item.receiverName}}"></td>
                     <td class="address" title="{{item.area+'&#10;'+item.detailAddr}}">
                         <p ng-bind="item.area"></p>
                         <p ng-bind="item.detailAddr"></p>
                     </td>
-                    <td ng-bind="item.recTel">13135015772</td>
+                    <td ng-bind="item.recTel" title="{{item.recTel}}">13135015772</td>
                 </tr>
                 <tr class="record-num" ng-if="billData && billData.length>0">
                     <td colspan="9">