Просмотр исходного кода

新增后台获取供应商列表接口,以区分公共接口

wangyc 8 лет назад
Родитель
Сommit
3745a2c48e

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/product/brand/api/VendorListController.java

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
  *
  * @version 2017/11/27 17:38 wangyc
  */
-@RestController
+@RestController("api.VendorListController")
 @RequestMapping("api/produce/vendorlist")
 public class VendorListController {
 
@@ -35,6 +35,6 @@ public class VendorListController {
     @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
     public Page<VendorList> findByBrand(@PathVariable("uuid") String uuid, PageParams params) {
         PageInfo pageInfo = new PageInfo(params);
-        return vendorListService.findByBrand(pageInfo, uuid);
+        return vendorListService.findByBrandAPI(pageInfo, uuid);
     }
 }

+ 40 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/controller/VendorListController.java

@@ -0,0 +1,40 @@
+package com.uas.platform.b2c.prod.product.brand.controller;
+
+import com.uas.platform.b2c.prod.product.brand.modal.VendorList;
+import com.uas.platform.b2c.prod.product.brand.service.VendorListService;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by wangyc on 2017/11/27.
+ *
+ * @version 2017/11/27 17:38 wangyc
+ */
+@RestController
+@RequestMapping("produce/vendorlist")
+public class VendorListController {
+
+    private final VendorListService vendorListService;
+
+    @Autowired
+    public VendorListController(VendorListService vendorListService) {
+        this.vendorListService = vendorListService;
+    }
+
+    /**
+     * 通过品牌uuid获取供应商列表
+     * @param uuid
+     * @return
+     */
+    @RequestMapping(value = "/{uuid}", method = RequestMethod.GET)
+    public Page<VendorList> findByBrand(@PathVariable("uuid") String uuid, PageParams params) {
+        PageInfo pageInfo = new PageInfo(params);
+        return vendorListService.findByBrand(pageInfo, uuid);
+    }
+}

+ 9 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/service/VendorListService.java

@@ -12,7 +12,15 @@ import org.springframework.data.domain.Page;
 public interface VendorListService {
 
     /**
-     * 通过品牌uuid获取供应商列表
+     * 通过品牌uuid获取供应商列表(公共接口调用)
+     * @param uuid
+     * @return
+     */
+    Page<VendorList> findByBrandAPI(PageInfo pageInfo, String uuid);
+
+    /**
+     * 通过品牌uuid获取供应商列表(管理后台调用)
+     * @param pageInfo
      * @param uuid
      * @return
      */

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

@@ -53,6 +53,27 @@ public class VendorListServiceImpl implements VendorListService{
         this.storeInDao = storeInDao;
     }
 
+    @Override
+    public Page<VendorList> findByBrandAPI(final PageInfo pageInfo, String uuid) {
+        Brand brand = brandDao.findByUuid(uuid);
+
+        if (brand == null)
+            throw new IllegalOperatorException("此品牌为空,请重新确认品牌信息");
+
+        // 根据品牌信息获取
+        if (StringUtils.hasText(uuid)) {
+            SimpleExpression branduuid = new SimpleExpression("branduuid", uuid, CriterionExpression.Operator.EQ);
+            pageInfo.expression(branduuid);
+        }
+
+        return vendorListDao.findAll(new Specification<VendorList>() {
+            public Predicate toPredicate(Root<VendorList> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+                query.where(pageInfo.getPredicates(root, query, builder));
+                return null;
+            }
+        }, pageInfo);
+    }
+
     @Override
     public Page<VendorList> findByBrand(final PageInfo pageInfo, String uuid) {
         Brand brand = brandDao.findByUuid(uuid);

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

@@ -251,7 +251,7 @@ public class VendorListSubmitServiceImpl implements VendorListSubmitService {
             titles.add("电话");
             titles.add("传真");
             titles.add("网址");
-            titles.add("关联店铺名称");
+            titles.add("关联企业名称");
             titles.add("邮箱");
 
             List<String> heads = new ArrayList<String>();

+ 2 - 2
src/main/webapp/resources/js/admin/app.js

@@ -1,4 +1,4 @@
- define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage','common/query/user','common/query/secQuestion','common/query/keyWord','common/query/logUsage','common/query/seekQualityBuyer','common/query/loanApply', 'common/query/supplier'], function(angularAMD) {
+ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ui-form', 'ngLocal', 'ngTable', 'ngSanitize', 'ngDraggable', 'common/services', 'common/directives', 'common/query/brand', 'common/query/address', 'common/query/return' , 'common/query/change' ,'common/query/component', 'common/query/order', 'common/query/purchase', 'common/query/invoice', 'common/query/property', 'common/query/kind', 'common/query/property', 'common/query/receipt', 'common/query/logistics' ,'angular-toaster', 'ui-jquery', 'jquery-uploadify','common/query/dateParse' , 'common/query/bankTransfer' ,'common/query/bankInfo', 'common/query/urlencryption', 'common/query/bill', 'common/query/makerDemand', 'common/query/goods', 'common/query/validtime', 'file-upload','file-upload-shim', 'common/query/slideImage', 'common/query/kindAdvice', 'common/query/responseLogistics', 'common/query/search','common/directives/dynamicInput', 'common/query/auditorMail', 'common/query/tradeBasicProperties', 'common/query/exchangeRate', 'common/query/tradeDeliveryDelayTime', 'common/query/payment', 'common/query/kindContrast', 'common/query/crawlTask', 'common/query/afterSale', 'common/query/refund', 'common/query/messageBoard', 'common/query/logisticsPort', 'common/query/storeInfo', 'common/query/cms', 'common/query/help', 'common/query/commonCount', 'common/module/store_admin_violations_module', 'common/query/internalMessage','common/query/user','common/query/secQuestion','common/query/keyWord','common/query/logUsage','common/query/seekQualityBuyer','common/query/loanApply', 'common/query/supplier', 'common/query/seekSalesman'], function(angularAMD) {
 	'use strict';
 
 	 /**
@@ -8,7 +8,7 @@
 		 return this.length > 0 ? this[this.length - 1] : null;
 	 };
 
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery' ,'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices','common.query.user','secQuestionServices','keyWordServices','logUsageServices','seekQualityBuyerServices', 'loanApplyService', 'supplierServices']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ui.form', 'ng.local', 'ngTable', 'ngSanitize', 'ngDraggable', 'common.services', 'common.directives', 'brandServices', 'addressServices', 'returnServices', 'changeServices', 'componentServices', 'orderServices', 'purchaseServices', 'invoiceServices', 'propertyServices', 'receiptServices', 'logisticsServices', 'common.query.kind', 'toaster','ui.jquery' ,'dateparseServices', 'bankInfo' , 'bankTransfer', 'urlencryptionServices', 'billServices', 'makerDemand', 'goodsServices', 'validtimeServices', 'angularFileUpload', 'slideImageService', 'common.query.kindAdvice', 'responseLogisticsService', 'searchService', 'ngDynamicInput', 'ReviewerEmailInfoService', 'tradeBasicPropertiesServices', 'exchangeRateModule', 'tradeDeliveryDelayTimeModule', 'PaymentService', 'kindContrastServices', 'crawlTaskServices', 'afterSaleService', 'refundModule', 'messageBoardServices', 'logisticsPortService', 'storeInfoServices', 'cmsService', 'helpServices', 'commonCountServices', 'tool.directives', 'StoreAdminViolationsModule', 'internalMessageServices','common.query.user','secQuestionServices','keyWordServices','logUsageServices','seekQualityBuyerServices', 'loanApplyService', 'supplierServices', 'seekSalesmanServices']);
 	app.init = function() {
 		angularAMD.bootstrap(app);
 	};

+ 13 - 1
src/main/webapp/resources/js/common/query/supplier.js

@@ -1,5 +1,5 @@
 define([ 'ngResource' ], function() {
-	angular.module('supplierServices', [ 'ngResource' ]).factory('Supplier', ['$resource', 'BaseService', function($resource, BaseService) {
+	angular.module('supplierServices', [ 'ngResource' ]).factory('SupplierAPI', ['$resource', 'BaseService', function($resource, BaseService) {
 		const rootPath = BaseService.getRootPath();
 		// 供应商
 		return $resource('api/produce/vendorlist', {}, {
@@ -11,6 +11,18 @@ define([ 'ngResource' ], function() {
 				method: 'GET'
 			}
 		});
+	}]).factory('Supplier', ['$resource', 'BaseService', function($resource, BaseService) {
+		const rootPath = BaseService.getRootPath();
+		// 供应商
+		return $resource('produce/vendorlist', {}, {
+			/*
+			 * 分页获取品牌供应商信息
+			 */
+			getPage : {
+				url: rootPath + '/produce/vendorlist/:uuid',
+				method: 'GET'
+			}
+		});
 	}]).factory('SupplierSubmit', ['$resource', 'BaseService', function($resource, BaseService) {
 		const rootPath = BaseService.getRootPath();
 		// 供应商申请