Browse Source

企业圈新的合作伙伴处理

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9318 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
dongbw 8 years ago
parent
commit
32919f398c

+ 11 - 0
src/main/java/com/uas/platform/b2b/controller/InvitationRecordController.java

@@ -55,6 +55,17 @@ public class InvitationRecordController {
 		return invitationRecordService.reInvite(id);
 	}
 
+	/**
+	 * 根据id获取邀请记录
+	 *
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/record/{id}", method = RequestMethod.GET)
+	private InvitationRecord getRecordById(@PathVariable Long id) {
+		return invitationRecordService.getRecordById(id);
+	}
+
 	/**
 	 * 查询邀请记录(个人)-当前企业
 	 * 

+ 10 - 4
src/main/java/com/uas/platform/b2b/service/InvitationRecordService.java

@@ -1,13 +1,12 @@
 package com.uas.platform.b2b.service;
 
-import java.util.List;
-
-import org.springframework.ui.ModelMap;
-
 import com.uas.platform.b2b.model.Enterprise;
 import com.uas.platform.b2b.model.InvitationRecord;
 import com.uas.search.b2b.model.PageParams;
 import com.uas.search.b2b.model.SPage;
+import org.springframework.ui.ModelMap;
+
+import java.util.List;
 
 public interface InvitationRecordService {
 
@@ -50,4 +49,11 @@ public interface InvitationRecordService {
 	 * @return
 	 */
 	public ModelMap reInvite(Long id);
+
+	/**
+	 *  根据id获取邀请记录内容
+	 * @param id
+	 * @return
+	 */
+	InvitationRecord getRecordById(Long id);
 }

+ 11 - 2
src/main/java/com/uas/platform/b2b/service/impl/InvitationRecordServiceImpl.java

@@ -97,10 +97,14 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
 				mailService.send(messageConf.getTplInvitationForB2B(), record.getVenduseremail(), model);
 			}
 			if (record.getVendusertel() != null) {
-				smsService.send(messageConf.getMsgInvitationForB2B(), record.getVendusertel(),
+				try {
+					smsService.send(messageConf.getMsgInvitationForB2B(), record.getVendusertel(),
 						new Object[] { record.getVendusername(), record.getVendname(),
 								SystemSession.getUser().getUserName() + "("
 										+ SystemSession.getUser().getEnterprise().getEnName() + ")" });
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
 			}
 			if (record.getId() != null) {
 				map.put("success", "邀请已发送");
@@ -116,7 +120,12 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
 		return invite(invitationRecordDao.findOne(id));
 	}
 
-	@Override
+    @Override
+    public InvitationRecord getRecordById(Long id) {
+        return invitationRecordDao.findOne(id);
+    }
+
+    @Override
 	public List<InvitationRecord> getRecords() {
 		return invitationRecordDao.findByUseruu(SystemSession.getUser().getUserUU());
 	}

+ 110 - 75
src/main/webapp/resources/js/index/app.js

@@ -525,10 +525,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             url : '/invitation',
             templateUrl : "static/tpl/index/baseInfo/invitation.html",
             controller : 'InvitationCtrl'
-        }).state('baseInfo.invitationforEn', {
-            url : '/invitationforEn',
-            templateUrl : "static/tpl/index/baseInfo/invitation.html",
-            controller : 'InvitationByEnCtrl'
+        // }).state('baseInfo.invitationforEn', {
+        //     url : '/invitationforEn',
+        //     templateUrl : "static/tpl/index/baseInfo/invitation.html",
+        //     controller : 'InvitationByEnCtrl'
         }).state('qc', {
             url : "/qc",
             views : {
@@ -1085,7 +1085,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		 */
 		$scope.view = function(name) {
 			$rootScope.vendName = name;
-			window.location.hash = "#/baseInfo/myRquest";
+			window.location.hash = "#/baseInfo/newPartner";
 		}
 	}]);
 	
@@ -1106,6 +1106,30 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$modalInstance.dismiss();
 		}
 	}]);
