Browse Source

调整收单接口的返回值

yujia 8 years ago
parent
commit
7f6f1af831

+ 15 - 0
src/main/java/com/uas/platform/b2c/fa/payment/constant/PingAnField.java

@@ -66,4 +66,19 @@ public class PingAnField {
      * 验证码
      * 验证码
      */
      */
     public static final String VERIFYCODE = "verifyCode";
     public static final String VERIFYCODE = "verifyCode";
+
+    /**
+     * B2B 支付还是 B2C 支付
+     */
+    public static final String PAYTYPE = "payType";
+
+    /**
+     * 银行代码
+     */
+    public static final String ISSINSCODE = "issInsCode";
+
+    /**
+     * 网关支付的银行卡类型 02 贷记卡 或 01 借记卡
+     */
+    public static final String PAYCARDTYPE = "payCardType";
 }
 }

+ 10 - 0
src/main/java/com/uas/platform/b2c/fa/payment/constant/PingAnRequestUrlPostfix.java

@@ -71,4 +71,14 @@ public class PingAnRequestUrlPostfix {
      * 查询银联绑卡的信息访问地址
      * 查询银联绑卡的信息访问地址
      */
      */
     public static final String QUERYBINDCARD = "/UnionPay/bindCard/query";
     public static final String QUERYBINDCARD = "/UnionPay/bindCard/query";
+
+    /**
+     * 银联支付的短信接口
+     */
+    public static final String KHPAYSMS = "/UnionPay/sms";
+
+    /**
+     * 快捷支付的接口
+     */
+    public static final String KHPAY = "/UnionPay/pay";
 }
 }

+ 20 - 0
src/main/java/com/uas/platform/b2c/fa/payment/constant/StringConstant.java

@@ -26,4 +26,24 @@ public class StringConstant {
      * 最小值
      * 最小值
      */
      */
     public static final String MIN_POSITIVE_INTEGER = "1";
     public static final String MIN_POSITIVE_INTEGER = "1";
+
+    /**
+     * 网关支付的 B2C 支付
+     */
+    public static final String EBANK_B2C_PAY = "02";
+
+    /**
+     * 网关支付的B2B 支付
+     */
+    public static final String EBANK_B2B_PAY = "01";
+
+    /**
+     * 贷记卡
+     */
+    public static final String CREDIT_CARD = "02";
+
+    /**
+     * 借记卡
+     */
+    public static final String DEBIT_CARD = "01";
 }
 }

+ 14 - 13
src/main/java/com/uas/platform/b2c/fa/payment/controller/BankReceiptsController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
 
 
 /**
 /**
  * 银行收单接口
  * 银行收单接口
@@ -43,10 +44,10 @@ public class BankReceiptsController {
      */
      */
     @RequestMapping(value = "/unionPay/pay/bindCard", method = RequestMethod.GET)
     @RequestMapping(value = "/unionPay/pay/bindCard", method = RequestMethod.GET)
     public ResponseEntity<String> bindCard(Boolean isPersonal) {
     public ResponseEntity<String> bindCard(Boolean isPersonal) {
-        String str = bankReceiptsService.bindCard(isPersonal);
+        String message = bankReceiptsService.bindCard(isPersonal);
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
         headers.set("Content-Type", "text/html;charset=utf-8");
         headers.set("Content-Type", "text/html;charset=utf-8");
-        ResponseEntity<String> entity = ResponseEntity.ok().headers(headers).body(str);
+        ResponseEntity<String> entity = ResponseEntity.ok().headers(headers).body(message);
         logger.log("平安支付控制器", "支付绑卡", "支付时的绑卡");
         logger.log("平安支付控制器", "支付绑卡", "支付时的绑卡");
         return entity;
         return entity;
     }
     }
