| @@ -12,8 +12,6 @@ CREATE TABLE `wx_car_pay_order` ( | |||||
| `transaction_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信生成的订单号', | `transaction_id` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '微信生成的订单号', | ||||
| `park_order_no` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '车场订单号', | `park_order_no` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '车场订单号', | ||||
| `merchant_account` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商户收款账户', | `merchant_account` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商户收款账户', | ||||
| `merchant_id` bigint(20) NOT NULL COMMENT '商户编号', | |||||
| `merchant_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商户名称', | |||||
| `park_notify` int(1) NOT NULL DEFAULT '0' COMMENT '是否已通知车场EnumYesOrNo', | `park_notify` int(1) NOT NULL DEFAULT '0' COMMENT '是否已通知车场EnumYesOrNo', | ||||
| `notify_fail_reason` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '通知失败原因', | `notify_fail_reason` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '通知失败原因', | ||||
| `notify_count` int(3) NOT NULL DEFAULT '0' COMMENT '通知次数', | `notify_count` int(3) NOT NULL DEFAULT '0' COMMENT '通知次数', | ||||
| @@ -489,18 +489,17 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| String receiverAccount = receiver.getReceiverAccount(); | String receiverAccount = receiver.getReceiverAccount(); | ||||
| int rlength = receiverAccount.length(); | int rlength = receiverAccount.length(); | ||||
| //最大128 | |||||
| StringBuffer attachSb = new StringBuffer("{") | |||||
| .append("\"u\":").append(user.getUserId()) | |||||
| .append(",\"uh\":\"").append(user.getPhone()).append("\"") | |||||
| .append(",\"car:\":\"").append(carNumber).append("\""); | |||||
| //最大128 cuserId,cuserPhone,carNumber,merchantId,merchantAccount,parkOrderNo | |||||
| StringBuffer attachSb = new StringBuffer() | |||||
| .append(user.getUserId()).append(",") | |||||
| .append(user.getPhone()).append(",") | |||||
| .append(carNumber).append(","); | |||||
| if (rlength > 4) { | if (rlength > 4) { | ||||
| attachSb.append(",\"ma\":\"").append(receiverAccount.substring(rlength-4,rlength)).append("\""); | |||||
| attachSb.append(receiverAccount.substring(rlength-4,rlength)).append(","); | |||||
| }else { | }else { | ||||
| attachSb.append(",\"ma\":\"").append(receiverAccount).append("\""); | |||||
| attachSb.append(receiverAccount).append(","); | |||||
| } | } | ||||
| attachSb.append(",\"mid\":").append(parkMerchant.getId()) | |||||
| .append("}"); | |||||
| attachSb.append(payOrder.getParkOrderNumber()); | |||||
| //创建微信支付订单 | //创建微信支付订单 | ||||
| boolean isIsv = false; | boolean isIsv = false; | ||||
| Integer isvModel = (Integer)receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv); | Integer isvModel = (Integer)receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv); | ||||
| @@ -63,12 +63,6 @@ public class WxCarPayOrder extends TenantEntity { | |||||
| @Excel(name = "商户收款账户", width = 20, orderNum = "10") | @Excel(name = "商户收款账户", width = 20, orderNum = "10") | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户收款账户",name="merchantAccount") | @io.swagger.annotations.ApiModelProperty(value="商户收款账户",name="merchantAccount") | ||||
| private String merchantAccount; | private String merchantAccount; | ||||
| @Excel(name = "商户编号", width = 20, orderNum = "11") | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户编号",name="merchantId") | |||||
| private Long merchantId; | |||||
| @Excel(name = "商户名称", width = 20, orderNum = "12") | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名称",name="merchantName") | |||||
| private String merchantName; | |||||
| @Excel(name = "是否已通知车场", width = 20, replace = {"已通知成功_1"}, orderNum = "13") | @Excel(name = "是否已通知车场", width = 20, replace = {"已通知成功_1"}, orderNum = "13") | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否已通知车场EnumYesOrNo",name="parkNotify") | @io.swagger.annotations.ApiModelProperty(value="是否已通知车场EnumYesOrNo",name="parkNotify") | ||||
| private Integer parkNotify; | private Integer parkNotify; | ||||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxPark; | |||||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | import com.iformall.domain.vo.WxCouponOrderCarCVo; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| /** | /** | ||||
| @@ -62,7 +63,7 @@ public interface ParkAdapterService { | |||||
| /** | /** | ||||
| * 停车订单成功通知车场 | * 停车订单成功通知车场 | ||||
| */ | */ | ||||
| void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception; | |||||
| ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception; | |||||
| /** | /** | ||||
| * 查询停车场状态, 给老的集成用 | * 查询停车场状态, 给老的集成用 | ||||
| @@ -19,8 +19,6 @@ public class ParkNotifyPaid implements Serializable{ | |||||
| /*停车场返回的订单ID**/ | /*停车场返回的订单ID**/ | ||||
| private String tenantId; | private String tenantId; | ||||
| /*订单编号**/ | |||||
| private String payOrderNo; | |||||
| /*停车场订单编号**/ | /*停车场订单编号**/ | ||||
| private String parkOrderNo; | private String parkOrderNo; | ||||
| /*支付金额**/ | /*支付金额**/ | ||||
| @@ -0,0 +1,23 @@ | |||||
| package com.iformall.service.park.entity; | |||||
| import java.io.Serializable; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| @Data | |||||
| @AllArgsConstructor | |||||
| public class ParkPaidNotifyResult implements Serializable{ | |||||
| private static final long serialVersionUID = 6478840764729191197L; | |||||
| private boolean isSuccess; | |||||
| private Object result; | |||||
| private String errorMsg; | |||||
| } | |||||
| @@ -18,6 +18,7 @@ import com.iformall.enums.EnumCouponUnit; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| @@ -122,8 +123,9 @@ public class BoLinkParkService extends BaseParkService implements ParkAdapterSer | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) | |||||
| throws Exception { | throws Exception { | ||||
| return null; | |||||
| } | } | ||||
| @@ -25,6 +25,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| import com.iformall.service.park.impl.util.ParkHelper; | import com.iformall.service.park.impl.util.ParkHelper; | ||||
| @@ -205,7 +206,8 @@ public class CYFParkService extends BaseParkService implements ParkAdapterServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| @@ -88,7 +89,8 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -33,6 +33,7 @@ import com.iformall.service.WxParkService; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| import com.iformall.service.park.impl.util.ParkHelper; | import com.iformall.service.park.impl.util.ParkHelper; | ||||
| @@ -198,8 +199,12 @@ public class FuteParkService extends BaseParkService implements ParkAdapterServi | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| fute.notifyPaid(park, notifyPaid.getParkOrderNo(), notifyPaid.getFee()); | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| String result = fute.notifyPaid(park, notifyPaid.getParkOrderNo(), notifyPaid.getFee()); | |||||
| if (StringUtils.isBlank(result)) { | |||||
| return null; | |||||
| } | |||||
| return new ParkPaidNotifyResult(true, result, null); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -33,6 +33,7 @@ import com.iformall.service.WxParkService; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| import com.iformall.service.park.impl.util.ParkHelper; | import com.iformall.service.park.impl.util.ParkHelper; | ||||
| @@ -240,7 +241,8 @@ public class HaiKangWeiShiParkService extends BaseParkService implements ParkAda | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -32,6 +32,7 @@ import com.iformall.service.WxParkService; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| import com.iformall.service.park.impl.util.ParkHelper; | import com.iformall.service.park.impl.util.ParkHelper; | ||||
| @@ -349,7 +350,8 @@ public class JieShunParkService extends BaseParkService implements ParkAdapterSe | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -21,6 +21,7 @@ import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| @@ -107,6 +108,7 @@ public class ShangAnParkService extends BaseParkService implements ParkAdapterSe | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -32,6 +32,7 @@ import com.iformall.service.WxScoreRulesService; | |||||
| import com.iformall.service.park.ParkAdapterService; | import com.iformall.service.park.ParkAdapterService; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | import com.iformall.service.park.entity.ParkStopFee; | ||||
| import com.iformall.service.park.impl.BaseParkService; | import com.iformall.service.park.impl.BaseParkService; | ||||
| import com.iformall.service.park.impl.util.ParkHelper; | import com.iformall.service.park.impl.util.ParkHelper; | ||||
| @@ -268,6 +269,7 @@ public class TJDParkService extends BaseParkService implements ParkAdapterServic | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -26,8 +26,8 @@ public interface WxParkPayService { | |||||
| public String handlePaidCallBack(String tenantId,Map<String, String> paramMap); | public String handlePaidCallBack(String tenantId,Map<String, String> paramMap); | ||||
| public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber,String payOrderNo, | |||||
| Integer fee,Date paidTime,String transcationId,String merchantAccount,Long merchantId,String merchantName,String userPhone) throws Exception; | |||||
| public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber,String parkOrderNo, | |||||
| Integer fee,Date paidTime,String transcationId,String merchantAccount,String userPhone) throws Exception; | |||||
| public WxCarPayOrder detailWxCarPayOrder(Long id,String tenantId); | public WxCarPayOrder detailWxCarPayOrder(Long id,String tenantId); | ||||
| @@ -33,6 +33,7 @@ import com.iformall.service.WxPayAccountService; | |||||
| import com.iformall.service.park.ParkFactory; | import com.iformall.service.park.ParkFactory; | ||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | import com.iformall.service.park.entity.ParkCreatePayOrder; | ||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | import com.iformall.service.park.entity.ParkNotifyPaid; | ||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.pay.PayServiceFactory; | import com.iformall.service.pay.PayServiceFactory; | ||||
| import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | ||||
| import com.iformall.service.pay.service.pay.wx.v2.miniApp.appPay.WxMiniAppPayAdapterService; | import com.iformall.service.pay.service.pay.wx.v2.miniApp.appPay.WxMiniAppPayAdapterService; | ||||
| @@ -159,23 +160,34 @@ public class WxParkPayServiceImpl implements WxParkPayService { | |||||
| Integer cashFee = Integer.parseInt(cashFeeStr); | Integer cashFee = Integer.parseInt(cashFeeStr); | ||||
| if (cashFee > 0 ) { | if (cashFee > 0 ) { | ||||
| try { | try { | ||||
| String payOrderNo = paramMap.get("out_trade_no"); | |||||
| //String payOrderNo = paramMap.get("out_trade_no"); | |||||
| String time_end = paramMap.get("time_end"); | String time_end = paramMap.get("time_end"); | ||||
| String transcationId = paramMap.get("transaction_id"); | String transcationId = paramMap.get("transaction_id"); | ||||
| String attach = paramMap.get("attach"); | |||||
| JSONObject attachObj = JSON.parseObject(attach); | |||||
| TenantEntity teq = new TenantEntity(); | TenantEntity teq = new TenantEntity(); | ||||
| teq.setTenantId(tenantId); | teq.setTenantId(tenantId); | ||||
| WxPark wxPark = getCurrentPark(teq); | WxPark wxPark = getCurrentPark(teq); | ||||
| Integer carVendor = wxPark.getVendorType(); | |||||
| Long cUserId = attachObj.getLong("u"); | |||||
| String carNumber = attachObj.getString("car"); | |||||
| String merchantAccount = attachObj.getString("ma"); | |||||
| Long merchantId = attachObj.getLong("mid"); | |||||
| String userPhone = attachObj.getString("uh"); | |||||
| handlePaidSuccess(wxPark,cUserId,carVendor,carNumber,payOrderNo,Integer.parseInt(cashFeeStr), | |||||
| Integer carVendor = wxPark.getVendorType(); | |||||
| String attach = paramMap.get("attach"); | |||||
| Long cUserId = null; | |||||
| String userPhone = null; | |||||
| String carNumber = null; | |||||
| String merchantAccount = null; | |||||
| String parkOrderNo = null; | |||||
| if (!StringUtils.isBlank(attach)) { | |||||
| String[] attrs = attach.split(","); | |||||
| if (attrs.length == 5) { | |||||
| cUserId = Long.parseLong(attrs[0]); | |||||
| userPhone = attrs[1]; | |||||
| carNumber = attrs[2]; | |||||
| merchantAccount = attrs[3]; | |||||
| parkOrderNo = attrs[4]; | |||||
| } | |||||
| } | |||||
| handlePaidSuccess(wxPark,cUserId,carVendor,carNumber,parkOrderNo,Integer.parseInt(cashFeeStr), | |||||
| DateUtils.string2Date(time_end, DateUtils.DATE_PATTERN_ALL_NOSPACE).getTime(),transcationId, | DateUtils.string2Date(time_end, DateUtils.DATE_PATTERN_ALL_NOSPACE).getTime(),transcationId, | ||||
| merchantAccount,merchantId,"停车商户",userPhone); | |||||
| merchantAccount,userPhone); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("handlePaidCallBackError.",e); | logger.error("handlePaidCallBackError.",e); | ||||
| return notifyErrorResult(e.getMessage()); | return notifyErrorResult(e.getMessage()); | ||||
| @@ -194,16 +206,16 @@ public class WxParkPayServiceImpl implements WxParkPayService { | |||||
| @Override | @Override | ||||
| public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber, | public void handlePaidSuccess(WxPark wxPark,Long cUserId,Integer carVendor,String carNumber, | ||||
| String payOrderNo,Integer fee,Date paidTime,String transcationId,String merchantAccount, | |||||
| Long merchantId,String merchantName,String userPhone) throws Exception{ | |||||
| String parkOrderNo,Integer fee,Date paidTime,String transcationId,String merchantAccount, | |||||
| String userPhone) throws Exception{ | |||||
| //查询该笔订单是否已经存在 | //查询该笔订单是否已经存在 | ||||
| WxCarPayOrder payOrder = wxCarPayOrderMapper.findOneByParkOderNo(payOrderNo, wxPark.getTenantId()); | |||||
| String parkOrderNo = ParkCreatePayOrder.getRealParkOrderNumber(payOrderNo,EnumCarVendor.getEnum(carVendor)); | |||||
| WxCarPayOrder payOrder = wxCarPayOrderMapper.findOneByParkOderNo(parkOrderNo, wxPark.getTenantId()); | |||||
| //String parkOrderNo = ParkCreatePayOrder.getRealParkOrderNumber(payOrderNo,EnumCarVendor.getEnum(carVendor)); | |||||
| if (null == payOrder) { | if (null == payOrder) { | ||||
| //此处需要加锁,防止并发设置 | //此处需要加锁,防止并发设置 | ||||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | ||||
| String timeStr = String.valueOf(time); | String timeStr = String.valueOf(time); | ||||
| boolean stocksetlock = redisLock.lock("carPayOrderLock_"+payOrderNo, timeStr); | |||||
| boolean stocksetlock = redisLock.lock("carPayOrderLock_"+parkOrderNo, timeStr); | |||||
| if (stocksetlock) { | if (stocksetlock) { | ||||
| try { | try { | ||||
| //创建停车支付订单记录 | //创建停车支付订单记录 | ||||
| @@ -221,17 +233,29 @@ public class WxParkPayServiceImpl implements WxParkPayService { | |||||
| payOrder.setTransactionId(transcationId); | payOrder.setTransactionId(transcationId); | ||||
| payOrder.setParkOrderNo(parkOrderNo); | payOrder.setParkOrderNo(parkOrderNo); | ||||
| payOrder.setMerchantAccount(merchantAccount); | payOrder.setMerchantAccount(merchantAccount); | ||||
| payOrder.setMerchantId(merchantId); | |||||
| payOrder.setMerchantName(merchantName); | |||||
| payOrder.setCarVendor(carVendor); | payOrder.setCarVendor(carVendor); | ||||
| payOrder.setcUserPhone(userPhone); | payOrder.setcUserPhone(userPhone); | ||||
| wxCarPayOrderMapper.insert(payOrder); | wxCarPayOrderMapper.insert(payOrder); | ||||
| //通知车场支付成功 | //通知车场支付成功 | ||||
| try { | try { | ||||
| parkFactory.getParkService(carVendor).notifyPaid(wxPark,new ParkNotifyPaid(wxPark.getTenantId(),payOrderNo,parkOrderNo,fee,paidTime)); | |||||
| payOrder.setParkNotify(EnumYesOrNo.YES.getCode()); | |||||
| payOrder.setUpdateTime(new Date()); | |||||
| wxCarPayOrderMapper.updateById(payOrder); | |||||
| ParkPaidNotifyResult notifyResult = parkFactory.getParkService(carVendor).notifyPaid(wxPark,new ParkNotifyPaid(wxPark.getTenantId(),parkOrderNo,fee,paidTime)); | |||||
| if (null != notifyResult) { | |||||
| if (notifyResult.isSuccess()) { | |||||
| payOrder.setParkNotify(EnumYesOrNo.YES.getCode()); | |||||
| payOrder.setUpdateTime(new Date()); | |||||
| wxCarPayOrderMapper.updateById(payOrder); | |||||
| }else { | |||||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||||
| payOrder.setNotifyFailReason(notifyResult.getErrorMsg()); | |||||
| payOrder.setUpdateTime(new Date()); | |||||
| wxCarPayOrderMapper.updateById(payOrder); | |||||
| } | |||||
| }else { | |||||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | |||||
| payOrder.setNotifyFailReason("车厂同步接口请求未返回结果"); | |||||
| payOrder.setUpdateTime(new Date()); | |||||
| wxCarPayOrderMapper.updateById(payOrder); | |||||
| } | |||||
| }catch(Exception e) { | }catch(Exception e) { | ||||
| payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | payOrder.setParkNotify(EnumYesOrNo.NO.getCode()); | ||||
| payOrder.setNotifyFailReason(e.getMessage()); | payOrder.setNotifyFailReason(e.getMessage()); | ||||
| @@ -240,9 +264,9 @@ public class WxParkPayServiceImpl implements WxParkPayService { | |||||
| } | } | ||||
| }catch(Exception e) { | }catch(Exception e) { | ||||
| logger.error("handlePaidSuccess fail.",e); | logger.error("handlePaidSuccess fail.",e); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"支付同步失败"+payOrderNo); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"支付同步失败"+parkOrderNo); | |||||
| }finally { | }finally { | ||||
| redisLock.unlock("carPayOrderLock_"+payOrderNo, timeStr); | |||||
| redisLock.unlock("carPayOrderLock_"+parkOrderNo, timeStr); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -15,8 +15,6 @@ | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/> | <result column="transaction_id" jdbcType="VARCHAR" property="transactionId"/> | ||||
| <result column="park_order_no" jdbcType="VARCHAR" property="parkOrderNo"/> | <result column="park_order_no" jdbcType="VARCHAR" property="parkOrderNo"/> | ||||
| <result column="merchant_account" jdbcType="VARCHAR" property="merchantAccount"/> | <result column="merchant_account" jdbcType="VARCHAR" property="merchantAccount"/> | ||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName"/> | |||||
| <result column="park_notify" jdbcType="INTEGER" property="parkNotify"/> | <result column="park_notify" jdbcType="INTEGER" property="parkNotify"/> | ||||
| <result column="notify_fail_reason" jdbcType="VARCHAR" property="notifyFailReason"/> | <result column="notify_fail_reason" jdbcType="VARCHAR" property="notifyFailReason"/> | ||||
| <result column="notify_count" jdbcType="INTEGER" property="notifyCount"/> | <result column="notify_count" jdbcType="INTEGER" property="notifyCount"/> | ||||
| @@ -25,7 +23,7 @@ | |||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`c_user_id`,`c_user_phone`,`car_number`,`pay_amount`, | `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`c_user_id`,`c_user_phone`,`car_number`,`pay_amount`, | ||||
| `pay_time`,`transaction_id`,`park_order_no`,`merchant_account`,`merchant_id`,`merchant_name`,`park_notify`, | |||||
| `pay_time`,`transaction_id`,`park_order_no`,`merchant_account`,`park_notify`, | |||||
| `notify_fail_reason`,`notify_count`,`car_vendor` | `notify_fail_reason`,`notify_count`,`car_vendor` | ||||
| </sql> | </sql> | ||||
| @@ -76,14 +74,6 @@ | |||||
| and `merchant_account` like concat('%', #{merchantAccount},'%') | and `merchant_account` like concat('%', #{merchantAccount},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != merchantName "> | |||||
| and `merchant_name` like concat('%', #{merchantName},'%') | |||||
| </if> | |||||
| <if test=" null != cUserPhone "> | <if test=" null != cUserPhone "> | ||||
| and `c_user_phone` like concat('%', #{cUserPhone},'%') | and `c_user_phone` like concat('%', #{cUserPhone},'%') | ||||
| </if> | </if> | ||||