Browse Source

供应商联想词

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7976 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
5d68e72cbc

+ 12 - 0
src/main/java/com/uas/platform/b2b/controller/VendorController.java

@@ -216,4 +216,16 @@ public class VendorController {
 	private List<VendorContact> getCustContacts(@PathVariable Long enuu) {
 		return vendorService.getCustContacts(enuu);
 	}
+
+	/**
+	 * 根据营业执照号查询供应商商是否存在
+	 * 
+	 * @param businessCode
+	 * @return
+	 */
+	@RequestMapping(value = "/vendorInfo", method = RequestMethod.GET)
+	@ResponseBody
+	public Vendor findByBusinessCode(String businessCode) {
+		return vendorService.findByBusinessCode(businessCode);
+	}
 }

+ 13 - 0
src/main/java/com/uas/platform/b2b/search/SearchController.java

@@ -393,6 +393,19 @@ public class SearchController {
 		return searchService.getSimilarVendors(keyword);
 	}
 
+	/**
+	 * 企业圈联想词
+	 * 
+	 * @param keyword
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value = "/similarEnterprise", method = RequestMethod.GET)
+	@ResponseBody
+	public List<Map<String, Object>> getSimilarEnterprise(String keyword) throws Exception {
+		return searchService.getSimilarEnterprise(keyword);
+	}
+
 //    /**
 //     * 根据输入获取联想词(类目)
 //     *

+ 9 - 0
src/main/java/com/uas/platform/b2b/search/SearchService.java

@@ -375,4 +375,13 @@ public interface SearchService {
 	 * @throws Exception
 	 */
 	public SPage<UserSpaceDetail> searchUserSpaceDetailCheckIds(String keyword, PageParams pageParams) throws Exception;
+
+	/**
+	 * 企业圈联想词
+	 * 
+	 * @param keyword
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Map<String, Object>> getSimilarEnterprise(String keyword) throws Exception;
 }

+ 25 - 0
src/main/java/com/uas/platform/b2b/search/SearchServiceImpl.java

@@ -860,4 +860,29 @@ public class SearchServiceImpl implements com.uas.platform.b2b.search.SearchServ
 		return toSPage(idsPage, content);
 	}
 
+	@Override
+	public List<Map<String, Object>> getSimilarEnterprise(String keyword) throws Exception {
+		SPage<String> codePages = searchService.similar(keyword, Table_name.AC$US$DETAIL, SIMILAR_NUM, "name");
+		List<UserSpaceDetail> contents = new ArrayList<UserSpaceDetail>();
+		for (String code : codePages.getContent()) {
+			PageParams pageParams = new PageParams();
+			pageParams.setPage((int) 1);
+			pageParams.setSize((int) 20);
+			SPage<UserSpaceDetail> details = searchUserSpaceDetailCheckIds(code, pageParams);
+			contents.addAll(details.getContent());
+		}
+		List<Map<String, Object>> vendors = new ArrayList<Map<String, Object>>();
+		for (UserSpaceDetail userSpaceDetail : contents) {
+			Map<String, Object> temp = new HashMap<>();
+			if (userSpaceDetail != null) {
+				temp.put("id", userSpaceDetail.getId());
+				temp.put("bussinesscode", userSpaceDetail.getBusinessCode());
+				temp.put("vendName", userSpaceDetail.getName());
+				temp.put("vendshortname", userSpaceDetail.getShortName());
+				vendors.add(temp);
+			}
+		}
+		return vendors;
+	}
+
 }

+ 20 - 5
src/main/webapp/resources/js/index/app.js

@@ -8945,9 +8945,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				id: null,
 				};
 		
-		// 获取供应商列表
-		cartOperation.vendorInfo({}, function(data) {
-		});
 		
 		if($rootScope.businessCode) {
 			VendorInfo.getVendorInfo({businessCode: $rootScope.businessCode}, {}, function(data) {
@@ -8965,7 +8962,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		};
 		
-		// 查找客户
+		// 查找供应商
 		$scope.dbfindCust = function(){
 			var modalInstance = $modal.open({
 				templateUrl: 'static/tpl/index/purc/modal/purc_order_vendor.html',
@@ -9005,7 +9002,25 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		};
 		
-	
+		// 联想词 start
+		// 获取供应商
+        $scope.getSimilarVendors = function(value) {
+        	console.log(value);
+            if (value) {
+                return Vendor.getSimilarVendors({keyword : value}).$promise.then(function(data) {
+                    return data.map(function(item) {
+                        return item;
+                    });
+                });
+            }
+        };
+	    
+        $scope.onAssociateCmpClick = function(vendor, order) {
+        	$scope.order.cust.uu = vendor.venduu;
+        	$rootScope.venduu = $scope.order.cust.uu;
+        }
+     // 联想词 end
+        
 //		$scope.order.orderItems.push(item);
 		if($rootScope.prodId) {
 			VendorInfo.getProdInfo({id: $rootScope.prodId}, {}, function(data) {

+ 9 - 0
src/main/webapp/resources/js/index/services/Purc.js

@@ -689,6 +689,15 @@ define([ 'ngResource'], function() {
 				url: 'vendor/custContacts/:enuu',
 				method: 'GET',
 				isArray: true
+			},
+			getSimilarEnterprise: {
+				url: 'search/similarEnterprise',
+				method: 'GET',
+				isArray: true
+			},
+			vendorInfo: {
+				url: 'vendor/vendorInfo',
+				method: 'GET'
 			}
 		});
 	}]).factory('Quotation', ['$resource', function($resource){

+ 1 - 2
src/main/webapp/resources/tpl/index/search/search_result.html

@@ -208,7 +208,6 @@
 	 	<div id="topSearch">
 	 		<span class="text-muted"><i class="fa fa-search fa-lg"></i> 搜索"{{tip}}",为您找到结果:</span>
 	 		企业{{total}}家;物料{{prodtotal}}个
-	 		<div id="message" class="text-muted" ng-if="total == 0">很抱歉,我们没有搜到“{{tip}}”相关的企业信息<a ng-click="invite(tip)">立即邀请</a>注册优软云</div>
 	 	</div>
 	</div>
 	<div class="loading in" ng-class="{'in': loading}">
@@ -229,7 +228,7 @@
 			<tr>
 				<td class="text-center" colspan="7">
 					<br>
-					<div class="text-muted"><h3><i class="fa fa-spinner"></i>暂未搜到与({{tip}})相关的企业信息</h3></div>
+					<div class="text-muted"><h3><i class="fa fa-spinner"></i>暂未搜到与({{tip}})相关的企业信息<a ng-click="invite(tip)" class="text-inverse">立即邀请</a>注册优软云</h3></div>
 					<br>
 				</td>
 			</tr>