Browse Source

买卖家验收反馈处理

hulh 8 years ago
parent
commit
df7c8d3a3a

+ 23 - 0
src/main/java/com/uas/platform/b2c/fa/payment/controller/BankInfoController.java

@@ -58,6 +58,18 @@ public class BankInfoController {
 		return bankInfoService.getPersonBankInfo(params, Type.BUYER.value());
 	}
 
+	/**
+	 * @author yujia  获取买家企业银行账户
+	 *
+	 * @return list
+	 */
+	@RequestMapping(value="/buy/enterprise", method=RequestMethod.GET, params = {"status=104","type=buyer"})
+	@ApiOperation(value = "获取买家企业银行账户", httpMethod = "GET")
+	public List<BankInfo> getBuyerEnterprise() {
+		logger.log("银行账户信息", "获取企业银行账户信息");
+		return bankInfoService.getEnterpriseBankInfoContainsStatus(Type.BUYER.value(), Status.ALLOW.value());
+	}
+
 	/**
 	 * 2016年9月8日 下午9:19:05
 	 * 删除指定的银行账户
@@ -247,4 +259,15 @@ public class BankInfoController {
 		logger.log("银行账户信息", "审核银行账户为id:" + id  + "通过");
 		return resultMap;
 	}
+
+	/**
+	 * 根据银行账号返回账户数
+	 * @param number 银行账号
+	 * @param type   类型,卖家、买家、平台
+	 * @return
+	 */
+	@RequestMapping(value = "/number/count", method = RequestMethod.GET)
+	public ResultMap getCountByNumber(Integer type, String number){
+		return bankInfoService.getCountByNumber(type, number);
+	}
 }

+ 31 - 6
src/main/java/com/uas/platform/b2c/fa/payment/dao/BankInfoDao.java

@@ -41,12 +41,11 @@ public interface BankInfoDao extends CrudRepository<BankInfo, Long>, JpaSpecific
 	/**
 	 * 根据下面参数获取企业账户信息
 	 * @param enuu 企业的enuu
-	 * @param type 企业的类型
 	 * @param opraterUserType 所属类型 买家 卖家,平台
 	 * @return list
 	 */
-	@Query(value = "select b from BankInfo b where b.enuu =:enuu and b.type =:type and b.opraterUserType=:opraterUserType order by num")
-	List<BankInfo> findByEnuuAndTypeAndOpraterUserTypeOrderByNumAsc(@Param("enuu") Long enuu, @Param("type") Short type, @Param("opraterUserType") Integer opraterUserType);
+	@Query(value = "select b from BankInfo b where b.enuu =:enuu and b.opraterUserType=:opraterUserType order by num")
+	List<BankInfo> findByEnuuAndTypeAndOpraterUserTypeOrderByNumAsc(@Param("enuu") Long enuu, @Param("opraterUserType") Integer opraterUserType);
 
 	/**
 	 * 根据下面参数获取企业账户信息
@@ -105,13 +104,39 @@ public interface BankInfoDao extends CrudRepository<BankInfo, Long>, JpaSpecific
 	int getCountByEnuuAndStatus(@Param("enuu") Long enuu, @Param("operateUserType") Integer operateUserType, @Param("status") List<Integer> status);
 
 	/**
-	 * 返回已启用的账户信息
-	 *
+	 * 根据银行账号查询个人账号下的账户个数
+	 * @param useruu
+	 * @param enuu
+	 * @param opraterUserType
+	 * @param status
+	 * @param number
+	 * @return
+	 */
+	@Query("select count(b) from BankInfo b where b.useruu=:useruu and b.enuu=:enuu and b.opraterUserType=:opraterUserType and b.status=:status and b.number=:number")
+	int getBuyerCountByNumberAndEnuu(@Param("useruu") Long useruu, @Param("enuu") Long enuu, @Param("opraterUserType") Integer opraterUserType, @Param("status") Integer status, @Param("number") String number);
+
+	/**
+	 * 根据银行账号查询个人账号下的账户个数
+	 * @param useruu
+	 * @param dissociative
+	 * @param status
+	 * @param number
+	 * @return
+	 */
+	@Query("select count(b) from BankInfo b where b.useruu=:useruu and b.dissociative=:dissociative and b.opraterUserType=:opraterUserType and b.status=:status and b.number=:number")
+	int getBuyerCountByNumberAndDissociative(@Param("useruu") Long useruu, @Param("dissociative") Integer dissociative, @Param("opraterUserType") Integer opraterUserType,
+											 @Param("status") Integer status, @Param("number") String number);
+
+	/**
+	 * 银行账户返回企业账户数
 	 * @param enuu
 	 * @param opraterUserType
 	 * @param status
+	 * @param number
 	 * @return
 	 */
