| 
					
				 | 
			
			
				@@ -1,20 +1,24 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.platform.yijia.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.parser.Feature; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.gson.Gson; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.platform.yijia.param.request.RechargeBalance; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.platform.yijia.pojo.CustomerCardUseRecord; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.platform.yijia.pojo.CustomerElectronicCard; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.platform.yijia.service.ElectronicMembershipCardService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.platform.yijia.utils.CodeMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.platform.yijia.utils.ResultData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.platform.yijia.service.StationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.platform.yijia.utils.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Random; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * <Title> ElectronicMembershipCardController </Title> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -25,8 +29,13 @@ import java.util.Random; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Controller 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping("/demo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class ElectronicMembershipCardController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static Logger logger =(Logger) LoggerFactory.getLogger(ElectronicMembershipCardController.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ElectronicMembershipCardService electronicMembershipCardService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StationService stationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //获取用户储蓄卡列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "/getElectronicCardList", method = RequestMethod.GET) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -47,7 +56,7 @@ public class ElectronicMembershipCardController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return gson.toJson(resultData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //用户充值储蓄卡 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //用户充值储蓄卡拉起随行付支付接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "/rechargeBalance", method = RequestMethod.POST) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public String rechargeBalance(@RequestBody RechargeBalance rechargeBalance){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -55,59 +64,107 @@ public class ElectronicMembershipCardController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //返回结果集 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ResultData resultData = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(rechargeBalance !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal amt = new BigDecimal(rechargeBalance.getAmt()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal presentAmt = new BigDecimal(rechargeBalance.getPresentAmt()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String cardOilsType = rechargeBalance.getCardOilsType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String unionId = rechargeBalance.getUnionId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String amt = rechargeBalance.getAmt(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String openId = rechargeBalance.getOpenId();    //公众号的openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer stationId = rechargeBalance.getStationId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String stationName = rechargeBalance.getStationName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String customerName = rechargeBalance.getCustomerName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //String mno = rechargeBalance.getMno(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //电子会员卡使用记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CustomerCardUseRecord customerCardUseRecord = new CustomerCardUseRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setUnionId(unionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setAmt(amt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setPresentAmt(presentAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setCardOilsType(cardOilsType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setStationName(stationName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setCustomerName(customerName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setUsageType("+"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setType("1");      //1表示微信 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //订单规则 时间+6位随机数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String str=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for(int i=0; i<6; i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                str+=random.nextInt(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String orderNo = System.nanoTime()+str; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerCardUseRecord.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //电子会员卡 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CustomerElectronicCard customerElectronicCard = new CustomerElectronicCard(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerElectronicCard.setUnionId(unionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerElectronicCard.setStationId(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            customerElectronicCard.setCardOilsType(cardOilsType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerElectronicCard.setId(rechargeBalance.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            customerElectronicCard.setRecentlyTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //获取当前用户要充值的的电子会员卡信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            CustomerElectronicCard electronicCardInfo = electronicMembershipCardService.getElectronicCardInfo(customerElectronicCard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(electronicCardInfo != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BigDecimal amtBalance = electronicCardInfo.getAmt();        //用户当前卡内余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(presentAmt !=null){  //有赠送金额时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    customerElectronicCard.setAmt(amtBalance.add(presentAmt).add(amt)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { //无赠送金额时 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    customerElectronicCard.setAmt(amtBalance.add(amt)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String userType = rechargeBalance.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String subject = rechargeBalance.getSubject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String orderNo = rechargeBalance.getOrderNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //将业务参数存放在 JSON 对象中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            JSONObject reqData = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, String> resultMap = stationService.getStationAppIdAndAppSecret(stationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(resultMap !=null && resultMap.containsKey("appId") && resultMap.containsKey("mno")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info("==============================电子会员卡(储蓄卡)充值功能调用随行付接口================================"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(userType.equals("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //1 是公众号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("payWay", "02"); //支付方式  02 公众号/服 务窗/js支付 03 小程序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("userId", openId); //用户号 微信:openid; 支付宝:userid;银联:userid;微信&支付宝必传,银联js为非必传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("subAppid", resultMap.get("gzhAppId")); //微信公众号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info("支付子商户:"+ resultMap.get("gzhAppId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if(userType.equals("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("payWay", "03"); //支付方式  02 公众号/服 务窗/js支付 03 小程序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("userId", openId); //用户号 微信:openid; 支付宝:userid;银联:userid;微信&支付宝必传,银联js为非必传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        reqData.put("subAppid", resultMap.get("appId")); //微信小程序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info("支付子商户:"+ resultMap.get("appId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("mno", resultMap.get("mno")); //商户编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.info("商户编号:"+ resultMap.get("mno")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("ordNo", orderNo); //商户订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("amt", amt); //订单总金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("payType", "WECHAT"); //支付渠道 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("subject", subject); //订单标题 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("tradeSource", "01"); //交易来源 01服务商,02收银台,03硬件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("trmIp", "172.16.2.1");//商家ip地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("outFrontFailUrl", ""); //js 支付,前台 事变通知地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqData.put("notifyUrl", "https://www.huijy.net/demo/getCardRechargeCallback"); //回调地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("notifyUrl", "https://www.huijy.net/api/getCardRechargeCallback"); //回调地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("subMechId", ""); //子商户号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("amt", "0.01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("discountAmt", ""); //参与优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("unDiscountAmt", ""); //不参与优惠金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("timeExpire", "10"); //订单失效时间, 以分钟为单位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("limitPay", "00"); //限制卡类型: 00-全部 01-限定不能使 用信用卡支付 默认值 00 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("hbFqNum", "6"); //花呗分期数,仅可上送 6 或 12 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("customerIp", ""); //持卡人ip地址,银联js支付时必传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("outFrontUrl", ""); //js 支付,前台 成功通知地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("needReceipt", "00"); //电子发票功能 微信开具电子 发票使用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("ledgerAccountFlag", "00"); //是否做分账 分账交易使 用;00:做; 01:不做;不传默认为不做分账 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("ledgerAccountEffectTime", "00"); //分账有效时间 单位为天;是 否做分账选择 00 时该字段必传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("ruleId", "00"); //同 步 分 账 规 则 id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("fusruleId", "00"); //同步分账规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("ylTrmNo", ""); //银联终端号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("terminalId", ""); //TQ机具编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("deviceNo ", "1111"); //设备号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("identityFlag", ""); //是否是实名支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("buyerIdType", "IDCARD"); //证件类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("buyerIdNo", "410523198701054018"); //证件号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("buyerName", "张三"); //买家姓名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("mobileNum", ""); //手机号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    reqData.put("extend", ""); //备用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String req= SXFPaySign.getSXFPay(reqData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.debug("参数信息:"+req); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("req:" + req); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //此处不要改变reqData里面值的顺序用LinkedHashMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    HashMap reqMap = JSON.parseObject(req, LinkedHashMap.class, Feature.OrderedField); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //组装加密串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String signContent = RSASignature.getOrderContent(reqMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("拼接后的参数:" + signContent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.debug("拼接后的参数:"+signContent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //sign 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String sign = RSASignature.encryptBASE64(RSASignature.sign(signContent, SXFPaySign.privateKey)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("============签名:" + sign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    reqMap.put("sign", sign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String reqStr = JSON.toJSONString(reqMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("请求参数:" + reqMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("请求参数:" + reqStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //调用第三方接口地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //String url = "https://openapi-test.tianquetech.com/order/jsapiScan";//测试地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String url = "https://openapi.suixingpay.com/order/jsapiScan";//生产地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String resultJson = HttpUtils.connectPostUrl(url, reqStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    System.out.println("返回信息:" + resultJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //   logger.debug("返回信息:"+resultJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //不要对reqData排序 所以用LinkedHashMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    HashMap<String, Object> result = JSON.parseObject(resultJson, LinkedHashMap.class, Feature.OrderedField); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ("0000".equals(result.get("code"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //验签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String signResult = result.get("sign").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result.remove("sign"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String resultStr = RSASignature.getOrderContent(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        System.out.println(resultStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //sign 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String resultSign = RSASignature.encryptBASE64(RSASignature.sign(signContent, SXFPaySign.privateKey)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        System.out.println("resultSign:" + resultSign); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //组装加密串 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (RSASignature.doCheck(resultStr, signResult, SXFPaySign.sxfPublic)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            System.out.println("===================验签成功=============="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    resultData=ResultData.success(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    resultData=ResultData.error(CodeMsg.YEWU_FAIL,"订单支付失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                electronicMembershipCardService.updateElectronicCardInfo(customerElectronicCard);   //更新电子会员看余额信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                electronicMembershipCardService.insetCardUseRecord(customerCardUseRecord);      //插入电子会员卡的使用记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                resultData = ResultData.success(CodeMsg.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                resultData = ResultData.error(CodeMsg.USER_EXSIST_CARD); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             resultData = ResultData.error(CodeMsg.REQUEST_FAIL); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -115,6 +172,133 @@ public class ElectronicMembershipCardController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return gson.toJson(resultData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //电子会员卡(储蓄卡)充值功能随行付回调功能 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RequestMapping(value = "/getCardRechargeCallback", consumes = "application/json", method = RequestMethod.POST) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void getCardRechargeCallback(@RequestBody JSONObject request){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.info("=========================电子会员卡(储蓄卡)充值功能随行付回调功能==============================="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.info("电子会员卡(储蓄卡)充值功能随行付回调返回过来的参数:"+request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //logger.info("ordNo信息:" + request.get("ordNo").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //logger.info("sign信息:" + request.get("sign").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Gson gson =new Gson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String sxfUuid=request.get("sxfUuid").toString();     //随行付落单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String payWay=request.get("payWay").toString();     //随行付交易方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String payTime=request.get("payTime").toString();   //随行付交易时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String uuid=request.get("uuid").toString();         //随行付交易流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String mno=request.get("mno").toString();//发起交易的商户编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String ordNo=request.get("ordNo").toString();//商户生成的订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String amt=request.get("amt").toString();//金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String buyerId=request.get("buyerId").toString();//用户登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String transactionId=request.get("transactionId").toString();//用户登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String drType=request.get("drType").toString();//借贷记标识 1-借,2-贷,3-其他 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String payType=request.get("payType").toString();//对订单的描述,取值范围:WECHAT:微信,ALIPAY:支付宝,UNIONPAY: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String payBank=request.get("payBank").toString();//付款银行银行编码,例如 ICBC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String pointAmount=request.get("pointAmount").toString();//代金券金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String totalOffstAmt=request.get("totalOffstAmt").toString();//消 费 者 付 款金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String settleAmt=request.get("settleAmt").toString();//商家入账金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String timeStamp=request.get("timeStamp").toString();//响应时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String sign=request.get("sign").toString();//签名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String bizCode=request.get("bizCode").toString();//业务返回码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String bizMsg=request.get("bizMsg").toString();//业 务 返 回 信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String openid=request.get("openid").toString();//微 信 或 支 付宝身份id()opendid userid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String channelId=request.get("channelId").toString();//渠道商户号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String subMechId=request.get("subMechId").toString();//子商户号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String finishTime=request.get("finishTime").toString();//交易完成时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String clearDt=request.get("clearDt").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String settlementBatchNo=request.get("settlementBatchNo").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String origOrdNo=request.get("origOrdNo").toString();//反交易退款异步通知 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String origUuid=request.get("origUuid").toString();//token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String scene=request.get("scene").toString();//用户登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String buyerAccount=request.get("buyerAccount").toString();// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String realRefundAmount=request.get("realRefundAmount").toString();//商家出账金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String recFeeAmt=request.get("recFeeAmt").toString();//交易手续费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String recFeeRate=request.get("recFeeRate").toString();//交易手续费率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String refBuyerAmt=request.get("refBuyerAmt").toString();//消 费 者 到 账金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //String extend = extend=request.get("extend").toString();//备用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //将业务参数存放在 JSON 对象中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject reqData = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //备用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("extend") && request.get("extend") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String extend = request.get("extend").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("extend", extend); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //优惠券参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("promotionDetail") && request.get("promotionDetail") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String promotionDetail = request.get("promotionDetail").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("promotionDetail", promotionDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //商家出账金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("realRefundAmount") && request.get("realRefundAmount") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String realRefundAmount = request.get("realRefundAmount").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("realRefundAmount", realRefundAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //szltFlag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("szltFlag") && request.get("szltFlag") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String szltFlag = request.get("szltFlag").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("szltFlag", szltFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //recFeeAmt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("recFeeAmt") && request.get("recFeeAmt") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String recFeeAmt = request.get("recFeeAmt").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("recFeeAmt", recFeeAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //szltRecfeeAmt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(request.containsKey("szltRecfeeAmt") && request.get("szltRecfeeAmt") !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String szltRecfeeAmt = request.get("szltRecfeeAmt").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            reqData.put("szltRecfeeAmt", szltRecfeeAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("sxfUuid",sxfUuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("payWay",payWay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("payTime",payTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("uuid",uuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("mno",mno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("ordNo",ordNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("amt",amt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("buyerId",buyerId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("transactionId",transactionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("drType",drType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("payType",payType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("payBank",payBank); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("pointAmount",pointAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("totalOffstAmt",totalOffstAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("settleAmt",settleAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("timeStamp",timeStamp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("bizCode",bizCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("bizMsg",bizMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("openid",openid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("channelId",channelId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("subMechId",subMechId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("finishTime",finishTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("clearDt",clearDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        reqData.put("settlementBatchNo",settlementBatchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("realRefundAmount",realRefundAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("recFeeAmt",recFeeAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("recFeeRate",recFeeRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("buyerAccount",buyerAccount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("origOrdNo",origOrdNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("origUuid",origUuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("scene",scene); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("refBuyerAmt",refBuyerAmt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //reqData.put("extend",extend); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //根据回调信息,先进行验签,验签后修改状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.info("打印参数信息"+gson.toJson(reqData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //不要对reqData排序 所以用LinkedHashMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        HashMap<String, Object> result = JSON.parseObject(gson.toJson(reqData), LinkedHashMap.class, Feature.OrderedField); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //验签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String resultStr = RSASignature.getOrderContent(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        JSONObject req = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println(resultStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (RSASignature.doCheck(resultStr, sign, SXFPaySign.sxfPublic)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.info("验签成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.info("验签失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //获取用户储蓄卡充值记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "/getCardRechargeRecord", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ResponseBody 
			 |