+
+
+    app.controller('ReInviteCtrl', ['$scope', 'toaster', '$modalInstance', 'id', 'InvitationRecord', function($scope, toaster, $modalInstance, id, InvitationRecord) {
+
+
+        var loadData = function (id) {
+            InvitationRecord.getRecordById({id: id}, {}, function(data) {
+                $scope.enter = data;
+            });
+        };
+        loadData(id);
+
+        $scope.save = function(enter) {
+            if(!enter.vendusertel && !enter.venduseremail) {
+                toaster.pop('info', '提示', '手机号或邮箱至少填写一个才能通知到客户');
+            } else {
+                $modalInstance.close(enter);
+            }
+        };
+
+        $scope.cancel = function() {
+            $modalInstance.dismiss();
+        }
+    }]);
 	
 	/**
 	 * 邀请记录(个人)--现在包括个人和企业
@@ -1171,78 +1195,89 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				resolve: {name: function() {return name}}
 			}).result.then(function(data){
 			});			
-		}
-		
-		// 再次邀请
-		$scope.reInvite = function(id) {
-			InvitationRecord.reInvite({id: id}, {}, function(data) {
-				if(data.success) {
-					toaster.pop('success', '提示', data.success);
-					$scope.tableParams.page(1);
-		  			$scope.tableParams.reload();
-				}
-			}, function(response) {
-				toaster.pop('error', '提示', response.data);
-			});
-		}
-	}]);
-	
-	/**
-	 * 邀请记录(企业)--弃用
-	 */
-	app.controller('InvitationByEnCtrl', ['$scope', 'toaster', 'InvitationRecord', 'BaseService', 'ngTableParams', function($scope, toaster, InvitationRecord, BaseService, ngTableParams) {
-		BaseService.scrollBackToTop();
-		$scope.status = "invitationTeam";
-		var getService = function() {
-			return InvitationRecord.getRecordsByEn;
 		};
 		
-		$scope.tableParams = new ngTableParams({ // ng-Table参数
-			page : 1,
-			count : 10,
-			sorting: {
-            }
-		}, {
-			total : 0, 
-			counts: [],
-			getData : function($defer, params) { // 获取数据的方法
-				$scope.loading = true;
-				var pageParams = params.url();
-				pageParams.keyword = $scope.keyword;
-				$scope.tip = $scope.keyword;
-				getService().call(null, BaseService.parseParams(pageParams), function(page){
-					$scope.loading = false;
-					if(page) {
-						params.total(page.totalElement);
-						$defer.resolve(page.content);
-					}
-				}, function(response){
-					$scope.loading = false;
-					toaster.pop('error', '数据加载失败', response.data);
-				});
-			}
-		});
-		
-		$scope.onSearch = function(keyword){
-			$scope.tableParams.page(1);
-  			$scope.tableParams.reload();
-  			$scope.tip = keyword;
-		}
-		
 		// 再次邀请
 		$scope.reInvite = function(id) {
-			InvitationRecord.reInvite({id: id}, {}, function(data) {
-				if(data.success) {
-					toaster.pop('success', '提示', data.success);
-					$scope.tableParams.page(1);
-		  			$scope.tableParams.reload();
-				}
-			}, function(response) {
-				toaster.pop('error', '提示', response.data);
-			});
+            var modalInstance = $modal.open({
+                animation: true,
+                templateUrl: 'static/tpl/index/search/enterpirseInfo.html',
+                controller: 'ReInviteCtrl',
+                resolve: {
+                    id: function(){return id}
+                }
+            });
+            modalInstance.result.then(function(data) {
+                InvitationRecord.invite({formStore: data}, {}, function(data) {
+                    if(data.success) {
+                        toaster.pop('success', '提示', data.success);
+                    }
+                    if(data.error) {
+                        toaster.pop('error', '提示', data.error);
+                    }
+                }, function(response) {
+                    toaster.pop('error', '提示', response.data);
+                });
+            });
 		}
 	}]);
 	
+	// /**
+	//  * 邀请记录(企业)--弃用
+	//  */
+	// app.controller('InvitationByEnCtrl', ['$scope', 'toaster', 'InvitationRecord', 'BaseService', 'ngTableParams', function($scope, toaster, InvitationRecord, BaseService, ngTableParams) {
+	// 	BaseService.scrollBackToTop();
+	// 	$scope.status = "invitationTeam";
+	// 	var getService = function() {
+	// 		return InvitationRecord.getRecordsByEn;
+	// 	};
+	//
+	// 	$scope.tableParams = new ngTableParams({ // ng-Table参数
+	// 		page : 1,
+	// 		count : 10,
+	// 		sorting: {
+     //        }
+	// 	}, {
+	// 		total : 0,
+	// 		counts: [],
+	// 		getData : function($defer, params) { // 获取数据的方法
+	// 			$scope.loading = true;
+	// 			var pageParams = params.url();
+	// 			pageParams.keyword = $scope.keyword;
+	// 			$scope.tip = $scope.keyword;
+	// 			getService().call(null, BaseService.parseParams(pageParams), function(page){
+	// 				$scope.loading = false;
+	// 				if(page) {
+	// 					params.total(page.totalElement);
+	// 					$defer.resolve(page.content);
+	// 				}
+	// 			}, function(response){
+	// 				$scope.loading = false;
+	// 				toaster.pop('error', '数据加载失败', response.data);
+	// 			});
+	// 		}
+	// 	});
+	//
+	// 	$scope.onSearch = function(keyword){
+	// 		$scope.tableParams.page(1);
+  	// 		$scope.tableParams.reload();
+  	// 		$scope.tip = keyword;
+	// 	}
+	//
+	// 	// 再次邀请
+	// 	$scope.reInvite = function(id) {
+	// 		InvitationRecord.reInvite({id: id}, {}, function(data) {
+	// 			if(data.success) {
+	// 				toaster.pop('success', '提示', data.success);
+	// 				$scope.tableParams.page(1);
+	// 	  			$scope.tableParams.reload();
+	// 			}
+	// 		}, function(response) {
+	// 			toaster.pop('error', '提示', response.data);
+	// 		});
+	// 	}
+	// }]);
+	
 	/**
 	 * 模糊查询相似的企业名称 
 	 */
