Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/feature/hb-brandMaintenceSuperBackground-1127' into feature/hb-brandMaintenceSuperBackground-1127

yangc 7 anni fa
parent
commit
c00cffe0ba

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/dao/VendorListSubmitDao.java

@@ -4,6 +4,8 @@ import com.uas.platform.b2c.prod.product.brand.modal.VendorListSubmit;
 import java.util.List;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -22,4 +24,13 @@ public interface VendorListSubmitDao extends JpaSpecificationExecutor<VendorList
      */
     List<VendorListSubmit> findByVendoridAndStatus(Long vendorId, Integer status);
 
+    /**
+     * 根据品牌uuid和申请状态获取新增供应商申请信息
+     * @param branduuid 品牌uuid
+     * @param status 状态
+     * @return
+     */
+    @Query("select v from VendorListSubmit v where v.vendorid is null and v.branduuid =:branduuid and v.status =:status")
+    List<VendorListSubmit> findByBranduuidAndStatusAndVendoridIsNull(@Param("branduuid") String branduuid, @Param("status") Integer status);
+
 }

+ 24 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/VendorListServiceImpl.java

@@ -15,6 +15,7 @@ import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.persistence.criteria.CriterionExpression;
 import com.uas.platform.core.persistence.criteria.SimpleExpression;
+import java.util.ArrayList;
 import java.util.List;
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
@@ -94,7 +95,29 @@ public class VendorListServiceImpl implements VendorListService{
             }
         }
 
-        return new PageImpl<VendorList>(vendorLists, pageInfo, vendorListPage.getTotalElements());
+        List<VendorList> returnVendorLists = new ArrayList<>(vendorLists);
+        Long totalElements = vendorListPage.getTotalElements();
+
+        List<VendorListSubmit> vendorListSubmits = vendorListSubmitDao.findByBranduuidAndStatusAndVendoridIsNull(uuid, Status.SUBMITTED.value());
+        if (CollectionUtils.isNotEmpty(vendorListSubmits)) {
+            for (VendorListSubmit vendorListSubmit : vendorListSubmits) {
+                VendorList vendorList = new VendorList();
+                convertBySubmit(vendorList, vendorListSubmit);
+                vendorList.setIsSubmited((short) 2);
+
+                if (vendorList.getStoreuuid() != null) {
+                    StoreIn store = storeInDao.findByUuid(vendorList.getStoreuuid());
+                    if (store != null) {
+                        vendorList.setStoreIn(store);
+                    }
+                }
+                returnVendorLists.add(vendorList);
+            }
+            totalElements += vendorListSubmits.size();
+//            pageInfo.setPageSize(returnVendorLists.size());
+        }
+
+        return new PageImpl<VendorList>(returnVendorLists, pageInfo, totalElements);
     }
 
     private void convertBySubmit(VendorList vendorList, VendorListSubmit vendorListSubmit) {

+ 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
src/main/resources/jxls-tpl/product/brand-vendor.xls


+ 7 - 3
src/main/webapp/resources/js/admin/controllers/supplierMaintenanceCtrl.js

@@ -3,6 +3,7 @@ define([ 'app/app' ], function(app) {
 	app.register.controller('supplierMaintenanceCtrl', ['$scope', 'ngTableParams', 'toaster', 'BrandActive', '$stateParams', 'SupplierSubmit', 'Loading', 'BaseService', '$window', 'Supplier', 'StoreInfo', '$upload', function($scope, ngTableParams, toaster, BrandActive, $stateParams, SupplierSubmit, Loading, BaseService, $window, Supplier, StoreInfo, $upload) {
 		$scope.storeType = '';
 		$scope.addedSupplier = false;
+		$scope.brandKeyword = '';
 
 		// 根据路由地址获取品牌信息
 		var getBrand = function () {
@@ -161,8 +162,8 @@ define([ 'app/app' ], function(app) {
                         param.type = $scope.storeType;
                     }
                     // 根据关键字进行搜索
-                    if ($scope.keyword && $scope.keyword !== '') {
-                        param.keyword = $scope.keyword;
+                    if ($scope.brandKeyword && $scope.brandKeyword !== '') {
+                        param.keyword = $scope.brandKeyword;
                     }
 					StoreInfo.pageStoreInfoWhenAdminQuery(param, function (data) {
 						if (!data.content || !Array.isArray(data.content)) {
@@ -214,7 +215,8 @@ define([ 'app/app' ], function(app) {
 		/**
 		 * 根据关键字进行搜索
 		 */
-		$scope.refreshTableData = function () {
+		$scope.refreshTableData = function (keyword) {
+      $scope.brandKeyword = keyword;
 			$scope.storeTableParams.page(1);
 			$scope.storeTableParams.reload();
 		};
@@ -226,6 +228,7 @@ define([ 'app/app' ], function(app) {
 		 */
 		$scope.chooseStore = function (supplier, store) {
 			supplier.storeIn = store;
+      $scope.brandKeyword = '';
 			supplier.chooseStoreAssociated = false;
 		};
 
@@ -234,6 +237,7 @@ define([ 'app/app' ], function(app) {
 		 * @param supplier 供应商
 		 */
 		$scope.storeAssociated = function (supplier){
+      $scope.brandKeyword = '';
 			supplier.chooseStoreAssociated = typeof supplier.chooseStoreAssociated == 'undefined' ? true : !supplier.chooseStoreAssociated;
 			if (supplier.chooseStoreAssociated) {
 				getStoreData();

+ 11 - 11
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;
@@ -618,7 +618,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>
@@ -652,7 +652,7 @@
 									<span ng-bind="supplier.website">http://www.wordshine.net.com</span>
 								</td>
 								<td>
-									<button ng-click="storeAssociated()" 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>
@@ -698,7 +698,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>
@@ -711,8 +711,8 @@
 												<span class="fl">经销商</span>
 											</label>
 											<div class="form-search">
-												<input type="text" ng-click="refreshTableData()">
-												<button><i class="fa fa-search" ng-click="refreshTableData()"></i></button>
+												<input type="text" ng-model="brandKeyword">
+												<button><i class="fa fa-search" ng-click="refreshTableData(brandKeyword)"></i></button>
 											</div>
 										</div>
 										<table ng-table="storeTableParams">
@@ -783,21 +783,21 @@
 								<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>
 										<label>
-											<input type="checkbox" class="fl">
+											<input type="checkbox" class="fl" ng-click="chooseStoreType('AGENCY')">
 											<span class="fl">代理商</span>
 										</label>
 										<label>
-											<input type="checkbox" class="fl">
+											<input type="checkbox" class="fl" ng-click="chooseStoreType('DISTRIBUTION')">
 											<span class="fl">经销商</span>
 										</label>
 										<div class="form-search">
-											<input type="text">
-											<button><i class="fa fa-search"></i></button>
+											<input type="text" ng-model="brandKeyword">
+											<button><i class="fa fa-search"  ng-click="refreshTableData(brandKeyword)"></i></button>
 										</div>
 									</div>
 									<table ng-table="storeTableParams">