|
@@ -65,6 +65,7 @@ import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.net.InetAddress;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -2260,10 +2261,20 @@ public class OrderServiceImpl implements OrderService {
|
|
|
|
|
|
private void wxPay(SysUserEntity user, String parCode, Map resultObj, OrderVo order, OrderProcessRecordEntity processRecordEntity, OrderWXPayRecordEntity orderWXPayRecordCurrent, StoreEntity store) throws ParseException {
|
|
|
R r;
|
|
|
+
|
|
|
+ String ip = "127.0.0.1";
|
|
|
+ try {
|
|
|
+ InetAddress ia=InetAddress.getLocalHost();
|
|
|
+// String localname=ia.getHostName();
|
|
|
+ ip=ia.getHostAddress();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
WechatMicropayApiResult wechatMicropayApiResult = WechatUtil
|
|
|
.wxMicropay(store.getMerchName() + "-" + store.getStoreName(), order.getOrderBizType(), null,
|
|
|
- orderWXPayRecordCurrent.getOutTradeNoWX(), 0.01d/*order.getActual_price().doubleValue()*/,
|
|
|
- "127.0.0.1", parCode);
|
|
|
+ orderWXPayRecordCurrent.getOutTradeNoWX(), order.getActual_price().doubleValue(),
|
|
|
+ ip, parCode);
|
|
|
orderWXPayRecordService.updateRecord(orderWXPayRecordCurrent.getId(), wechatMicropayApiResult);
|
|
|
|
|
|
|
|
@@ -2272,6 +2283,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// 修改订单状态
|
|
|
//当支付成功时,修改订单,并把其他支付记录撤销
|
|
|
if (WechatUtil.WXTradeState.SUCCESS.getCode().equals(wechatMicropayApiResult.getTrade_state())) {
|
|
|
+
|
|
|
//查询当前订单所有的支付记录
|
|
|
List<OrderWXPayRecordEntity> orderWXPayRecordEntitys =
|
|
|
orderWXPayRecordService.getRecordsByOutTradeNo(order.getOrder_sn());
|
|
@@ -2297,6 +2309,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ LOGGER.info("wechatMicropayApiResult.getTransaction_id()"+wechatMicropayApiResult.getTransaction_id());
|
|
|
+
|
|
|
+ Map orderRaram = Maps.newHashMap();
|
|
|
+ orderRaram.put("payTransactionId", wechatMicropayApiResult.getTransaction_id());
|
|
|
+ orderRaram.put("orderId", order.getId());
|
|
|
+ orderDao.updateOrderInfo(orderRaram);
|
|
|
this.confirmPay(order.getId(), Dict.payFlag.item_weixin.getItem(), orderWXPayRecordCurrent.getOutTradeNoWX());
|
|
|
|
|
|
// 设置支付单完成时间
|
|
@@ -2472,10 +2490,12 @@ public class OrderServiceImpl implements OrderService {
|
|
|
// return R.error(refundResult);
|
|
|
// }
|
|
|
// } else{
|
|
|
+ LOGGER.info("微信退款开始");
|
|
|
refundResult = wxRefund(orderInfo,totalActualPrice);
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(refundResult)){
|
|
|
return R.error(refundResult);
|
|
|
}
|
|
|
+ LOGGER.info("微信退款");
|
|
|
// }
|
|
|
}
|
|
|
// 支付宝的退款代码
|
|
@@ -2667,7 +2687,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderInfo.setCreateTime(new Date());
|
|
|
orderInfo.setModTime(new Date());
|
|
|
orderInfo.setPayMobile(loginUser.getMobile());
|
|
|
- orderInfo.setPayTransactionId("");
|
|
|
+// orderInfo.setPayTransactionId(orderInfo.getOrder_sn());
|
|
|
orderInfo.setIsScan("0");//默认未扫描
|
|
|
|
|
|
orderInfo.setPayMobile(loginUser.getMobile());
|