@@ -68,26 +69,26 @@ public class BankReceiptsController {
     /**
     /**
      * 微信预支付的接口,银联快捷支付的短信接口
      * 微信预支付的接口,银联快捷支付的短信接口
      *
      *
-     * @param json 传入的数据
+     * @param map 传入的数据
      *            currency 币别 RMB 3个字符
      *            currency 币别 RMB 3个字符
      *            amount 金额 12整数,2位小数
      *            amount 金额 12整数,2位小数
      *            objectName 订单款项描述 200 字符
      *            objectName 订单款项描述 200 字符
-     *            openid openid跟customerid一直,绑卡时返回过来openid
+     *            Openid openid跟customerid一直,绑卡时返回过来Openid
      *            remark 字段 描述  否
      *            remark 字段 描述  否
      * @return
      * @return
      */
      */
     @RequestMapping(value = "/unionPay/sms", method = RequestMethod.POST)
     @RequestMapping(value = "/unionPay/sms", method = RequestMethod.POST)
-    public String khPaySMS(Boolean isPersonal, @RequestBody JSONObject json) {
-        String khPaySMS = bankReceiptsService.khPaySMS(json, isPersonal);
+    public String khPaySMS(Boolean isPersonal, @RequestBody HashMap<String, String> map) {
+        String khPaySMS = bankReceiptsService.khPaySMS(map, isPersonal);
         logger.log("平安支付控制器", "跨行支付绑卡", "快捷支付发送短信");
         logger.log("平安支付控制器", "跨行支付绑卡", "快捷支付发送短信");
-        return json.toString();
+        return khPaySMS;
     }
     }
 
 
     /**
     /**
      * 提交
      * 提交
      *
      *
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
-     * @param json 提交的json 数据
+     * @param ) 提交的json 数据
      *    orderId 支付的流水号必须和发送短信的接口一致
      *    orderId 支付的流水号必须和发送短信的接口一致
      *    paydate 支付的时间,必须与获取短信的时间一致
      *    paydate 支付的时间,必须与获取短信的时间一致
      *    opendid 银行卡的开户行id 在查询的时候就会把信息带过去
      *    opendid 银行卡的开户行id 在查询的时候就会把信息带过去
@@ -100,8 +101,8 @@ public class BankReceiptsController {
      * @return 返回String
      * @return 返回String
      */
      */
     @RequestMapping(value = "/unionPay/pay", method = RequestMethod.POST)
     @RequestMapping(value = "/unionPay/pay", method = RequestMethod.POST)
-    public String khPay(Boolean isPersonal, @RequestBody JSONObject json) {
-        String pay = bankReceiptsService.khPay(json, isPersonal);
+    public ResultMap khPay(Boolean isPersonal, @RequestBody HashMap<String, String> map) {
+        ResultMap pay = bankReceiptsService.khPay(map, isPersonal);
         logger.log("平安支付控制器", "跨行支付绑卡", "快捷支付支付接口");
         logger.log("平安支付控制器", "跨行支付绑卡", "快捷支付支付接口");
         return pay;
         return pay;
     }
     }
@@ -109,13 +110,13 @@ public class BankReceiptsController {
     /**
     /**
      * 网关支付接口
      * 网关支付接口
      *
      *
-     * @param object
+     * @param map 需要传入的支付信息
      * @param isPersonal  是否是个人
      * @param isPersonal  是否是个人
      * @return
      * @return
      */
      */
     @RequestMapping(value = "/EBank/pay", method = RequestMethod.POST)
     @RequestMapping(value = "/EBank/pay", method = RequestMethod.POST)
-    public String eBankPay(Boolean isPersonal, @RequestBody JSONObject object) {
-        return bankReceiptsService.eBankPay(object, isPersonal);
+    public ResultMap eBankPay(Boolean isPersonal, @RequestBody HashMap<String, String> map) {
+        return bankReceiptsService.eBankPay(map, isPersonal);
     }
     }
 
 
 
 

+ 8 - 2
src/main/java/com/uas/platform/b2c/fa/payment/controller/PingAnAccountController.java

@@ -3,10 +3,13 @@ package com.uas.platform.b2c.fa.payment.controller;
 import com.uas.platform.b2c.fa.payment.service.PingAnAccountService;
 import com.uas.platform.b2c.fa.payment.service.PingAnAccountService;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.util.HashMap;
+
 /**
 /**
  * 平安账户的接口
  * 平安账户的接口
  *
  *
@@ -27,11 +30,14 @@ public class PingAnAccountController {
      * 开户功能
      * 开户功能
      *
      *
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
+     * @param map CustProperty 子账户的属性
+     *            {"NickName" : "lilei", "MobilePhone": "15989329613", "Email": "506814162@qq.com", "CustProperty": 00}
+     *            CustProperty 00 普通子账户  SH 商户子账户
      * @return
      * @return
      */
      */
     @RequestMapping(value = "/open", method = RequestMethod.POST)
     @RequestMapping(value = "/open", method = RequestMethod.POST)
-    public ResultMap openAccount(Boolean isPersonal) {
-        return pingAnAccountService.openAccount(isPersonal);
+    public ResultMap openAccount(Boolean isPersonal, @RequestBody HashMap<String, String> map) {
+        return pingAnAccountService.openAccount(isPersonal, map);
     }
     }
 
 
     /**
     /**

+ 11 - 8
src/main/java/com/uas/platform/b2c/fa/payment/service/BankReceiptsService.java

@@ -3,6 +3,8 @@ package com.uas.platform.b2c.fa.payment.service;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.b2c.trade.support.ResultMap;
 
 
+import java.util.HashMap;
+
 /**
 /**
  * 平安的facade层
  * 平安的facade层
  *
  *
@@ -14,6 +16,7 @@ public interface BankReceiptsService {
      * 绑卡动作
      * 绑卡动作
      *
      *
      * @param isPersonal 是否是个人账户
      * @param isPersonal 是否是个人账户
+     * @return String;
      */
      */
     String bindCard(Boolean isPersonal);
     String bindCard(Boolean isPersonal);
 
 
@@ -28,30 +31,30 @@ public interface BankReceiptsService {
     /**
     /**
      * 银联快捷支付 获取短信验证码的信息
      * 银联快捷支付 获取短信验证码的信息
      *
      *
-     * @param json 传入的支付信息
+     * @param map 传入的支付信息
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
      * @return String
      * @return String
      */
      */
-    String khPaySMS(JSONObject json, Boolean isPersonal);
+    String khPaySMS(HashMap<String, String> map, Boolean isPersonal);
 
 
     /**
     /**
      * 传入的数据
      * 传入的数据
      *
      *
-     * @param json json 交易的信息
+     * @param map json 交易的信息
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
-     * @return String
+     * @return ResultMap
      */
      */
-    String khPay(JSONObject json, Boolean isPersonal);
+    ResultMap khPay(HashMap<String, String> map, Boolean isPersonal);
 
 
 
 
     /**
     /**
      * 网关支付接口
      * 网关支付接口
      *
      *
-     * @param json 传入的数据
+     * @param map 传入的数据
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
-     * @return
+     * @return ResultMap
      */
      */
-    String eBankPay(JSONObject json, Boolean isPersonal);
+    ResultMap eBankPay(HashMap<String, String> map, Boolean isPersonal);
 
 
 
 
     /**
     /**

+ 6 - 2
src/main/java/com/uas/platform/b2c/fa/payment/service/PingAnAccountService.java

@@ -2,6 +2,8 @@ package com.uas.platform.b2c.fa.payment.service;
 
 
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.b2c.trade.support.ResultMap;
 
 
+import java.util.HashMap;
+
 /**
 /**
  * 平安账户的接口
  * 平安账户的接口
  *
  *
@@ -10,11 +12,13 @@ import com.uas.platform.b2c.trade.support.ResultMap;
 public interface PingAnAccountService {
 public interface PingAnAccountService {
 
 
     /**
     /**
-     * 开户的
+     * 开户功能
+     *
      * @param isPersonal
      * @param isPersonal
+     * @param map 传入的电话信息和邮件信息
      * @return ResultMap
      * @return ResultMap
      */
      */
-    ResultMap openAccount(Boolean isPersonal);
+    ResultMap openAccount(Boolean isPersonal, HashMap<String, String> map);
 
 
 
 
     /**
     /**

+ 98 - 69
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/BankReceiptsServiceImpl.java

@@ -7,7 +7,9 @@ import com.uas.platform.b2c.fa.payment.constant.PingAnRequestUrlPostfix;
 import com.uas.platform.b2c.fa.payment.constant.StringConstant;
 import com.uas.platform.b2c.fa.payment.constant.StringConstant;
 import com.uas.platform.b2c.fa.payment.service.BankReceiptsService;
 import com.uas.platform.b2c.fa.payment.service.BankReceiptsService;
 import com.uas.platform.b2c.fa.payment.support.UserInfoSupport;
 import com.uas.platform.b2c.fa.payment.support.UserInfoSupport;
+import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import org.apache.commons.collections.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
@@ -46,7 +48,11 @@ public class BankReceiptsServiceImpl implements BankReceiptsService {
     public String bindCard(Boolean isPersonal) {
     public String bindCard(Boolean isPersonal) {
         Map<String, String> map = userInfoSupport.getUserInfoMap(isPersonal);
         Map<String, String> map = userInfoSupport.getUserInfoMap(isPersonal);
         ResultMap resultMap = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.BINDCARD, map, ResultMap.class);
         ResultMap resultMap = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.BINDCARD, map, ResultMap.class);
-        return resultMap.getMessage();
+        if (resultMap.getCode() == CodeType.OK.code()) {
+            return resultMap.getData().toString();
+        } else {
+            return resultMap.getMessage();
+        }
     }
     }
 
 
     /**
     /**
@@ -66,40 +72,31 @@ public class BankReceiptsServiceImpl implements BankReceiptsService {
     /**
     /**
      * 银联快捷支付 获取短信验证码的信息
      * 银联快捷支付 获取短信验证码的信息
      *
      *
-     * @param json 传入的支付信息
+     * @param map 传入的支付信息
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
      * @return String
      * @return String
      */
      */
     @Override
     @Override
-    public String khPaySMS(JSONObject json, Boolean isPersonal) {
-        HashMap<String, String> map = new HashMap<>();
-        if ((json == null) || json.size() == 0) {
-            map.put(PingAnField.AMOUNT, "10");
-            map.put(PingAnField.CURRENCY, "RMB");
-            map.put(PingAnField.OBJECTNAME, "test");
-            map.put(PingAnField.OPENID, "20007991842018011032103750");
+    public String khPaySMS(HashMap<String, String> map, Boolean isPersonal) {
+        if (MapUtils.isEmpty(map)) {
+            throw new IllegalArgumentException("传入的交易信息为空");
         } else {
         } else {
-            String amount = json.getString(PingAnField.AMOUNT);
+            String amount = map.get(PingAnField.AMOUNT);
             if (StringUtils.isEmpty(amount)) {
             if (StringUtils.isEmpty(amount)) {
                 throw new IllegalArgumentException("传入的金额合计为空");
                 throw new IllegalArgumentException("传入的金额合计为空");
             }
             }
-            map.put(PingAnField.AMOUNT, amount);
-
-            String currency = json.getString(PingAnField.CURRENCY);
-            if (StringUtils.isEmpty(currency)) {
-                currency = StringConstant.RMB_String;
+            String currency = map.get(PingAnField.CURRENCY);
+            if (StringUtils.isEmpty(currency) || !StringConstant.RMB_String.equals(currency)) {
+                throw new IllegalArgumentException("支付币别类型为空或部位人民币");
+            }
+            String OpenId = map.get(PingAnField.OPENID);
+            if (StringUtils.isEmpty(OpenId)) {
+                throw new IllegalArgumentException("传入的银行编号为空");
             }
             }
-            map.put(PingAnField.CURRENCY, currency);
-
-            String objectName = json.getString(PingAnField.OBJECTNAME);
-            map.put(PingAnField.OBJECTNAME, objectName == null ? "" : objectName);
-            //绑卡之后,会从银联返回一个OpenId;
-            map.put(PingAnField.OPENID, "20003111462017122041072723");
         }
         }
-        isPersonal = true;
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
         infoMap.putAll(map);
         infoMap.putAll(map);
-        String resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + "/UnionPay/sms", infoMap, String.class);
+        String resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.KHPAYSMS, infoMap, String.class);
         System.out.println(resultStr);
         System.out.println(resultStr);
         return resultStr;
         return resultStr;
     }
     }
@@ -107,58 +104,51 @@ public class BankReceiptsServiceImpl implements BankReceiptsService {
     /**
     /**
      * 传入的数据
      * 传入的数据
      *
      *
-     * @param json       json 交易的信息
+     * @param map       json 交易的信息
      * @param isPersonal 是否是个人
      * @param isPersonal 是否是个人
-     * @return String
+     * @return ResultMap
      */
      */
     @Override
     @Override
-    public String khPay(JSONObject json, Boolean isPersonal) {
-        HashMap<String, String> map = new HashMap<>();
+    public ResultMap khPay(HashMap<String, String> map, Boolean isPersonal) {
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
-        if ((json != null) && (json.size() != 0)) {
-            String orderid = json.getString(PingAnField.ORDERID);
+        if (MapUtils.isEmpty(map)) {
+            throw new IllegalArgumentException("传入的交易信息为空");
+        } else {
+            String orderid = map.get(PingAnField.ORDERID);
             if (StringUtils.isEmpty(orderid)) {
             if (StringUtils.isEmpty(orderid)) {
                 throw new IllegalArgumentException("传入的支付流水号为空");
                 throw new IllegalArgumentException("传入的支付流水号为空");
             }
             }
-            map.put(PingAnField.ORDERID, orderid);
-            String payDate = json.getString(PingAnField.PAYDATE);
+            String payDate = map.get(PingAnField.PAYDATE);
             if (StringUtils.isEmpty(payDate)) {
             if (StringUtils.isEmpty(payDate)) {
                 throw new IllegalArgumentException("传入的支付时间为空");
                 throw new IllegalArgumentException("传入的支付时间为空");
             }
             }
-            map.put(PingAnField.PAYDATE, payDate);
 
 
-            String amout = json.getString(PingAnField.AMOUNT);
+            String amout = map.get(PingAnField.AMOUNT);
             if (StringUtils.isEmpty(amout)) {
             if (StringUtils.isEmpty(amout)) {
                 throw new IllegalArgumentException("传入的支付金额为空");
                 throw new IllegalArgumentException("传入的支付金额为空");
             }
             }
-            map.put(PingAnField.AMOUNT, amout);
 
 
-            String objName = json.getString(PingAnField.OBJECTNAME);
-            if (StringUtils.isEmpty(objName)) {
-                objName = StringConstant.EMPTY_STRING;
-            }
-            map.put(PingAnField.OBJECTNAME, objName);
-
-            String verifyCode = json.getString(PingAnField.VERIFYCODE);
+            String verifyCode = map.get(PingAnField.VERIFYCODE);
             if (StringUtils.isEmpty(verifyCode)) {
             if (StringUtils.isEmpty(verifyCode)) {
                 throw new IllegalArgumentException("传入的动态验证码为空");
                 throw new IllegalArgumentException("传入的动态验证码为空");
             }
             }
-            map.put(PingAnField.VERIFYCODE, verifyCode);
-        } else {
+
             map.putAll(infoMap);
             map.putAll(infoMap);
-            map.put(PingAnField.ORDERID, "200079918420180115W2DYA220");
-            map.put(PingAnField.CURRENCY, "RMB");
-            map.put("amount", "10.00");
-            map.put("paydate", "20180115220144");
-            map.put("customerId", "19901120");
-            map.put("verifyCode", "111111");
-            map.put("issInsCode", "HXB");
-            map.put("objectName", "付款");
-            map.put("OpenId", "20007991842018011032103750");
-            map.put("payCardType", "01");
         }
         }
 
 
-        String resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + "/UnionPay/pay", map, String.class);
+//            map.putAll(infoMap);
+//            map.put(PingAnField.ORDERID, "200079918420180115W2DYA220");
+//            map.put(PingAnField.CURRENCY, "RMB");
+//            map.put("amount", "10.00");
+//            map.put("paydate", "20180115220144");
+//            map.put("customerId", "19901120");
+//            map.put("verifyCode", "111111");
+//            map.put("issInsCode", "HXB");
+//            map.put("objectName", "付款");
+//            map.put("OpenId", "20007991842018011032103750");
+//            map.put("payCardType", "01");
+
+        ResultMap resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.KHPAY, map, ResultMap.class);
         System.out.println(resultStr);
         System.out.println(resultStr);
         /*
         /*
              *    orderId 支付的流水号必须和发送短信的接口一致
              *    orderId 支付的流水号必须和发送短信的接口一致
@@ -178,27 +168,66 @@ public class BankReceiptsServiceImpl implements BankReceiptsService {
     /**
     /**
      * 网关支付接口
      * 网关支付接口
      *
      *
-     * @param json
+     * @param map 需要支付的数据
+     * @param isPersonal  是否是个人用户
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public String eBankPay(JSONObject json, Boolean isPersonal) {
-        HashMap<String, String> map = new HashMap<>();
+    public ResultMap eBankPay(HashMap<String, String> map, Boolean isPersonal) {
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
         Map<String, String> infoMap = userInfoSupport.getUserInfoMap(isPersonal);
-        if (json == null || json.size() == 0) {
-            map.putAll(infoMap);
-            map.put("currency", "RMB");
-            map.put("amount", "11.00");
-            map.put("objectName", "测试");
-//            map.put("payType", "02");
-//            map.put("issInsCode", "CZSB");
-//            map.put("payCardType", "01");
-            map.put("payType", "01");
-            map.put("issInsCode", "PSBC");
+        if (MapUtils.isEmpty(map)) {
+            throw new IllegalArgumentException("传入的交易信息为空");
         } else {
         } else {
-            //TODO
+            String amount = map.get(PingAnField.AMOUNT);
+            if (StringUtils.isEmpty(amount)) {
+                throw new IllegalArgumentException("传入的金额合计为空");
+            }
+            String currency = map.get(PingAnField.CURRENCY);
+            if (StringUtils.isEmpty(currency) || !StringConstant.RMB_String.equals(currency)) {
+                throw new IllegalArgumentException("支付币别类型为空或部位人民币");
+            }
+            String OpenId = map.get(PingAnField.OPENID);
+            if (StringUtils.isEmpty(OpenId)) {
+                throw new IllegalArgumentException("传入的银行编号为空");
+            }
+            String payType = map.get(PingAnField.PAYTYPE);
+            if (StringUtils.isEmpty(payType)) {
+                throw new IllegalArgumentException("支付方式为空");
+            } else if (!StringConstant.EBANK_B2B_PAY.equals(payType) && StringConstant.EBANK_B2C_PAY.equals(payType)) {
+                throw new IllegalArgumentException("支付方式只能为B2C支付或B2B支付");
+            }
+
+            String issInsCode = map.get(PingAnField.ISSINSCODE);
+            if (StringUtils.isEmpty(issInsCode)) {
+                throw new IllegalArgumentException("银行代码为空");
+            }
+
+            String payCardType = map.get(PingAnField.PAYCARDTYPE);
+            if (StringConstant.EBANK_B2C_PAY.equals(payType)) {
+                if (StringUtils.isEmpty(payCardType)) {
+                    throw new IllegalArgumentException("支付的银行卡类型为空");
+                } else if(!StringConstant.CREDIT_CARD.equals(payCardType) && !StringConstant.DEBIT_CARD.equals(payCardType)){
+                    throw new IllegalArgumentException("B2C支付方式下,只能选择通过借记卡或者贷记卡");
+                }
+            }
+
+            map.putAll(infoMap);
         }
         }
-        String loadHtml = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.EBANKPAY, map, String.class);
+//        if (json == null || json.size() == 0) {
+//            map.putAll(infoMap);
+//            map.put("currency", "RMB");
+//            map.put("amount", "11.00");
+//            map.put("objectName", "测试");
+            // b2c 支付时 必须选择银行卡类型
+            ////            map.put("payType", "02");
+            ////            map.put("issInsCode", "CZSB");
+            ////            map.put("payCardType", "01");
+//            map.put("payType", "01");
+//            map.put("issInsCode", "PSBC");
+//        } else {
+//            //TODO
+//        }
+        ResultMap loadHtml = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.EBANKPAY, map, ResultMap.class);
         return loadHtml;
         return loadHtml;
     }
     }
 
 

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

@@ -7,6 +7,7 @@ import com.uas.platform.b2c.fa.payment.constant.StringConstant;
 import com.uas.platform.b2c.fa.payment.service.PingAnAccountService;
 import com.uas.platform.b2c.fa.payment.service.PingAnAccountService;
 import com.uas.platform.b2c.fa.payment.support.UserInfoSupport;
 import com.uas.platform.b2c.fa.payment.support.UserInfoSupport;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.commons.collections.map.HashedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -44,8 +45,11 @@ public class PingAnAccountServiceImpl implements PingAnAccountService {
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public ResultMap openAccount(Boolean isPersonal) {
+    public ResultMap openAccount(Boolean isPersonal, HashMap<String, String> map) {
         Map<String, String> userInfoMap = userInfoSupport.getUserInfoMap(isPersonal);
         Map<String, String> userInfoMap = userInfoSupport.getUserInfoMap(isPersonal);
+        if (!MapUtils.isEmpty(map)) {
+            userInfoMap.putAll(map);
+        }
         ResultMap resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.PINGANOPENACCOUNT, userInfoMap, ResultMap.class);
         ResultMap resultStr = restTemplate.postForObject(sysConf.getPingAnUrl() + PingAnRequestUrlPostfix.PINGANOPENACCOUNT, userInfoMap, ResultMap.class);
         return resultStr;
         return resultStr;
     }
     }