-	List<BankInfo> findByEnuuAndStatusAndOpraterUserTypeOrderByNumAsc(Long enuu, Integer opraterUserType, Integer status);
+	@Query("select count(b) from BankInfo b where b.enuu=:enuu and b.opraterUserType=:opraterUserType and b.status in :status and b.number=:number")
+	int getEnterpriseCountByNumberAndEnuu(@Param("enuu") Long enuu, @Param("opraterUserType") Integer opraterUserType,
+									 @Param("status") List<Integer> status, @Param("number") String number);
 
 }

+ 9 - 0
src/main/java/com/uas/platform/b2c/fa/payment/service/BankInfoService.java

@@ -139,4 +139,13 @@ public interface BankInfoService {
 	 * @return ResultMap
 	 */
 	ResultMap auditBankInfo(Long id, Integer status, String... str);
+
+	/**
+	 * 根据银行账号返回账户数
+	 *
+	 * @param type
+	 * @param number
+	 * @return
+	 */
+	ResultMap getCountByNumber(Integer type, String number);
 }

+ 25 - 0
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/BankInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.fa.payment.service.impl;
 
+import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.base.model.FileUpload;
 import com.uas.platform.b2c.common.base.service.FileService;
 import com.uas.platform.b2c.core.config.SysConf;
@@ -389,4 +390,28 @@ public class BankInfoServiceImpl implements BankInfoService {
 		}
 		return ResultMap.success(bankInfo);
 	}
+
+	@Override
+	public ResultMap getCountByNumber(Integer type, String number) {
+		if (type != Type.MALL.value() && type != Type.BUYER.value() && type != Type.MALL.value()){
+			return new ResultMap(CodeType.ERROR_STATE, "类型不存在,确认要查找账户的类型");
+		}
+		if (StringUtils.isEmpty(number)){
+			return new ResultMap(CodeType.NO_INFO, "银行账号丢失或为空,请确认银行账号");
+		}
+		Integer count = null;
+		if (type == Type.BUYER.value()){
+			Enterprise enterprise = SystemSession.getUser().getEnterprise();
+			if (enterprise != null){
+				count = bankInfoDao.getBuyerCountByNumberAndEnuu(SystemSession.getUser().getUserUU(), enterprise.getUu(),
+						Type.BUYER.value(), Status.ALLOW.value(), number);
+			}else {
+				count = bankInfoDao.getBuyerCountByNumberAndDissociative(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(),
+						Type.BUYER.value(), Status.ALLOW.value(), number);
+			}
+		}else {
+			count = bankInfoDao.getEnterpriseCountByNumberAndEnuu(SystemSession.getUser().getEnterprise().getUu(), type, statusList, number);
+		}
+		return ResultMap.success(count);
+	}
 }

+ 0 - 3
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -1,10 +1,7 @@
 package com.uas.platform.b2c.trade.order.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.sun.org.apache.xpath.internal.operations.Bool;
-import com.sun.org.apache.xpath.internal.operations.Or;
 import com.uas.api.b2c_erp.buyer.model.B2cOrder;
 import com.uas.api.exception.B2CException;
 import com.uas.platform.b2c.common.account.dao.EnterpriseDao;

+ 4 - 1
src/main/webapp/resources/js/common/query/bankInfo.js

@@ -44,7 +44,10 @@ define(['ngResource'], function(ngResource) {
 					status : 104
 				}
 			},