@@ -11877,7 +11912,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if(data.success) {
                     toaster.pop('success', '提示', data.success);
                 }
-                $scope.tableParams.page(1);
+                // $scope.tableParams.page(1);
                 $scope.tableParams.reload();
             }, function(response) {
                 toaster.pop('error', '提示', response.data);
@@ -11890,7 +11925,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if(data.success) {
                     toaster.pop('success', '提示', data.success);
                 }
-                $scope.tableParams.page(1);
+                // $scope.tableParams.page(1);
                 $scope.tableParams.reload();
             }, function(response) {
                 toaster.pop('error', '提示', response.data);
@@ -11903,7 +11938,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if(data.success) {
                     toaster.pop('success', '提示', data.success);
                 }
-                $scope.tableParams.page(1);
+                // $scope.tableParams.page(1);
                 $scope.tableParams.reload();
             }, function(response) {
                 toaster.pop('error', '提示', response.data);
@@ -11916,7 +11951,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if(data.success) {
                     toaster.pop('success', '提示', data.success);
                 }
-                $scope.tableParams.page(1);
+                // $scope.tableParams.page(1);
                 $scope.tableParams.reload();
             }, function(response) {
                 toaster.pop('error', '提示', response.data);
@@ -15426,7 +15461,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		 */
 		$scope.view = function(name) {
 			$rootScope.vendName = name;
-			window.location.hash = "#/baseInfo/myRquest";
+			window.location.hash = "#/baseInfo/newPartner";
 		}
 	}]);
     

+ 4 - 0
src/main/webapp/resources/js/index/services/BaseInfo.js

@@ -382,6 +382,10 @@ define(['ngResource'], function() {
 			reInvite: {
 				url: 'invitationrecord/reInvite/:id',
 				method: 'POST'
+			},
+			getRecordById: {
+                url: 'invitationrecord/record/:id',
+                method: 'GET'
 			}
 		})
 	}]);

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/newPartner.html

@@ -335,7 +335,7 @@
         </div>
     </div>
     <table class="order-table block" ng-table="tableParams">
-        <tbody ng-repeat="request in $data" class="company-list">
+        <tbody ng-repeat="request in $data | orderBy :'method'" class="company-list">
         <tr class="order-hd" ng-dblclick="order.$collapsed=!order.$collapsed" ng-class="{'text-bold': order.display>0}">
             <td colspan="4" style="position: relative;"><span ng-bind="request.vendName" class="margin-left20"></span><b class="new-dot" ng-if="request.statusCode==311 && request.method==0"></b><img src="static/img/logo/youruanrenzheng.png" id="logo" ng-if="enterprise.status == 313"></td>
             <td width="200" class="text-center">

+ 3 - 2
src/main/webapp/resources/tpl/index/baseInfo/searchresult.html

@@ -334,8 +334,9 @@
 			<td width="100" class="text-center">
 				<a class="btn btn-primary" ng-click="addPartner(enterprise.name,enterprise.businessCode)" ng-if="enterprise.requestStatus==null||enterprise.requestStatus==310">立即添加</a>
 				<span class="btn label-info btn-primary" ng-if="enterprise.requestStatus==311 && enterprise.method==0">已收到申请<br><a ng-click="view(enterprise.name)">立即查看</a></span>
-				<span class="btn01 btn label-info btn-primary" ng-if="enterprise.requestStatus==311 && enterprise.method==1">已发出申请<br><a ng-click="view(enterprise.name)">立即查看</a></span>
-				<span class="btn label-info" ng-if="enterprise.requestStatus==313">已添加</span>
+				<span class="btn01 label-info btn-primary" ng-if="enterprise.requestStatus==311 && enterprise.method==1">已发出申请</span>
+				<!-- <br><a ng-click="view(enterprise.name)">立即查看</a> -->
+				<span class="btn label-info" ng-if="enterprise.requestStatus==313">已添加<br><a ng-click="view(enterprise.name)">立即查看</a></span>
 			</td>
 		</tr>
 	</tbody>

+ 1 - 1
src/main/webapp/resources/tpl/index/cs/left.html

@@ -5,6 +5,6 @@
 	<ul class="list-unstyled">
 		<li><a href="{{userInfo.enterprise.enSaasUrl? 'http://' + userInfo.enterprise.enSaasUrl + '.saas.ubtob.com':'#/account/enterprise'}}" target="_blank">优企云服</a></li>
 		<li><a href="http://www.usoftmall.com/" target="_blank">电子元器件市场</a></li>
-		<li><a href="#/baseInfo/myRquest">企业圈</a></li>
+		<li><a href="#/baseInfo/myRequest">企业圈</a></li>
 	</ul>
 </div>