From 179c4d64313c9b7572778da4aaaf6c6584fe457d Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期二, 20 五月 2025 23:48:08 +0800 Subject: [PATCH] 修改文件上传类型限制 --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/unionpay/Refund.java | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/unionpay/Refund.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/unionpay/Refund.java index 8631717..32533cc 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/unionpay/Refund.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/unionpay/Refund.java @@ -1,6 +1,7 @@ package com.panzhihua.applets.unionpay; import com.panzhihua.common.utlis.DateUtils; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; @@ -29,6 +30,7 @@ * 测试环境:http://58.247.0.18:29015/v1/netpay/refund * 生产环境:https://api-mop.chinaums.com/v1/netpay/refund */ +@Slf4j public class Refund { static String url = "https://api-mop.chinaums.com/v1/netpay/refund"; @@ -39,28 +41,27 @@ LocalDateTime time= DateUtils.getCurrentDate(); RefundBody reqBody = new RefundBody(); reqBody.requestTimestamp = time.format(DateUtils.format_ymdhms);// "2019-08-09 17:30:55"; - reqBody.merOrderId =UnionpayContent.TOP4+time.format(DateUtils.format_ymdhms_yyyyMMddmmHHssSSS)+makeUUID(7); + reqBody.merOrderId =refundOrderId; reqBody.mid =UnionpayContent.MID; reqBody.tid = UnionpayContent.TID; reqBody.instMid = UnionpayContent.INSTMID; reqBody.refundAmount = refundAmount; - reqBody.refundOrderId = refundOrderId; - System.out.println("request body:\n"+reqBody); - + log.error("银联退款参数 :" + reqBody); //2. 获取认证报文,timestamp为当前日期,老旧日期无法请求成功 String authorization = null; try { - authorization = getAuthorization(UnionpayContent.APPID,UnionpayContent.APPKEY,"201908091471000","nonce",reqBody.toString()); + authorization = getAuthorization(UnionpayContent.APPID,UnionpayContent.APPKEY, + time.format(DateUtils.format_ymdhms_string),"nonce",reqBody.toString()); } catch (Exception e) { e.printStackTrace(); + log.error("退款失败"); return "退款失败"; } - System.out.println("authorization:\n"+authorization); - + log.error("银联退款参数authorization :" + authorization); //3. 发送http请求,并解析返回信息 String response = request(url,authorization,reqBody.toString()); - System.out.println("response:\n"+response); + log.error("银联退款参数response :" + response); return response; } -- Gitblit v1.7.1