Browse Source

微信支付

傅行帆 6 years ago
parent
commit
d0096273bd

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/WxPayController.java View File

62
 	}
62
 	}
63
 	
63
 	
64
 	@ApiOperation(value = "下载对账单", notes = "下载对账单")
64
 	@ApiOperation(value = "下载对账单", notes = "下载对账单")
65
-	@RequestMapping(value = "/wxDownloadBill",method = RequestMethod.GET)
65
+	@RequestMapping(value = "/wxDownloadBill",method = RequestMethod.POST)
66
 	public ResponseBean wxDownloadBill(){
66
 	public ResponseBean wxDownloadBill(){
67
 		ResponseBean responseBean = new ResponseBean();
67
 		ResponseBean responseBean = new ResponseBean();
68
 		
68
 		
69
 		Map<String, String> resp = Maps.newHashMap();
69
 		Map<String, String> resp = Maps.newHashMap();
70
 		try {
70
 		try {
71
 			resp = wxPayService.wxDownloadBill();
71
 			resp = wxPayService.wxDownloadBill();
72
+			log.info("支付成功的回调参数: {}",resp);
72
 		} catch (Exception e) {
73
 		} catch (Exception e) {
73
 			e.printStackTrace();
74
 			e.printStackTrace();
74
 		}
75
 		}

+ 4
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java View File

14
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
16
 
16
 
17
+import java.text.SimpleDateFormat;
17
 import java.time.Instant;
18
 import java.time.Instant;
19
+import java.util.Date;
18
 import java.util.HashMap;
20
 import java.util.HashMap;
19
 import java.util.Map;
21
 import java.util.Map;
20
 
22
 
43
 		
45
 		
44
 		//获取支付金额
46
 		//获取支付金额
45
 		TpBillInvoice tpBillInvoice = tpBillInvoiceMapper.selectByIdAndUserId(billInvoiceId,userElement.getId(),userElement.getCommunityId());
47
 		TpBillInvoice tpBillInvoice = tpBillInvoiceMapper.selectByIdAndUserId(billInvoiceId,userElement.getId(),userElement.getCommunityId());
46
-		
47
 		if (null == tpBillInvoice){
48
 		if (null == tpBillInvoice){
48
 			throw new Exception("订单不存在");
49
 			throw new Exception("订单不存在");
49
 		}
50
 		}
50
 		
51
 		
52
+		//下单
51
 		Map<String, String> data = new HashMap<String, String>();
53
 		Map<String, String> data = new HashMap<String, String>();
52
 		data.put("body", "支付测试");
54
 		data.put("body", "支付测试");
53
 		//商品号唯一
55
 		//商品号唯一
89
 		WXPay wxpay = new WXPay(config);
91
 		WXPay wxpay = new WXPay(config);
90
 		
92
 		
91
 		Map<String, String> data = new HashMap<String, String>();
93
 		Map<String, String> data = new HashMap<String, String>();
92
-		data.put("bill_date", "20190219");
94
+		data.put("bill_date", new SimpleDateFormat("yyyyMMdd").format(new Date()));
93
 		data.put("bill_type", "ALL");
95
 		data.put("bill_type", "ALL");
94
 		return wxpay.downloadBill(data);
96
 		return wxpay.downloadBill(data);
95
 	}
97
 	}