Commit 87616b4a authored by 张永's avatar 张永

更新支付回调

parent 90acc23e
......@@ -183,11 +183,11 @@ public class OrderController {
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
})
@RequestMapping(value = "/paySuccess",method=RequestMethod.GET)
public String paySuccess(BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO) {
@RequestMapping(value = "/paySuccess",method=RequestMethod.POST)
public String paySuccess(String sSalesOrderID,BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO,String PayTypeID,String PayType) {
try {
String[] ary = sOutTradeNO.split("_", 2);
List<Map<String, Object>> result = orderService.paySuccess(ary[0], nPayAmount, sOpenID, sTransTraceNO, sOutTradeNO, new Date());
List<Map<String, Object>> result = orderService.paySuccess(ary[0], nPayAmount, sOpenID, sTransTraceNO, new Date());
return Rjx.jsonOk().set("list", result).toJson();
} catch (Exception e) {
e.printStackTrace();
......@@ -252,7 +252,7 @@ public class OrderController {
String sOutTradeNO = out_trade_no;
Date date = DateUtil.parse(payEndTime, "yyyyMMddHHmmss");
BigDecimal nPayAmount = new BigDecimal(total_fee);
orderService.paySuccess(sSalesOrderID, nPayAmount, sOpenID, sTransTraceNO, sOutTradeNO, date);
orderService.paySuccess(sOutTradeNO, nPayAmount, sOpenID, sTransTraceNO, date);
}
result.put("return_code", "SUCCESS");
result.put("return_msg", "OK");
......
......@@ -58,12 +58,12 @@ public class PayNotifyController {
xs.setClassLoader(WxPayResponse.class.getClassLoader());
xs.alias("xml", WxPayResponse.class);
String xmlMsg = StringUtil.inputStream2String(in);
logger.info("接收到回调信息 {}",xmlMsg);
logger.info("从egoPay中接收到支付回调信息 {}",xmlMsg);
postData = (WxPayResponse) xs.fromXML(xmlMsg);
List<Map<String, Object>> returnMap = orderService.payCallback(postData);
logger.info("处理回调信息结果 {}",GsonUtil.toJson(returnMap));
logger.info("从egoPay中接收到支付信息结果 {}",GsonUtil.toJson(returnMap));
} catch (Exception e) {
e.printStackTrace();
......
......@@ -22,7 +22,7 @@ public interface OrderService {
public String getOrderDetail(String salesOrderId);
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 sOutTradeNO, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, Date dPayDateTime);
public String getSubOrderDetail(String subOrderID);
......
......@@ -327,11 +327,20 @@ public class OrderServiceImpl implements OrderService {
}
@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 sOutTradeNO, BigDecimal nPayAmount, String sOpenID,
String sTransTraceNO, Date dPayDateTime) {
List<Map<String, Object>> returnMap = new ArrayList<Map<String, Object>>();
Integer nIdx = jdbcTemplate
String sSalesOrderID ="";
try {
String sSalesOrderIDSql = "select sSalesOrderID from tSalesOrderPay where sOutTradeNO = ? ";
sSalesOrderID = jdbcTemplate.queryForString(sSalesOrderIDSql, sOutTradeNO);
} catch (Exception e1) {
e1.printStackTrace();
}
/* Integer nIdx = jdbcTemplate
.queryForInt("select ISNULL(MAX(nIdx),0) from tSalesOrderPay where sSalesOrderID = ?", sSalesOrderID);
nPayAmount = nPayAmount.multiply(new BigDecimal(0.01)).setScale(2, BigDecimal.ROUND_HALF_UP);
......@@ -352,15 +361,21 @@ public class OrderServiceImpl implements OrderService {
Sql sqlDesc = dialect.argsInsert("tSalesOrderPay", map);
String sql = "if not exists (select * from tSalesOrderPay where sTransTraceNO = '" + sTransTraceNO + "') "
+ sqlDesc.getSql();
jdbcTemplate.update(sql, sqlDesc.getArgs());
jdbcTemplate.update("update tSalesOrder set nOrderStatus = nOrderStatus|32 where sSalesOrderID = ?",
sSalesOrderID);
try {
returnMap = jdbcTemplate.executeMutil("exec Up_Ego_SplitOrderPrd '" + sSalesOrderID + "'").getDatas()
.get(0);
} catch (Exception e) {
e.printStackTrace();
jdbcTemplate.update(sql, sqlDesc.getArgs());*/
if(StringUtil.isNotBlank(sSalesOrderID)) {
jdbcTemplate.update("UPDATE tSalesOrderPay SET sTransTraceNO = ? AND dPayDateTime = ? WHERE sOutTradeNO = ? ",sTransTraceNO,DateUtil.format(dPayDateTime, DateUtil.FMT_DATE_SECOND),sOutTradeNO);
jdbcTemplate.update("update tSalesOrder set nOrderStatus = nOrderStatus|32 where sSalesOrderID = ?",
sSalesOrderID);
try {
returnMap = jdbcTemplate.executeMutil("exec Up_Ego_SplitOrderPrd '" + sSalesOrderID + "'").getDatas()
.get(0);
} catch (Exception e) {
e.printStackTrace();
}
}else {
logger.info("支付单号:"+sOutTradeNO +"未找到对应的订单号。");
}
return returnMap;
}
......@@ -1097,20 +1112,7 @@ public class OrderServiceImpl implements OrderService {
String paydate = DateUtil.format(DateUtil.parse(PayDate, DateUtil.FMT_YYYYMMddHHMMSS),
DateUtil.FMT_DATE_SECOND);
logger.info("支付回调单号: {}", OutTradeNO);
/*
* //补款后缀是_D,结算单后缀是_S if(OutTradeNO.contains("_D")) { String sql =
* "exec up_B2BSalesOrderDebtPayCallBack '"+OutTradeNO+"' ,'"
* +TransactionID+"' , '"+PayCardNO+"' , '"+PayAmount+"' , '"+paydate+"' , '"
* +PayChannel+"' "; returnMap =
* jdbcTemplate.executeMutil(sql).getDatas().get(0); }else if
* (OutTradeNO.contains("_S")) { String sql =
* "exec up_CreateSettlePayCallBack '"+OutTradeNO+"' ,'"+TransactionID+"' , '"
* +PayCardNO+"' , '"+PayAmount+"' , '"+paydate+"' , '"+PayChannel+"' ";
* returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0); }else {//普通订单
* String[] ary = OutTradeNO.split("_", 2); returnMap = this.paySuccess(ary[0],
* new BigDecimal(PayAmount), OpenID, TransactionID, OutTradeNO,
* DateUtil.parse(paydate, DateUtil.FMT_DATE_SECOND)); }
*/
returnMap = this.doCallBack(OutTradeNO, TransactionID, PayCardNO, PayAmount, paydate, PayChannel, OpenID);
} catch (Exception e) {
......@@ -1119,15 +1121,27 @@ public class OrderServiceImpl implements OrderService {
return returnMap;
}
public List<Map<String, Object>> doCallBack(String OutTradeNO, String TransactionID, String PayCardNO,
String PayAmount, String paydate, String PayChannel, String OpenID) {
List<Map<String, Object>> returnMap = new ArrayList<Map<String, Object>>();
// 补款后缀是_D,结算单后缀是_S
if (OutTradeNO.contains("_D")) {
String sql = "exec up_B2BSalesOrderDebtPayCallBack '" + OutTradeNO + "' ,'" + TransactionID + "' , '"
+ PayCardNO + "' , '" + PayAmount + "' , '" + paydate + "' , '" + PayChannel + "' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
} else if (OutTradeNO.contains("_S")) {
String sql = "exec up_CreateSettlePayCallBack '" + OutTradeNO + "' ,'" + TransactionID + "' , '" + PayCardNO
+ "' , '" + PayAmount + "' , '" + paydate + "' , '" + PayChannel + "' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
} else {// 普通订单
String[] ary = OutTradeNO.split("_", 2);
returnMap = this.paySuccess(ary[0], new BigDecimal(PayAmount), OpenID, TransactionID,DateUtil.parse(paydate, DateUtil.FMT_DATE_SECOND));
}
return returnMap;
}
/**
* 微企付的回调 PayTypeID=140
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
*
* 微企付的回调 PayTypeID=140
* @param req
* @return
*/
......@@ -1246,25 +1260,6 @@ public class OrderServiceImpl implements OrderService {
return returnMap;
}
public List<Map<String, Object>> doCallBack(String OutTradeNO, String TransactionID, String PayCardNO,
String PayAmount, String paydate, String PayChannel, String OpenID) {
List<Map<String, Object>> returnMap = new ArrayList<Map<String, Object>>();
// 补款后缀是_D,结算单后缀是_S
if (OutTradeNO.contains("_D")) {
String sql = "exec up_B2BSalesOrderDebtPayCallBack '" + OutTradeNO + "' ,'" + TransactionID + "' , '"
+ PayCardNO + "' , '" + PayAmount + "' , '" + paydate + "' , '" + PayChannel + "' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
} else if (OutTradeNO.contains("_S")) {
String sql = "exec up_CreateSettlePayCallBack '" + OutTradeNO + "' ,'" + TransactionID + "' , '" + PayCardNO
+ "' , '" + PayAmount + "' , '" + paydate + "' , '" + PayChannel + "' ";
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
} else {// 普通订单
String[] ary = OutTradeNO.split("_", 2);
returnMap = this.paySuccess(ary[0], new BigDecimal(PayAmount), OpenID, TransactionID, OutTradeNO,
DateUtil.parse(paydate, DateUtil.FMT_DATE_SECOND));
}
return returnMap;
}
// 提交结算付款记录
@Override
......
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