Browse Source

处理账户中心验证银行账号逻辑错误的问题。

yujia 7 years ago
parent
commit
8c305bb4f3

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

@@ -271,11 +271,11 @@ public class BankInfoController {
 	/**
 	 * 根据银行账号返回账户数
 	 * @param number 银行账号
-	 * @param type   类型,卖家、买家、平台
+	 * @param accountType   类型,卖家、买家、平台
 	 * @return
 	 */
 	@RequestMapping(value = "/number/count", method = RequestMethod.GET)
-	public ResultMap getCountByNumber(Integer type, String number){
-		return bankInfoService.getCountByNumber(type, number);
+	public ResultMap getCountByNumber(String accountType, String number){
+		return bankInfoService.getCountByNumber(accountType, number);
 	}
 }

+ 13 - 2
src/main/java/com/uas/platform/b2c/fa/payment/dao/BankInfoDao.java

@@ -125,8 +125,19 @@ public interface BankInfoDao extends CrudRepository<BankInfo, Long>, JpaSpecific
 	 * @param number
 	 * @return
 	 */
-	@Query("select count(b) from BankInfo b where b.enuu=:enuu and b.dissociative=:dissociative and b.status=:status and b.number=:number")
-	int getSupCountByNumberAndDissociative(@Param("enuu") Long enuu, @Param("dissociative") Integer dissociative, @Param("status") Integer status, @Param("number") String number);
+	@Query("select count(b) from BankInfo b where b.enuu=:enuu and b.dissociative=:dissociative and b.status=:status and b.number=:number and b.accountType =:accountType")
+	int getSupCountByNumberAndDissociative(@Param("enuu") Long enuu, @Param("dissociative") Integer dissociative, @Param("status") Integer status, @Param("number") String number, @Param("accountType") String accountType);
+
+	/**
+	 * 根据银行账号查询个人账号下的账户个数
+	 * @param useruu
+	 * @param dissociative
+	 * @param status
+	 * @param number
+	 * @return
+	 */
+	@Query("select count(b) from BankInfo b where b.enuu=:enuu and b.dissociative=:dissociative and b.status=:status and b.number=:number and b.accountType =:accountType")
+	int getBuyCountByNumberAndDissociative(@Param("enuu") Long useruu, @Param("dissociative") Integer dissociative, @Param("status") Integer status, @Param("number") String number, @Param("accountType") String accountType);
 
 	/**
 	 * 银行账户返回企业账户数

+ 2 - 4
src/main/java/com/uas/platform/b2c/fa/payment/service/BankInfoService.java

@@ -4,8 +4,6 @@ import com.uas.platform.b2c.common.base.model.FileUpload;
 import com.uas.platform.b2c.fa.payment.model.BankInfo;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageParams;
-import com.uas.platform.core.model.Status;
-import com.uas.platform.core.model.Type;
 import org.springframework.data.domain.Page;
 
 import java.util.List;
@@ -125,11 +123,11 @@ public interface BankInfoService {
 	/**
 	 * 根据银行账号返回账户数
 	 *
-	 * @param type
+	 * @param accountType
 	 * @param number
 	 * @return
 	 */
-	ResultMap getCountByNumber(Integer type, String number);
+	ResultMap getCountByNumber(String accountType, String number);
 
 	/**
 	 * 获取

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

@@ -359,8 +359,8 @@ public class BankInfoServiceImpl implements BankInfoService {
 	}
 
 	@Override
-	public ResultMap getCountByNumber(Integer type, String number) {
-		if (type != Type.MALL.value() && type != Type.BUYER.value() && type != Type.SUP.value()){
+	public ResultMap getCountByNumber(String accountType, String number) {
+		if (!AccountType.PAY_TYPE.equals(accountType)  && !AccountType.RECEIVE_TYPE.equals(accountType)){
 			return new ResultMap(CodeType.ERROR_STATE, "类型不存在,确认要查找账户的类型");
 		}
 		if (StringUtils.isEmpty(number)) {
@@ -368,10 +368,10 @@ public class BankInfoServiceImpl implements BankInfoService {
 		}
 		Integer count = null;
 		User user = SystemSession.getUser();
-		if (user.getEnterprise() != null) {
-			count = bankInfoDao.getSupCountByNumberAndDissociative(user.getEnterprise().getUu(), Type.ENTERPRISING.value(), Status.ALLOW.value(), number);
+		if (user.getEnterprise() == null) {
+			count = bankInfoDao.getBuyCountByNumberAndDissociative(user.getUserUU(), Type.PERSONAL.value(), Status.ALLOW.value(), number, accountType);
 		}else {
-			count = bankInfoDao.getBuyerCountByNumberAndDissociative(user.getUserUU(), Type.PERSONAL.value(), Status.ALLOW.value(), number);
+			count = bankInfoDao.getSupCountByNumberAndDissociative(user.getEnterprise().getUu(), Type.ENTERPRISING.value(), Status.ALLOW.value(), number, accountType);
 		}
 		return ResultMap.success(count);
 	}

BIN
src/main/resources/jxls-tpl/trade/products-error.xls


BIN
src/main/resources/jxls-tpl/trade/products.xls


BIN
src/main/resources/jxls-tpl/trade/releaseByBatch-rmb.xls