Commit 80678b52 authored by 张永's avatar 张永

1

parent 0d98f618
...@@ -180,14 +180,15 @@ public class OrderController { ...@@ -180,14 +180,15 @@ public class OrderController {
@ApiImplicitParam(paramType = "query", name="sOpenID", dataType = "String", required = true), @ApiImplicitParam(paramType = "query", name="sOpenID", dataType = "String", required = true),
@ApiImplicitParam(paramType = "query", name="sTransTraceNO", dataType = "String", required = true, value="微信支付订单号"), @ApiImplicitParam(paramType = "query", name="sTransTraceNO", dataType = "String", required = true, value="微信支付订单号"),
@ApiImplicitParam(paramType = "query", name="sOutTradeNO", dataType = "String", required = true, value="商户支付单号"), @ApiImplicitParam(paramType = "query", name="sOutTradeNO", dataType = "String", required = true, value="商户支付单号"),
@ApiImplicitParam(paramType = "query", name="PayTypeID", dataType = "String", required = true, value=""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"), @ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = true, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"), @ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
}) })
@RequestMapping(value = "/paySuccess",method=RequestMethod.POST) @RequestMapping(value = "/paySuccess",method=RequestMethod.POST)
public String paySuccess(String sSalesOrderID,BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO,String PayTypeID,String PayType) { public String paySuccess(String sSalesOrderID,BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, String sOutTradeNO,String PayTypeID) {
try { try {
String[] ary = sOutTradeNO.split("_", 2); String[] ary = sOutTradeNO.split("_", 2);
List<Map<String, Object>> result = orderService.paySuccess(ary[0], nPayAmount, sOpenID, sTransTraceNO, new Date()); List<Map<String, Object>> result = orderService.paySuccess(ary[0], nPayAmount, sOpenID, sTransTraceNO, new Date(),PayTypeID);
return Rjx.jsonOk().set("list", result).toJson(); return Rjx.jsonOk().set("list", result).toJson();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -224,7 +225,7 @@ public class OrderController { ...@@ -224,7 +225,7 @@ public class OrderController {
} }
@ApiOperation("微信小程序支付回调") /*@ApiOperation("微信小程序支付回调")
@RequestMapping(value = "/wxPayNotify",method= {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/wxPayNotify",method= {RequestMethod.GET, RequestMethod.POST})
public String wxPayNotify(HttpServletRequest request) { public String wxPayNotify(HttpServletRequest request) {
Map<String, String> result = new HashMap<String, String>(); Map<String, String> result = new HashMap<String, String>();
...@@ -252,7 +253,7 @@ public class OrderController { ...@@ -252,7 +253,7 @@ public class OrderController {
String sOutTradeNO = out_trade_no; String sOutTradeNO = out_trade_no;
Date date = DateUtil.parse(payEndTime, "yyyyMMddHHmmss"); Date date = DateUtil.parse(payEndTime, "yyyyMMddHHmmss");
BigDecimal nPayAmount = new BigDecimal(total_fee); BigDecimal nPayAmount = new BigDecimal(total_fee);
orderService.paySuccess(sOutTradeNO, nPayAmount, sOpenID, sTransTraceNO, date); orderService.paySuccess(sOutTradeNO, nPayAmount, sOpenID, sTransTraceNO, date,"120");
} }
result.put("return_code", "SUCCESS"); result.put("return_code", "SUCCESS");
result.put("return_msg", "OK"); result.put("return_msg", "OK");
...@@ -262,7 +263,7 @@ public class OrderController { ...@@ -262,7 +263,7 @@ public class OrderController {
result.put("return_msg", e.getMessage()); result.put("return_msg", e.getMessage());
} }
return XmlUtil.toXml(result); return XmlUtil.toXml(result);
} } */
@Transactional @Transactional
@ApiOperation("取消未付款订单") @ApiOperation("取消未付款订单")
......
...@@ -22,7 +22,7 @@ public interface OrderService { ...@@ -22,7 +22,7 @@ public interface OrderService {
public String getOrderDetail(String salesOrderId); public String getOrderDetail(String salesOrderId);
public List<Map<String, Object>> paySuccess(String sOutTradeNO, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, Date dPayDateTime); public List<Map<String, Object>> paySuccess(String sOutTradeNO, BigDecimal nPayAmount, String sOpenID, String sTransTraceNO, Date dPayDateTime,String PayTypeID);
public String getSubOrderDetail(String subOrderID); public String getSubOrderDetail(String subOrderID);
......
...@@ -328,8 +328,15 @@ public class OrderServiceImpl implements OrderService { ...@@ -328,8 +328,15 @@ public class OrderServiceImpl implements OrderService {
@Transactional @Transactional
public List<Map<String, Object>> paySuccess(String sOutTradeNO, BigDecimal nPayAmount, String sOpenID, public List<Map<String, Object>> paySuccess(String sOutTradeNO, BigDecimal nPayAmount, String sOpenID,
String sTransTraceNO, Date dPayDateTime) { String sTransTraceNO, Date dPayDateTime,String PayTypeID) {
List<Map<String, Object>> returnMap = new ArrayList<Map<String, Object>>();
String sql = "exec up_B2BSalesOrderPayUpdate '" + sOutTradeNO + "' ,'" + sTransTraceNO + "' , '" + sOpenID
+ "' , '" + nPayAmount + "' , '" + PayTypeID + "' ";
List<Map<String, Object>> returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
/*List<Map<String, Object>> returnMap = new ArrayList<Map<String, Object>>();
String sSalesOrderID =""; String sSalesOrderID ="";
try { try {
...@@ -340,28 +347,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -340,28 +347,7 @@ public class OrderServiceImpl implements OrderService {
} }
/* 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);
Map<String, Object> map = new HashMap<String, Object>();
map.put("sSalesOrderID", sSalesOrderID);
map.put("nIdx", ++nIdx);
map.put("sPayTypeID", "120");
map.put("sPayType", "微信支付(小程序)");
map.put("nPayAmount", nPayAmount);
map.put("sOutTradeNO", sOutTradeNO);
map.put("nPayDisAmount", BigDecimal.ZERO);
map.put("dPayDateTime", dPayDateTime);
map.put("sTransTraceNO", sTransTraceNO);
map.put("sPayCardNO", sOpenID);
map.put("nTag", 0);
map.put("dLastUpdateTime", new Date());
Dialect dialect = jdbcTemplate.getDialect();
Sql sqlDesc = dialect.argsInsert("tSalesOrderPay", map);
String sql = "if not exists (select * from tSalesOrderPay where sTransTraceNO = '" + sTransTraceNO + "') "
+ sqlDesc.getSql();
jdbcTemplate.update(sql, sqlDesc.getArgs());*/
if(StringUtil.isNotBlank(sSalesOrderID)) { if(StringUtil.isNotBlank(sSalesOrderID)) {
jdbcTemplate.update("UPDATE tSalesOrderPay SET sTransTraceNO = ? , dPayDateTime = ? ,dLastUpdateTime = getdate() WHERE sOutTradeNO = ? ",sTransTraceNO,DateUtil.format(dPayDateTime, DateUtil.FMT_DATE_SECOND),sOutTradeNO); jdbcTemplate.update("UPDATE tSalesOrderPay SET sTransTraceNO = ? , dPayDateTime = ? ,dLastUpdateTime = getdate() WHERE sOutTradeNO = ? ",sTransTraceNO,DateUtil.format(dPayDateTime, DateUtil.FMT_DATE_SECOND),sOutTradeNO);
jdbcTemplate.update("update tSalesOrder set nOrderStatus = nOrderStatus|32 where sSalesOrderID = ?", jdbcTemplate.update("update tSalesOrder set nOrderStatus = nOrderStatus|32 where sSalesOrderID = ?",
...@@ -374,7 +360,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -374,7 +360,7 @@ public class OrderServiceImpl implements OrderService {
} }
}else { }else {
logger.info("支付单号:"+sOutTradeNO +"未找到对应的订单号。"); logger.info("支付单号:"+sOutTradeNO +"未找到对应的订单号。");
} }*/
return returnMap; return returnMap;
} }
...@@ -1135,7 +1121,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -1135,7 +1121,7 @@ public class OrderServiceImpl implements OrderService {
returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0); returnMap = jdbcTemplate.executeMutil(sql).getDatas().get(0);
} else {// 普通订单 } else {// 普通订单
String[] ary = OutTradeNO.split("_", 2); String[] ary = OutTradeNO.split("_", 2);
returnMap = this.paySuccess(ary[0], new BigDecimal(PayAmount), OpenID, TransactionID,DateUtil.parse(paydate, DateUtil.FMT_DATE_SECOND)); returnMap = this.paySuccess(ary[0], new BigDecimal(PayAmount), OpenID, TransactionID,DateUtil.parse(paydate, DateUtil.FMT_DATE_SECOND),"120");
} }
return returnMap; return returnMap;
} }
......
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