Explorar el Código

Merge branch 'dev-mysql' into feature/yc-mysql_erp-1020

wangyc hace 8 años
padre
commit
da53a88e26

+ 32 - 0
src/main/java/com/uas/platform/b2c/common/account/model/UsageLog.java

@@ -84,6 +84,24 @@ public class UsageLog extends BufferedLogable implements Serializable {
 	@Column(name = "rel_key")
 	private Long key;
 
+	/**
+	 * 电话
+	 */
+	@Column(name = "user_tel")
+	private String userTel;
+
+	/**
+	 * 邮箱
+	 */
+	@Column(name = "user_email")
+	private String userEmail;
+
+	/**
+	 * 姓名
+	 */
+	@Column(name = "user_name")
+	private String userName;
+
 	@JsonIgnore
 	@JSONField(serialize = false)
 	public Long getId() {
@@ -166,6 +184,8 @@ public class UsageLog extends BufferedLogable implements Serializable {
 		this.key = key;
 	}
 
+	@JsonIgnore
+	@JSONField(serialize = false)
 	public UserBaseInfo getUser() {
 		return user;
 	}
@@ -174,6 +194,18 @@ public class UsageLog extends BufferedLogable implements Serializable {
 		this.user = user;
 	}
 
+	public String getUserTel() {
+		return user.getUserTel();
+	}
+
+	public String getUserEmail() {
+		return user.getUserEmail();
+	}
+
+	public String getUserName() {
+		return user.getUserName();
+	}
+
 	public UsageLog() {
 
 	}

+ 11 - 1
src/main/java/com/uas/platform/b2c/core/config/MicroServicesConf.java

@@ -28,6 +28,12 @@ public class MicroServicesConf {
 	@Value("#{sys.floorMicroServiceIp ?: '10.10.0.30'}")
 	private String floorMicroServiceIp;
 
+	/**
+	 * profile
+	 */
+	@Value("#{sys.profile}")
+	private String profile;
+
 	/**
 	 * 轮播
 	 */
@@ -71,7 +77,11 @@ public class MicroServicesConf {
 	}
 
 	public String getRequestUrlForNews(String requestUrl) {
-		return String.format("http://%s%s", this.newsMicroServiceIp, requestUrl);
+		if ("prod".equals(profile)){
+			return String.format("http://%s%s", this.newsMicroServiceIp, requestUrl);
+		}else {
+			return String.format("http://%s:%d%s", this.microServiceIp, 20210, requestUrl);
+		}
 	}
 
 	public String getRequestUrlForFloor(int port, String requestUrl) {

+ 14 - 3
src/main/java/com/uas/platform/b2c/core/filter/KeyWordFilter.java

@@ -14,6 +14,7 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.log4j.Logger;
 import org.springframework.util.StringUtils;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 import org.springframework.web.context.support.XmlWebApplicationContext;
@@ -23,12 +24,19 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
  * @author liusw
  */
 public class KeyWordFilter implements Filter {
+
     public static Set<String> keyworsSet = null;
 
+    /**
+     * hessian 请求路径前缀
+     */
+    private static String HESSIAN_URI_PREFIX = "/api/service/";
+
+    private Logger logger = Logger.getLogger(this.getClass());
+
     @Override
     public void destroy() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
@@ -40,8 +48,11 @@ public class KeyWordFilter implements Filter {
         response.setContentType("application/json; charset=utf-8");
         String contentType = req.getContentType();
         String method = req.getMethod();
-        // POST请求 或 PUT请求,并且不是附件上传请求
-        if(("POST".equals(method) || "PUT".equals(method)) && (StringUtils.isEmpty(contentType) || !contentType.contains("multipart"))){
+        String uri = req.getRequestURI();
+        // POST请求 或 PUT请求,并且不是附件上传请求,并且不是hessian请求
+        if(("POST".equals(method) || "PUT".equals(method)) &&
+                (StringUtils.isEmpty(contentType) || !contentType.contains("multipart")) &&
+                !uri.contains(HESSIAN_URI_PREFIX)){
             //注入Service
             ServletContext sc = req.getSession().getServletContext();
             XmlWebApplicationContext cxt = (XmlWebApplicationContext) WebApplicationContextUtils.getWebApplicationContext(sc);

+ 39 - 0
src/main/java/com/uas/platform/b2c/core/support/EncryptablePropertyPlaceholderConfigurer.java

@@ -0,0 +1,39 @@
+package com.uas.platform.b2c.core.support;
+
+import com.uas.platform.core.util.Des;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanInitializationException;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+
+import java.util.Properties;
+
+public class EncryptablePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
+    private static final String key = "10101010";
+
+    protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
+            throws BeansException {
+        try {
+            Des des = new Des();
+            String username = props.getProperty("jdbc.username");
+            if (username != null) {
+                props.setProperty("jdbc.username", des.decrypt(username, key));
+            }
+
+            String password = props.getProperty("jdbc.password");
+            if (password != null) {
+                props.setProperty("jdbc.password", des.decrypt(password, key));
+            }
+
+            String url = props.getProperty("jdbc.url");
+            if (url != null) {
+                props.setProperty("jdbc.url", des.decrypt(url, key));
+            }
+
+            super.processProperties(beanFactory, props);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new BeanInitializationException(e.getMessage());
+        }
+    }
+}

+ 3 - 3
src/main/resources/dev/jdbc.properties

@@ -1,8 +1,8 @@
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc:oracle:thin:@192.168.253.6:1521:orcl
-jdbc.url=jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
-jdbc.username=root
-jdbc.password=select111***
+jdbc.url=7e5ef205e2ff4ca4ac98c9f833880ec6e2fe1a4579ebe6946c98747cbe3897b66b5c4cb4985aa8f22aa1cbab4bc6bfe12e09403e6255e2fda2f113bc366bbfc5d9a2cf99c34ce47ba6bd752a9bf5f04c3faf83464996ab6930a84c7d3b9f62d759eb691bc8cd1fe3225f6e7efa5ab3a583896b06178e65c56c3c4e448a0ae4fe
+jdbc.username=474e1aeadeeecac5
+jdbc.password=48981af937f010627b96e886a0d38aad
 jdbc.initialSize=1
 jdbc.maxActive=100
 jdbc.maxIdle=50

+ 3 - 3
src/main/resources/prod/jdbc.properties

@@ -3,9 +3,9 @@
 #jdbc.username=platform$b2b
 #jdbc.password=select*fromuu
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
-jdbc.username=sa
-jdbc.password=Select123!#%*(
+jdbc.url=7e5ef205e2ff4ca46e29823f9c378880524d69d6c11d8c1c3688f4f0b3712ba1385b2cecff54843db21897fe0c75f0a36c7921cab8fadf398fa33412ca529b7f04233bf4ae6fd3870626fa79ef7f87cb7a8905195ea37bd042b530659d0e82dda7359ee0139e0d6fb23654ba47f5f4b8c682a3c72b9d81e7
+jdbc.username=73f3cd5578b9e08b
+jdbc.password=ee922d9f0e792f87e6dff054a282692d
 jdbc.initialSize=1
 jdbc.maxActive=100
 jdbc.maxIdle=50

+ 10 - 1
src/main/resources/spring/context.xml

@@ -11,7 +11,15 @@
 	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
 	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">
 
-	<context:property-placeholder location="classpath*:${profile}/*.properties" />
+	<bean id="propertyConfigurer"
+		  class="com.uas.platform.b2c.core.support.EncryptablePropertyPlaceholderConfigurer">
+		<property name="locations">
+			<list>
+				<value>classpath*:${profile}/*.properties</value>
+			</list>
+		</property>
+	</bean>
+	<!--<context:property-placeholder location="classpath*:${profile}/*.properties" />-->
 	<!-- 系统运行参数注入 -->
 	<util:properties id="sys"
 		location="classpath:${profile}/sys.properties" />
@@ -23,6 +31,7 @@
 	<!-- 容器启动完成之后执行 -->
 	<bean class="com.uas.platform.b2c.core.support.ContextRefreshedProcessor" />
 
+
 	<context:component-scan base-package="com.uas.platform" />
 	<context:annotation-config />
 

+ 3 - 3
src/main/resources/test/jdbc.properties

@@ -1,8 +1,8 @@
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #jdbc.url=jdbc:oracle:thin:@192.168.253.6:1521:orcl
-jdbc.url=jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
-jdbc.username=root
-jdbc.password=select111***
+jdbc.url=7e5ef205e2ff4ca4ac98c9f833880ec6e2fe1a4579ebe6946c98747cbe3897b66b5c4cb4985aa8f22aa1cbab4bc6bfe12e09403e6255e2fda2f113bc366bbfc5d9a2cf99c34ce47ba6bd752a9bf5f04c3faf83464996ab6930a84c7d3b9f62d759eb691bc8cd1fe3225f6e7efa5ab3a583896b06178e65c56c3c4e448a0ae4fe
+jdbc.username=474e1aeadeeecac5
+jdbc.password=48981af937f010627b96e886a0d38aad
 jdbc.initialSize=1
 jdbc.maxActive=100
 jdbc.maxIdle=50

+ 1 - 0
src/main/webapp/WEB-INF/spring/hessian.xml

@@ -8,6 +8,7 @@
 	<bean id="defaultHandlerMapping"
 		class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
 	<!-- 提供用于验证签名的私钥 -->
+	<!-- 注意保持name 链接规则一直,/api/service/** 否则会被过滤器KeyWordFilter过滤,验证无法通过 -->
 	<bean id="apiSecretKeyService" class="com.uas.platform.b2c.external.erp.support.SecretKeyServiceImpl" />
 	<!-- 验证成功后执行(将用户信息写到SystemSession) -->
 	<bean id="apiHandlerInterceptor"

+ 3 - 1
src/main/webapp/resources/css/common.css

@@ -939,4 +939,6 @@ input::-webkit-outer-spin-button,
 input::-webkit-inner-spin-button {
 	-webkit-appearance: none !important;
 	margin: 0;
-}
+}
+/*去除textarea默认右下角可自由放大样式*/
+textarea{resize:none}

+ 2 - 2
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_transfer_ctrl.js

@@ -622,11 +622,11 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('info', '提示', '没有选择要付款的订单,或付款总额为0');
 				return ;
 			}
-			if(angular.isUndefined($scope.buyAccount)||angular.equals("{}", angular.toJson($scope.buyAccount))) {
+			if(angular.isUndefined($scope.buyAccount)||angular.equals("{}", angular.toJson($scope.buyAccount))  || $scope.buyAccount == null) {
 				toaster.pop('info', '提示', '请选择买家账户');
 				return ;
 			}
-			if(angular.isUndefined($scope.saleAccount)||angular.equals("{}", angular.toJson($scope.saleAccount))) {
+			if(angular.isUndefined($scope.saleAccount)||angular.equals("{}", angular.toJson($scope.saleAccount)) || $scope.saleAccount == null) {
 				toaster.pop('info', '提示', '请选择卖家账户');
 				return ;
 			}

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

@@ -0,0 +1,40 @@
+package com.uas.platform.b2c;
+
+import com.uas.platform.core.util.Des;
+import org.junit.Test;
+
+public class DesTest {
+    @Test
+    public void test(){
+        try {
+            Des des = new Des();
+            byte b[] = des.encrypt("root", "10101010");
+            System.out.println(des.toHexString(b));
+
+            b = des.encrypt("jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true", "10101010");
+            System.out.println(des.toHexString(b));
+            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
+
+            b = des.encrypt("select111***", "10101010");
+            System.out.println(des.toHexString(b));
+
+            //正式
+            b = des.encrypt("sa", "10101010");
+            System.out.println(des.toHexString(b));
+
+            b = des.encrypt("jdbc:mysql://10.10.0.208:8066/mall_prod?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true", "10101010");
+            System.out.println(des.toHexString(b));
+            //System.out.println(des.decrypt(des.toHexString(b), "10101010"));
+
+            b = des.encrypt("Select123!#%*(", "10101010");
+            System.out.println(des.toHexString(b));
+
+
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+}
+