Explorar o código

【品牌供应商】--调整关联店铺为关联企业

wangyc %!s(int64=8) %!d(string=hai) anos
pai
achega
b6b53b884f

+ 30 - 9
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/VendorListSubmitServiceImpl.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.prod.product.brand.service.impl;
 
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
 import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
 import com.uas.platform.b2c.common.account.model.UserBaseInfo;
 import com.uas.platform.b2c.core.constant.Status;
@@ -14,6 +15,7 @@ import com.uas.platform.b2c.prod.product.brand.modal.VendorListSubmit;
 import com.uas.platform.b2c.prod.product.brand.service.VendorListSubmitService;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.prod.store.model.StoreStatus;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
@@ -56,13 +58,16 @@ public class VendorListSubmitServiceImpl implements VendorListSubmitService {
 
     private final UserBaseInfoDao userBaseInfoDao;
 
+    private final EnterpriseDao enterpriseDao;
+
     @Autowired
-    public VendorListSubmitServiceImpl(VendorListDao vendorListDao, VendorListSubmitDao vendorListSubmitDao, BrandDao brandDao, StoreInDao storeInDao, UserBaseInfoDao userBaseInfoDao){
+    public VendorListSubmitServiceImpl(VendorListDao vendorListDao, VendorListSubmitDao vendorListSubmitDao, BrandDao brandDao, StoreInDao storeInDao, UserBaseInfoDao userBaseInfoDao, EnterpriseDao enterpriseDao){
         this.vendorListDao = vendorListDao;
         this.vendorListSubmitDao = vendorListSubmitDao;
         this.brandDao = brandDao;
         this.storeInDao = storeInDao;
         this.userBaseInfoDao = userBaseInfoDao;
+        this.enterpriseDao = enterpriseDao;
     }
 
     @Override
@@ -373,16 +378,32 @@ public class VendorListSubmitServiceImpl implements VendorListSubmitService {
                     }
                 }
 
-                // 关联店铺名称
+                // 关联企业名称
                 if (row.getCell(8) != null) {
                     row.getCell(8).setCellType(Cell.CELL_TYPE_STRING);
-                    String storeName = row.getCell(8).getStringCellValue().trim();
-
-                    if (StringUtils.hasText(storeName)) {
-                        StoreIn storeIn = storeInDao.findByStoreName(storeName);
-                        if (storeIn == null)
-                            throw new IllegalOperatorException("第" + (r+1) + "行店铺:" + storeIn.getStoreName() + " 不存在");
-                        vendorListSubmit.setStoreuuid(storeIn.getUuid());
+                    String enName = row.getCell(8).getStringCellValue().trim();
+
+                    if (StringUtils.hasText(enName)) {
+                        List<Long> enuu = enterpriseDao.findEnuuByName(enName);
+                        if (CollectionUtils.isNotEmpty(enuu)) {
+                            List<StoreIn> storeInExist = storeInDao.findByEnUU(enuu.get(0));
+                            if (CollectionUtils.isNotEmpty(storeInExist)) {
+                                StoreIn storeIn = storeInExist.get(0);
+                                if (StoreStatus.OPENED == storeIn.getStatus()) {
+                                    VendorList vendorLists = vendorListDao.findByBranduuidAndStoreuuid(vendorListSubmit.getBranduuid(), storeIn.getUuid());
+                                    if (vendorLists != null) {
+                                        throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + " 店铺,在当前品牌下已关联供应商");
+                                    }
+                                    vendorListSubmit.setStoreuuid(storeIn.getUuid());
+                                } else {
+                                    throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + " 店铺不为已开通状态");
+                                }
+                            } else {
+                                throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + "未开通店铺");
+                            }
+                        } else {
+                            throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + "不存在");
+                        }
                     }
                 }
                 // 邮箱

BIN=BIN
src/main/resources/jxls-tpl/product/brand-vendor.xls


+ 6 - 6
src/main/webapp/resources/view/admin/supplier_maintenance.html

@@ -319,7 +319,7 @@
 		white-space: nowrap ;
 		overflow: hidden ;
 	}
-	/*选择关联店铺*/
+	/*选择关联企业*/
 
 	.box-bottom table td .choose{
 		position: absolute;
@@ -615,7 +615,7 @@
 							<th width="10%">电话</th>
 							<th width="10%">传真</th>
 							<th width="12%">网址</th>
-							<th width="5%">关联店铺</th>
+							<th width="5%">关联企业</th>
 							<th width="10%">邮箱</th>
 							<th width="5%"></th>
 						</tr>
@@ -649,7 +649,7 @@
 									<span ng-bind="supplier.website">http://www.wordshine.net.com</span>
 								</td>
 								<td>
-									<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName">选择关联店铺 <i class="fa fa-angle-down"></i></button>
+									<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName">选择关联企业 <i class="fa fa-angle-down"></i></button>
 								</td>
 								<td>
 									<span ng-bind="supplier.email" class="emails">12345678@qq.com</span>
@@ -695,7 +695,7 @@
 									<input type="text" class="network" ng-model="supplier.editWebsite"/>
 								</td>
 								<td style="position: relative ">
-									<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName ? supplier.storeIn.storeName : '选择关联店铺'"><i class="fa fa-angle-down"></i></button>
+									<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName ? supplier.storeIn.storeName : '选择关联企业'"><i class="fa fa-angle-down"></i></button>
 									<div class="choose" ng-if="supplier.chooseStoreAssociated">
 										<div class="top">
 											<span>类型选择</span>
@@ -715,7 +715,7 @@
 										<table ng-table="storeTableParams">
 											<thead>
 											<tr>
-												<th width="30">{{brandKeyword}}</th>
+												<th width="30"></th>
 												<th width="70">店铺编号</th>
 												<th width="170">公司名称</th>
 												<th width="60">类型</th>
@@ -780,7 +780,7 @@
 								<input type="text" class="network" ng-model="supplier.website"/>
 							</td>
 							<td style="position: relative ">
-								<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName ? supplier.storeIn.storeName : '选择关联店铺'"> <i class="fa fa-angle-down"></i></button>
+								<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName ? supplier.storeIn.storeName : '选择关联企业'"> <i class="fa fa-angle-down"></i></button>
 								<div class="choose" ng-if="supplier.chooseStoreAssociated">
 									<div class="top">
 										<span>类型选择</span>