| @@ -35,6 +35,9 @@ import java.util.*; | |||||
| public class WxPayOrderServiceImpl implements WxPayOrderService { | public class WxPayOrderServiceImpl implements WxPayOrderService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| WxPayOrderServiceImpl wxPayOrderServiceImpl; | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoMapper wxAppinfoMapper; | WxAppinfoMapper wxAppinfoMapper; | ||||
| @@ -115,8 +118,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| "\"REQUIRE_POST_METHOD\":{\"detail\":\"请使用post方法\",\"reason\":\"未使用post传递参数\",\"resolution\":\"请检查请求参数是否通过post方法提交\"}," + | "\"REQUIRE_POST_METHOD\":{\"detail\":\"请使用post方法\",\"reason\":\"未使用post传递参数\",\"resolution\":\"请检查请求参数是否通过post方法提交\"}," + | ||||
| "\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}"); | "\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}"); | ||||
| //方法必须为public AopContext.currentProxy() | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| private void handleSuccessOrder(WxPayOrder oldRecord,WxOrder order,Map<String, String> retMap) { | |||||
| public void handleSuccessOrder(WxPayOrder oldRecord,WxOrder order,Map<String, String> retMap) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| if (oldRecord.getPayOrderStatus() != EnumPayStatus.PAY_STATUS_SUCCESS.getCode()) { | if (oldRecord.getPayOrderStatus() != EnumPayStatus.PAY_STATUS_SUCCESS.getCode()) { | ||||
| //更新wxPayOrder | //更新wxPayOrder | ||||
| @@ -340,7 +344,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_PAYING.getCode(),"订单微信查询支付状态失败!"); | throw new MallinkException(ErrorCode.PAY_ORDER_PAYING.getCode(),"订单微信查询支付状态失败!"); | ||||
| } | } | ||||
| //如果是支付错误,可以重新支付 | //如果是支付错误,可以重新支付 | ||||
| }else if(oldRecord.getPayOrderStatus()==EnumPayStatus.PAY_STATUS_FAIL.getCode()) { | |||||
| }else if(oldRecord.getPayOrderStatus()==EnumPayStatus.PAY_STATUS_FAIL.getCode()|| | |||||
| oldRecord.getPayOrderStatus()==EnumPayStatus.PAY_STATUS_NOTPAY.getCode()) { | |||||
| oldRecord.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | oldRecord.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | ||||
| //重新设置支付no | //重新设置支付no | ||||
| Long payno = idworker.nextId(); | Long payno = idworker.nextId(); | ||||
| @@ -376,7 +381,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| // 支付单号 | // 支付单号 | ||||
| record.setPayOrderNo(payOrderNo); | record.setPayOrderNo(payOrderNo); | ||||
| record.setPayAmount(order.getPayment()); | record.setPayAmount(order.getPayment()); | ||||
| record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||||
| record.setPayFrom(payWay.getCode()); | |||||
| record.setPayVendor(payWay.getCode()); | |||||
| record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | ||||
| record.setShare(isShare.getCode()); | record.setShare(isShare.getCode()); | ||||
| if (isShare == EnumPayShare.YES) { | if (isShare == EnumPayShare.YES) { | ||||
| @@ -555,8 +561,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| } | } | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| logger.error("createwxpayorder error:",e); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("createwxpayorder error:",e); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||