-			
+			getCountByNumber : {
+				url : 'trade/bankInfo/number/count',
+				method: 'GET'
+			},
 			deleteBank : {
 				url : 'trade/bankInfo/delete/:id',
 				method : 'DELETE'

+ 21 - 2
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_pay_ctrl.js

@@ -3,17 +3,21 @@
  */
 define(['app/app'], function(app) {
 	'use strict';
-	app.register.controller('BuyerPayCtrl', ['$scope', '$rootScope', 'ngTableParams', 'BaseService', 'bankInfoService', '$filter', '$modal', 'toaster', 'OrderSimpleInfo', 'Loading', function($scope, $rootScope, ngTableParams, BaseService, bankInfoService, $filter, $modal, toaster, OrderSimpleInfo, Loading) {
+	app.register.controller('BuyerPayCtrl', ['$scope', '$rootScope', 'ngTableParams', 'BaseService', 'bankInfoService', '$filter', 'SessionService', '$modal', 'toaster', 'OrderSimpleInfo', 'Loading', function($scope, $rootScope, ngTableParams, BaseService, bankInfoService, $filter, SessionService, $modal, toaster, OrderSimpleInfo, Loading) {
 		$rootScope.active = 'pay_center';
 
 		var hideBankFilter = $filter("hideBankFilter");
 
-		$scope.status = 'pay-history';
+		//历史记录的状态
+		var hiStatus= SessionService.get('buyCenter');
+
+		$scope.status = hiStatus == null ? 'pay-info' : hiStatus;
 
 		//切换银行账户信息,历史记录的的的状态
 		$scope.toggleStatus = function(status) {
 			if($scope.status != status) {
 				$scope.status = status;
+				SessionService.set('paycenter', status);
 				loadData();
 			}
 		};
@@ -589,6 +593,7 @@ define(['app/app'], function(app) {
 					}else {
 						$scope.numberPattError = true;
 					}
+					validateRepeat($scope.account.number);
 				}
 			}else if(num == 4){
 				//验证开户名称
@@ -603,6 +608,20 @@ define(['app/app'], function(app) {
 			}
 		};
 
+		var validateRepeat = function (number) {
+			bankInfoService.getCountByNumber({type:1062,number:number}, {}, function (data) {
+				if (data.success){
+					if (data.data != 0){
+						$scope.repeatError = true;
+					}else {
+						$scope.repeatError = false;
+					}
+				}else {
+					toaster.pop("info", data.message);
+				}
+			});
+		};
+
 		$scope.confirm = function() {
 			var account = $scope.account;
 

+ 22 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_pay_ctrl.js

@@ -6,15 +6,19 @@
  */
 define(['app/app'], function(app) {
     'use strict';
-    app.register.controller('VendorPayCtrl', ['$scope', '$rootScope', 'bankInfoService', 'Loading', 'toaster', '$upload', 'ngTableParams', 'BaseService', 'bankTransferService', 'Purchase', '$filter', function($scope, $rootScope, bankInfoService, Loading, toaster, $upload, ngTableParams, BaseService, bankTransferService, Purchase, $filter) {
+    app.register.controller('VendorPayCtrl', ['$scope', '$rootScope', 'bankInfoService', 'Loading', 'toaster', '$upload', 'ngTableParams', 'BaseService', 'SessionService', 'bankTransferService', 'Purchase', '$filter', function($scope, $rootScope, bankInfoService, Loading, toaster, $upload, ngTableParams, BaseService, SessionService, bankTransferService, Purchase, $filter) {
         $rootScope.active = 'pay_center';
 
         // 加密订单的ID过滤器
         var enIdFilter = $filter('EncryptionFilter');
 
+        //历史记录的状态
+        var hiStatus= SessionService.get('vendorCenter');
+
         $scope.$payCenter = {};
         $scope.param = {};
-        $scope.tab = "paymentRecord";
+
+        $scope.tab = hiStatus == null ? 'paymentRecord' : hiStatus;
         $scope.$$bankInfo = {};
 
         $scope.paytype = 'ALL';
@@ -131,6 +135,7 @@ define(['app/app'], function(app) {
         $scope.setTab = function (tab) {
             if($scope.tab !== tab) {
                 $scope.tab = tab;
+                SessionService.set('vendorCenter', tab);
                 loadData();
             }
         };
@@ -291,6 +296,7 @@ define(['app/app'], function(app) {
                     }else {
                         $scope.numberPattError = true;
                     }
+                    validateRepeat($scope.account.number);
                 }
             }else if(num == 4){
                 //验证开户名称
@@ -305,6 +311,20 @@ define(['app/app'], function(app) {
             }
         };
 
+        var validateRepeat = function (number) {
+            bankInfoService.getCountByNumber({type:1062,number:number}, {}, function (data) {
+                if (data.success){
+                    if (data.data != 0){
+                        $scope.repeatError = true;
+                    }else {
+                        $scope.repeatError = false;
+                    }
+                }else {
+                    toaster.pop("info", data.message);
+                }
+            });
+        };
+
         $scope.reuseAccount = function (item) {
             $scope.showReuseFrame = true;
             $scope.reuseObject = item;

+ 2 - 1
src/main/webapp/resources/view/common/bankInfoModal.html

@@ -102,10 +102,11 @@
 		  		<label class="margin15"><b class="text-inverse">*&nbsp;</b>银行账号</label>
 		  		<div class="divinline">
 		  			<input name="number" ng-model="account.number" type="text" class="form-control" 
-		  			placeholder="请填写银行账号" ng-required="true" ng-change="checkAccount(3)">
+		  			placeholder="请填写银行账号" ng-required="true" ng-change="checkAccount(3)" autocomplete="off">
 		  		</div>
 				<span class="warn-message" ng-if="account.number && numberPattError">请填写正确的银行账号</span>
 				<span class="warn-message" ng-if="account.number && !numberPattError && numberError">请勿超过30个字符</span>
+				<span class="warn-message" ng-if="account.number && !numberPattError && !numberError" && repeatError>该银行账号已存在</span>
 				<span class="warn-message" ng-if="myForm.number.$touched && myForm.number.$invalid">银行账号不能为空</span>
 		  	</div>
 			<div class="form-group">

+ 1 - 0
src/main/webapp/resources/view/vendor/forstore/pay_center.html

@@ -823,6 +823,7 @@
                 <div class="col-md-4">
                     <p ng-if="account.number && numberPattError">请填写正确的银行账号</p>
                     <p ng-if="account.number && !numberPattError && numberError">请勿超过30个字符</p>
+                    <p ng-if="account.number && !numberPattError && !numberError" && repeatError>该银行账号已存在</p>
                     <p ng-if="myForm.number.$touched && myForm.number.$invalid">银行账号不能为空</p>
                 </div>
             </div>