Commit 9a577398 authored by 张永's avatar 张永

增加退款回调

parent 54ad0368
package com.egolm.shop.api.service.impl; package com.egolm.shop.api.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
...@@ -337,11 +339,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -337,11 +339,7 @@ public class OrderServiceImpl implements OrderService {
return Rjx.jsonOk().set("list", subList).toJson(); return Rjx.jsonOk().set("list", subList).toJson();
} }
public static void main(String[] args) {
BigDecimal nPayAmount = new BigDecimal("30239");
nPayAmount = nPayAmount.multiply(new BigDecimal(0.01)).setScale(2, BigDecimal.ROUND_HALF_UP);
System.out.println(nPayAmount);
}
@Transactional @Transactional
public List<Map<String, Object>> paySuccess(String sSalesOrderID, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO, Date dPayDateTime) { public List<Map<String, Object>> paySuccess(String sSalesOrderID, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO, Date dPayDateTime) {
...@@ -1242,6 +1240,17 @@ public class OrderServiceImpl implements OrderService { ...@@ -1242,6 +1240,17 @@ public class OrderServiceImpl implements OrderService {
String sql = "exec up_B2BSalesOrderPayCallBack '"+out_payment_id+"' ,'"+payment_id+"' , '"+PayAmount+"' , '"+pay_succ_time+"' , '"+PayTypeID+"' , '"+StatusID+"' , '"+StatusName+"' "; String sql = "exec up_B2BSalesOrderPayCallBack '"+out_payment_id+"' ,'"+payment_id+"' , '"+PayAmount+"' , '"+pay_succ_time+"' , '"+PayTypeID+"' , '"+StatusID+"' , '"+StatusName+"' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0); returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
}else if (event_type.equals("mse_refund.succeeded")) { //退款成功 }else if (event_type.equals("mse_refund.succeeded")) { //退款成功
//up_B2BCancelOrderBizPayCallBack
String status = event_content.getString("status");
if(status.equals("SUCCEEDED")) {//退款成功
String refund_id = event_content.getString("refund_id");
String succeeded_time = event_content.getString("succeeded_time").replace("T"," ").replace("+08:00", ""); //东八区时间 如:2021-06-08T10:34:56+08:00,status=SUCCEEDED时返回
String refund_amount = event_content.getString("refund_amount"); //退款金额
String sql = "exec up_B2BCancelOrderBizPayCallBack '"+out_payment_id+"' ,'"+payment_id+"','"+refund_id+"' , '"+refund_amount+"' , '"+succeeded_time+"' , '"+PayTypeID+"' , '0' , '退款成功' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
}else {
logger.info("微企付退款回调-退款状态不成功 ,{} ",req);
}
} }
} }
...@@ -1285,5 +1294,10 @@ public class OrderServiceImpl implements OrderService { ...@@ -1285,5 +1294,10 @@ public class OrderServiceImpl implements OrderService {
return returnMap; return returnMap;
} }
public static void main(String[] args) {
String s = "2021-06-08T10:34:56+08:00".replace("T"," ").replace("+08:00", "");
System.out.println(s);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment