From 16e078818316a63b02bb678fc2f90dc1ccc26b24 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 31 Aug 2023 11:17:50 +0800 Subject: [PATCH] 退款查询 --- src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java | 68 ++++++++++++++++++++++++---------- src/main/java/cc/mrbird/febs/pay/service/impl/AliPayServiceImpl.java | 12 +++--- src/main/resources/application-prod.yml | 21 ++++++++-- 3 files changed, 70 insertions(+), 31 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java index 9a5c9bd..3f774cd 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java @@ -329,13 +329,14 @@ }else{ unipayDto.setProductName(items.get(0).getGoodsName()); } - String unipayStr = unipayService.unipay(unipayDto); - if("fail" == unipayStr){ + String unipayStr = payService.aliPay(orderInfo); + JSONObject jsonObjectRes = JSONUtil.parseObj(unipayStr); + Object alipay_trade_app_pay_response = jsonObjectRes.get("alipay_trade_app_pay_response"); + JSONObject parseObj = JSONUtil.parseObj(alipay_trade_app_pay_response); + payResultStr = (String) parseObj.get("msg"); + rcResult = (String) parseObj.get("code"); + if(!"10000".equals(rcResult) || !"Success".equals(payResultStr) ){ throw new FebsException("支付失败"); - }else{ - JSONObject jsonObject = JSONUtil.parseObj(unipayStr); - payResultStr = (String) jsonObject.get("r7_TrxNo"); - rcResult = (String) jsonObject.get("rc_Result"); } orderInfo.setPayOrderNo(payResultStr); orderInfo.setPayMethod("支付宝支付"); @@ -434,20 +435,20 @@ return map; } - public static void main(String[] args) { - String str = "{\"biz_code\":\"JS000000\",\"biz_msg\":\"成功\",\"data\":\"{\\\"order_status\\\":\\\"P2000\\\",\\\"jp_order_no\\\":\\\"100120220826446740396081496064\\\",\\\"err_msg\\\":\\\"短信验证码不符\\\",\\\"err_code\\\":\\\"CP110026\\\",\\\"sign_no\\\":\\\"\\\",\\\"mch_order_no\\\":\\\"NO_2022082618263952399\\\"}\",\"mch_no\":\"888118000001971\",\"rand_str\":\"an2w7ulf5ru6upkk5bdg441kdi3gnpvu\",\"resp_code\":\"SUCCESS\",\"sec_key\":\"\",\"sign\":\"NiJXRTSIZ9xZMUOwEHiEHdZXmgL2cHUU5WUa1NbMRRzui0DIiuZSW4e31LjnBxwVwmy3uuPMP+tqhY8VLyC8uCFOdGdZI7e72VuRvyvaiW7/sqCrsfgPOBEjiGE/CmSMRoEXv9HmqCyNBF6iHSEhQJql5Yge30dQdyB6xFfqjk0=\",\"sign_type\":\"2\"}"; - - JSONObject jsonObject = JSONUtil.parseObj(str); - String payResultStr = (String) jsonObject.get("biz_code"); - String signBizMsg = (String) jsonObject.get("biz_msg"); - String signData = (String) jsonObject.get("data"); - - JSONObject signDatajsonObject = JSONUtil.parseObj(signData); - String err_msg = (String) signDatajsonObject.get("err_msg"); - if(ObjectUtil.isNotNull(signDatajsonObject.get("err_code"))){ - System.out.println(err_msg); - } - } +// public static void main(String[] args) { +// String str = "{\"biz_code\":\"JS000000\",\"biz_msg\":\"成功\",\"data\":\"{\\\"order_status\\\":\\\"P2000\\\",\\\"jp_order_no\\\":\\\"100120220826446740396081496064\\\",\\\"err_msg\\\":\\\"短信验证码不符\\\",\\\"err_code\\\":\\\"CP110026\\\",\\\"sign_no\\\":\\\"\\\",\\\"mch_order_no\\\":\\\"NO_2022082618263952399\\\"}\",\"mch_no\":\"888118000001971\",\"rand_str\":\"an2w7ulf5ru6upkk5bdg441kdi3gnpvu\",\"resp_code\":\"SUCCESS\",\"sec_key\":\"\",\"sign\":\"NiJXRTSIZ9xZMUOwEHiEHdZXmgL2cHUU5WUa1NbMRRzui0DIiuZSW4e31LjnBxwVwmy3uuPMP+tqhY8VLyC8uCFOdGdZI7e72VuRvyvaiW7/sqCrsfgPOBEjiGE/CmSMRoEXv9HmqCyNBF6iHSEhQJql5Yge30dQdyB6xFfqjk0=\",\"sign_type\":\"2\"}"; +// +// JSONObject jsonObject = JSONUtil.parseObj(str); +// String payResultStr = (String) jsonObject.get("biz_code"); +// String signBizMsg = (String) jsonObject.get("biz_msg"); +// String signData = (String) jsonObject.get("data"); +// +// JSONObject signDatajsonObject = JSONUtil.parseObj(signData); +// String err_msg = (String) signDatajsonObject.get("err_msg"); +// if(ObjectUtil.isNotNull(signDatajsonObject.get("err_code"))){ +// System.out.println(err_msg); +// } +// } private String balancePay(MallOrderInfo orderInfo, String tradePwd, String field) { if (StrUtil.isBlank(tradePwd)) { @@ -803,4 +804,31 @@ return apiScoreSetVo; } + public static void main(String[] args) { + + String unipayStr = "{\n" + + " \"alipay_trade_app_pay_response\": {\n" + + " \"code\": \"10000\",\n" + + " \"msg\": \"Success\",\n" + + " \"app_id\": \"2014072300007148\",\n" + + " \"auth_app_id\": \"2014072300007148\",\n" + + " \"charset\": \"utf-8\",\n" + + " \"timestamp\": \"2016-10-11 17:43:36\",\n" + + " \"out_trade_no\": \"081622560194853\",\n" + + " \"total_amount\": \"9.00\",\n" + + " \"trade_no\": \"2016081621001004400236957647\",\n" + + " \"seller_id\": \"2088702849871851\"\n" + + " },\n" + + " \"sign\": \"NGfStJf3i3ooWBuCDIQSumOpaGBcQz+aoAqyGh3W6EqA/gmyPYwLJ********\",\n" + + " \"sign_type\": \"RSA2\"\n" + + "}"; + JSONObject jsonObjectRes = JSONUtil.parseObj(unipayStr); + Object alipay_trade_app_pay_response = jsonObjectRes.get("alipay_trade_app_pay_response"); + JSONObject parseObj = JSONUtil.parseObj(alipay_trade_app_pay_response); + String payResultStr = (String) parseObj.get("msg"); + String rcResult = (String) parseObj.get("code"); + System.out.println(payResultStr); + System.out.println(rcResult); + } + } diff --git a/src/main/java/cc/mrbird/febs/pay/service/impl/AliPayServiceImpl.java b/src/main/java/cc/mrbird/febs/pay/service/impl/AliPayServiceImpl.java index fe9f294..6c8bbc2 100644 --- a/src/main/java/cc/mrbird/febs/pay/service/impl/AliPayServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/pay/service/impl/AliPayServiceImpl.java @@ -94,11 +94,11 @@ return; } - MallMember member = memberService.getById(orderInfo.getMemberId()); - if (AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())) { - member.setLevel(AgentLevelEnum.SECOND_LEVEL.name()); - memberService.updateById(member); - } +// MallMember member = memberService.getById(orderInfo.getMemberId()); +// if (AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())) { +// member.setLevel(AgentLevelEnum.SECOND_LEVEL.name()); +// memberService.updateById(member); +// } orderInfo.setStatus(OrderStatusEnum.WAIT_SHIPPING.getValue()); orderInfo.setPayResult("1"); @@ -107,7 +107,7 @@ orderInfoMapper.updateById(orderInfo); // agentProducer.sendReturnMoneyMsg(orderInfo.getId()); - agentProducer.sendAutoLevelUpMsg(orderInfo.getMemberId()); +// agentProducer.sendAutoLevelUpMsg(orderInfo.getMemberId()); // memberService.addMoneyFlow(orderInfo.getMemberId(), orderInfo.getAmount().negate(), MoneyFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), null, null, null, null, FlowTypeEnum.BALANCE.getValue()); } diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 7d991e2..5bfabf7 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -48,16 +48,27 @@ password: zj_mall123 publisher-confirm-type: correlated +#pay: +# ali: +# appId: 2016120704000539 +# # 支付宝公钥 +# publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAobfti31eIy4U59JUrL+eMosuY97jk444eFyMeoxkG1ljJ3GytPV7YlLL6TVgvON6eR0eFvWKK4MoTEW0TkpxgmuurkpTSXDB0bNiuYJQyiju4Bikt83dQo64YKYDSwBNA9hFPHFM1mhWpJM/3mYjbbLT9AoL8q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d6WA9cW/SQs2ehtqUVM55IzsYZK2Tbnb9UYuIHTHiMExL/jOGq0wKBgQC8v2rPC02+qVJyx82Gq6CD57EuirKTA1ZUFQIBRbfccqMoYaJogREUjlUNN5mZAuQ6yLqOHi79v6G/7NegP4WavIRJ/W9jqjLXP1AJ/jeo9IGu96HCsV2+M/5DRD/zrZakQMJPZYrgZOqjtL1qLcKdpuXumT0VAyy41yoU0jvDpQKBgQCvyABR5c71dUMkuzfTQ0g80u+A1JR6Ep/z3kghBH4aVfYyH8VhFypDNuo5TLFDSVvRbpciObTZZOGC08ppx1Bxz09A+Ukg3jUl/qRop0EwWHuqQWkl8fkhby2O5Qfacu97D+xbk26VoTqXCu+DuF0qDDALxvtx8f0h9R9iolswdQKBgE5+sLWwNsHe+vnfHBswjw2sMmRvq/o1vhYzsmTDEMauKipmCDu7yVWqJ7bac5dNu4qy5dqqtNI0etktbzMml7KVSdLXghaJtqELpIazYYRzQud39p7YUmsChnCFFq+JdoeSovyP9ySA84/nX4qjwzb7LM6AjgWKD3RDjy2fjNk9AoGBANEJdXJhwon+cMfPT9XfCVee0Cr//91WzfGYnVpevRuYp/q29rcZ0mZiXPfvge0vogZEFHIzsQfjtW84W4H81aSbFj9lncIzRl4O8yFGsr1Y9wkewmQqylM+A/I4eu9UcpK/hJX5G07EnCuZCabj12CGnA3uA9Icgg28jbg2BCR6 +# # 回调地址 +# noticeUrl: http://120.27.238.55:8801/api/pay/aliCallBack +# domain: https://openapi.alipay.com/gateway.do + pay: ali: - appId: 2016120704000539 + appId: 2021004113682014 # 支付宝公钥 - publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAobfti31eIy4U59JUrL+eMosuY97jk444eFyMeoxkG1ljJ3GytPV7YlLL6TVgvON6eR0eFvWKK4MoTEW0TkpxgmuurkpTSXDB0bNiuYJQyiju4Bikt83dQo64YKYDSwBNA9hFPHFM1mhWpJM/3mYjbbLT9AoL8q+n1fBxFtcAMmxXBqZiECT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rb5yIe6LUhSCmag6WelyGNYH86W0nmi5fJtzcJJMIeTE+B73/0tbEyOQKBgQCxwZQvmtUIow0sBDdP/OXfKRIwqeEkhOK4FRMm9ZTlIlcgc96tY/jhbm5DtginHXZwVvbIFLLNcY9ZUeIeB6ql5FMboh5Kj43nJc760F2rVZ80zZIguBDR1tK9i8BumxH2arnNraPLvOrrotxDdPr8tu/iMG6DjHbz601ABJnqDQKBgBFwP7L9dEJj0287649NdhpIetwcaQzY7y0pL0OTaYq68h4rPuxkYWozYf+O10ooNn1UvcKveZmz7qXAYJXQSwEd40xkoEDpfgCO7I/Y6SMgjZav8gwxNK4ezdF503ohexf/WDNd2BP8b8VwiO7eD00U5t7+ilONyhshl3fJjnVpAoGBANHG6aicEbT409gR9ev7Tt09F0Lb3qd+F+ghDqVG25GaUMeZ2gXS2raxjUKV2sZOXJ+Ur5HZ4x5IZQz4NeUEuHGKvYpZMVMm/t1QKGaQbndKTf4cfL7aDPFG4Ljlv6YxGGevej3uDmkHt3yM/p27mc+wUDAHorM+uWywrdsjVWgs # 回调地址 - noticeUrl: http://120.27.238.55:8801/api/pay/aliCallBack - domain: https://openapi.alipay.com/gateway.do + noticeUrl: https://jufu.meiao.biz/api/pay/aliCallBack + domain: https://openapi.alipaydev.com/gateway.do wx: appId: wx051693799db39540 mchId: 1641389321 -- Gitblit v1.9.1