Browse Source

Merge remote-tracking branch 'origin/feature/yc-mobile-0522' into feature/yc-mobile-0522

shenjj 7 years ago
parent
commit
e9722fcab6

+ 16 - 1
src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/UserServiceImpl.java

@@ -2,11 +2,14 @@
 package com.uas.platform.b2c.common.account.v2.service.impl;
 
 import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.dao.RoleDao;
 import com.uas.platform.b2c.common.account.dao.UserDao;
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.Role;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.account.v2.service.UserService;
 import com.uas.platform.b2c.core.constant.IntegerConstant;
+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.sso.entity.UserView;
@@ -16,6 +19,7 @@ import org.springframework.util.StringUtils;
 
 import java.text.SimpleDateFormat;
 import java.util.List;
+import java.util.Set;
 
 
 @Service("v2.UserService")
@@ -27,6 +31,9 @@ public class UserServiceImpl implements UserService {
     @Autowired
     private EnterpriseDao enterpriseDao;
 
+    @Autowired
+    private RoleDao roleDao;
+
     private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
 
     private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
@@ -161,7 +168,7 @@ public class UserServiceImpl implements UserService {
     }*/
 
     @Override
-    public void bindOrUnbind(Long uu, Long enuu, Integer type) {
+    public void bindOrUnbind(Long uu, Long enuu, Integer type)  {
         User user = userDao.findOne(uu);
         Enterprise enterprise = enterpriseDao.findByUu(enuu);
         if (null == user) {
@@ -175,6 +182,14 @@ public class UserServiceImpl implements UserService {
         if (null != type) {
             if (type.equals(IntegerConstant.YES_SHORT)) { //1为绑定,0为解绑
                 user.addEnterprise(enterprise);
+                List<Role> roles = roleDao.findByEnUUAndDesc(enterprise.getUu(),"普通用户");
+                if(roles.size()>0){
+                    Set<Role> set = user.getRoles();
+                    set.add(roles.get(0));
+                    user.setRoles(set);
+                }else{
+                    enterpriseDao.callInitProcedure(enterprise.getUu());
+                }
                 userDao.save(user);
             } else {
                 user.removeEnterprise(enterprise);

+ 3 - 2
src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java

@@ -208,7 +208,8 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
         // 暂时在正式 过滤admin访问权限
         if (needPermission != null) {
             if ("prod".equals(profile)) {
-                if (!user.getEnterprise().getUu().toString().equals(enUU)) {
+                //暂时放行所有权限拦截, 权限发布时候再开放注释;
+               /* if (!user.getEnterprise().getUu().toString().equals(enUU)) {
                     throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
                 } else {
                     if (user.getEnterprise().getUu().toString().equals(enUU)) {
@@ -216,7 +217,7 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
                             throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
                         }
                     }
-                }
+                }*/
             } else {
                 throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
             }

+ 18 - 0
src/main/java/com/uas/platform/b2c/fa/payment/utils/StringUtils.java

@@ -99,4 +99,22 @@ public class StringUtils {
 		builder.deleteCharAt(builder.length() - 1);
 		return builder.toString();
 	}
+
+
+
+	/**
+	 *	截取指定字节长度的字符串忽略编码格式
+	 *
+	 * @param original 截取的字符串
+	 * @param length 截取的字节长度
+	 * @return
+	 */
+	public static String cutOutStringIgnoreEncode(String original, int length) {
+		if (org.springframework.util.StringUtils.isEmpty(original)) {
+			return original;
+		} else {
+			String substring = original.substring(0, length);
+			return substring;
+		}
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/constant/UploadConstant.java

@@ -138,5 +138,5 @@ public final class UploadConstant {
     /**
      * 规格的最大长度
      */
-    public static final int SPEC_MAX_BYTE = 80;
+    public static final int SPEC_MAX_BYTE = 20;
 }

+ 1 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -680,12 +680,8 @@ public class ReleaseProductByBatch implements Serializable {
 	 */
 	public void setSpecByExcel(Object value) {
 		if (!StringUtils.isEmpty(value)) {
-			try {
-				String str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(value.toString(), UploadConstant.SPEC_MAX_BYTE);
+				String str = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutStringIgnoreEncode(value.toString(), UploadConstant.SPEC_MAX_BYTE);
 				setSpec(str);
-			} catch (UnsupportedEncodingException e) {
-				throw new RuntimeException(e + "指定字符集不支持");
-			}
 		}
 	}
 

+ 1 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -298,11 +298,8 @@ public class GoodsServiceImpl implements GoodsService {
 //            throw new IllegalOperatorException("包装信息只能包含中文和英文");
 //        }
         if (!StringUtils.isEmpty(goods.getSpec())) {
-            try {
-                String spec = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(goods.getSpec().toString(), UploadConstant.SPEC_MAX_BYTE);
+                String spec = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutStringIgnoreEncode(goods.getSpec().toString(), UploadConstant.SPEC_MAX_BYTE);
                 goods.setSpec(spec);
-            } catch (Exception e) {
-            }
         }
         if (StringUtils.isEmpty(goods.getProduceDate())) {
             throw new IllegalOperatorException("型号" + goods.getCode()+"品牌" + goods.getBrandNameEn() +"的产品生产日期为空");

+ 1 - 1
src/main/resources/dev/redis.properties

@@ -1,2 +1,2 @@
-redis.host=10.10.100.200
+redis.host=192.168.253.6
 redis.port=6379

BIN
src/main/resources/jxls-tpl/trade/releaseByBatch-rmb.xls


BIN
src/main/resources/jxls-tpl/trade/releaseByBatchError-rmb.xls


BIN
src/main/resources/jxls-tpl/trade/releaseByBatchError-usd.xls


BIN
src/main/resources/jxls-tpl/trade/releasebyBatch-usd.xls


+ 2 - 2
src/main/resources/test/redis.properties

@@ -1,3 +1,3 @@
-#redis.host=192.168.253.6
-redis.host=10.10.100.200
+redis.host=192.168.253.6
+#redis.host=10.10.100.200
 redis.port=6379

+ 6 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_store_maintain_ctrl.js

@@ -231,7 +231,7 @@ define(['app/app'], function (app) {
          */
         $scope.checkWeixin = function () {
             var enWeixin = angular.element('.enWeixin').val();
-            if (!/^[0-9a-zA-Z]+$/.test(enWeixin) && enWeixin) {
+            if (!/^[0-9a-zA-Z]{6,20}$/.test(enWeixin) && enWeixin) {
                 toaster.pop('error', '请输入正确的微信号');
                 return false;
             }
@@ -288,7 +288,7 @@ define(['app/app'], function (app) {
                 return false;
             }
 
-            if (!/^[0-9a-zA-Z]+$/.test(enWeixin) && enWeixin) {
+            if (!/^[0-9a-zA-Z]{6,20}$/.test(enWeixin) && enWeixin) {
                 toaster.pop('error', '请输入正确的微信号');
                 return false;
             }
@@ -542,6 +542,10 @@ define(['app/app'], function (app) {
 		$scope.cancleProductEdit = cancleProductEdit;
 
 		function editRecommendProduct(module, status) {
+			if ($rootScope.userInfo.userUU != $rootScope.userInfo.enterprise.enAdminuu) {
+				toaster.pop('error', '您无该模块的编辑权限,请联系企业管理员进行编辑维护!');
+				return;
+			}
 			if (module == 'BATCH_OPERATION') {
 				$scope.canBatchOperation = status;
 				return ;

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_material.html

@@ -2352,7 +2352,7 @@
 																								 style="width: 70px;"/>
 														</div>
 														<div class="input-list">
-															<span class="tit"  style="width: 84px">规格:</span><input class="width70 form-control" name="spec" title="规格"  placeholder="数量" ng-model="goods.spec"
+															<span class="tit"  style="width: 84px">规格:</span><input class="width70 form-control" name="spec" title="规格"  placeholder="规格" ng-model="goods.spec"
 																																		maxlength="20"
 																																		style="width: 70px;"/>
 														</div>

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_store_maintain.html

@@ -750,7 +750,7 @@
 					<span>微&nbsp;&nbsp;&nbsp;&nbsp;信</span>
 				</div>
 				<div class="col-md-10 custom_col">
-					<input type="text" class="form-control enWeixin" style="border-radius: inherit;" title="enWeixin" ng-pattern="/^[0-9a-zA-Z]+$/" ng-blur="checkWeixin()" ng-model="sampleStore.enterprise.enWeixin"/>
+					<input type="text" class="form-control enWeixin" style="border-radius: inherit;" title="enWeixin" ng-pattern="/^[0-9a-zA-Z]{6,20}$/" ng-blur="checkWeixin()" ng-model="sampleStore.enterprise.enWeixin"/>
 					<!--<input type="text" class="form-control enWeixin" style="border-radius: inherit;" title="enWeixin" ng-blur="checkWeixin()" ng-model="sampleStore.enterprise.enWeixin"/>-->
 				</div>
 			</div>