傅行帆 6 lat temu
rodzic
commit
eea20e4778

+ 12
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AliPayController.java Wyświetl plik

@@ -8,6 +8,7 @@ import com.community.commom.session.UserElement;
8 8
 import com.community.huiju.common.wxpay.WXPayConstants;
9 9
 import com.community.huiju.common.wxpay.WXPayUtil;
10 10
 import com.community.huiju.service.AliPayServiceI;
11
+import com.community.huiju.service.WxPayServiceI;
11 12
 import com.google.common.collect.Maps;
12 13
 import io.swagger.annotations.Api;
13 14
 import io.swagger.annotations.ApiImplicitParam;
@@ -49,6 +50,9 @@ public class AliPayController {
49 50
 	@Autowired
50 51
 	private AliPayServiceI aliPayService;
51 52
 	
53
+	@Autowired
54
+	private WxPayServiceI wxPayService;
55
+	
52 56
 	@Value("${alipay.ALIPAY_PUBLIC_KEY}")
53 57
 	private String ALIPAY_PUBLIC_KEY;
54 58
 	
@@ -73,7 +77,8 @@ public class AliPayController {
73 77
 	
74 78
 	@ApiOperation(value = "支付宝手机订单支付完成后回调", notes = "支付宝手机订单支付完成后回调")
75 79
 	@RequestMapping(value = "/aliPayNotify",method = RequestMethod.POST)
76
-	public void wxNotify(HttpServletRequest request, HttpServletResponse response){
80
+	public void aliPayNotify(HttpServletRequest request, HttpServletResponse response){
81
+		System.out.println("alipay result  start =======");
77 82
 		Map<String,String> params = new HashMap<String,String>();
78 83
 		Map requestParams = request.getParameterMap();
79 84
 		for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
@@ -90,11 +95,15 @@ public class AliPayController {
90 95
 		}
91 96
 		//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
92 97
 		try {
93
-			System.out.println(params);
94 98
 			boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET_UTF8,"RSA2");
95
-			System.out.println(flag);
99
+			if (flag){
100
+				params.put("pay_type","2");
101
+				wxPayService.wxNotify(params);
102
+			}
96 103
 		} catch (AlipayApiException e) {
97 104
 			e.printStackTrace();
105
+		} catch (Exception e) {
106
+			e.printStackTrace();
98 107
 		}
99 108
 	}
100 109
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/WxPayController.java Wyświetl plik

@@ -95,6 +95,7 @@ public class WxPayController {
95 95
 			Map<String, String> resultMap = WXPayUtil.xmlToMap(result);
96 96
 			if (WXPayConstants.SUCCESS.equalsIgnoreCase(resultMap.get("result_code"))) {
97 97
 				//处理业务逻辑 修改订单状态等
98
+				resultMap.put("pay_type","0");
98 99
 				String state = wxPayService.wxNotify(resultMap);
99 100
 				if (state.equals("success")){
100 101
 					log.info("微信支付成功。。");

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java Wyświetl plik

@@ -134,8 +134,8 @@ public class WxPayServiceImpl implements WxPayServiceI {
134 134
 		tpBillInvoice.setBillStatus("1");
135 135
 		tpBillInvoice.setPayDate(new Date());
136 136
 		tpBillInvoice.setUpdateDate(new Date());
137
-		// 缴费方式  0:微信支付  1:线下缴费
138
-		tpBillInvoice.setPayType("0");
137
+		// 缴费方式  0:微信支付  1:线下缴费 2.支付宝支付
138
+		tpBillInvoice.setPayType(resultMap.get("pay_type"));
139 139
 		tpBillInvoiceMapper.updateByPrimaryKeySelective(tpBillInvoice);
140 140
 
141 141
 		//插入流水账单表
@@ -146,7 +146,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
146 146
 		tpBillStatement.setPayPrice(tpBillInvoice.getPayPrice());
147 147
 		tpBillStatement.setPayName(tpBillInvoice.getPayName());
148 148
 		tpBillStatement.setPayRemark(tpBillInvoice.getBillName());
149
-		tpBillStatement.setPayType("0");
149
+		tpBillStatement.setPayType(resultMap.get("pay_type"));
150 150
 		tpBillStatement.setCreateTime(new Date());
151 151
 		tpBillStatementMapper.insert(tpBillStatement);
152 152