|
|
@@ -22,6 +22,7 @@ import com.simple.pay.*; |
|
|
import com.simple.service.WxOrderService; |
|
|
import com.simple.service.WxOrderService; |
|
|
import com.simple.service.WxPayOrderService; |
|
|
import com.simple.service.WxPayOrderService; |
|
|
import com.simple.utils.*; |
|
|
import com.simple.utils.*; |
|
|
|
|
|
import io.swagger.models.auth.In; |
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.log4j.Logger; |
|
|
import org.apache.log4j.Logger; |
|
|
@@ -99,7 +100,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
public ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { |
|
|
public ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { |
|
|
final IdWorker idworker = IdWorker.get(); |
|
|
final IdWorker idworker = IdWorker.get(); |
|
|
|
|
|
|
|
|
boolean isShare = false; |
|
|
|
|
|
|
|
|
EnumPayShare isShare = EnumPayShare.NO; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 1. check 订单 |
|
|
// 1. check 订单 |
|
|
@@ -117,17 +118,17 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
} |
|
|
} |
|
|
WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); |
|
|
WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); |
|
|
if (payAccount.isShare()) { |
|
|
if (payAccount.isShare()) { |
|
|
isShare = true; |
|
|
|
|
|
|
|
|
isShare = EnumPayShare.YES; |
|
|
} |
|
|
} |
|
|
// 1.5 check 分账 receive |
|
|
// 1.5 check 分账 receive |
|
|
if (isShare) { |
|
|
|
|
|
|
|
|
if (isShare == EnumPayShare.YES) { |
|
|
WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); |
|
|
WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); |
|
|
receiver.setMerchantId(order.getMerchantId()); |
|
|
receiver.setMerchantId(order.getMerchantId()); |
|
|
List<WxProfitSharingReceiver> merList = wxProfitSharingReceiverMapper.findList(receiver); |
|
|
List<WxProfitSharingReceiver> merList = wxProfitSharingReceiverMapper.findList(receiver); |
|
|
if (merList.size() > 0) { |
|
|
if (merList.size() > 0) { |
|
|
isShare = true; |
|
|
|
|
|
|
|
|
isShare = EnumPayShare.YES; |
|
|
} else { |
|
|
} else { |
|
|
isShare = false; |
|
|
|
|
|
|
|
|
isShare = EnumPayShare.NO; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 2. check 是否有支付订单 |
|
|
// 2. check 是否有支付订单 |
|
|
@@ -140,7 +141,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
payOrderNo = String.valueOf(id); |
|
|
payOrderNo = String.valueOf(id); |
|
|
record.setId(id); |
|
|
record.setId(id); |
|
|
record.setTenantId(user.getTenantId()); |
|
|
record.setTenantId(user.getTenantId()); |
|
|
record.setCUserId(user.getId()); |
|
|
|
|
|
|
|
|
record.setcUserId(user.getId()); |
|
|
record.setCreateTime(currentDate); |
|
|
record.setCreateTime(currentDate); |
|
|
record.setUpdateTime(currentDate); |
|
|
record.setUpdateTime(currentDate); |
|
|
record.setPayTimeStart(currentDate); |
|
|
record.setPayTimeStart(currentDate); |
|
|
@@ -150,7 +151,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
record.setPayAmount(order.getPayment()); |
|
|
record.setPayAmount(order.getPayment()); |
|
|
record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); |
|
|
record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); |
|
|
record.setPayOrderStatus(EnumPayStatus.PAY_WAY_WAIT.getCode()); |
|
|
record.setPayOrderStatus(EnumPayStatus.PAY_WAY_WAIT.getCode()); |
|
|
record.setShare(isShare); |
|
|
|
|
|
|
|
|
record.setShare(isShare.getCode()); |
|
|
|
|
|
|
|
|
int sqlRow = wxPayOrderMapper.insertSelective(record); |
|
|
int sqlRow = wxPayOrderMapper.insertSelective(record); |
|
|
if (sqlRow != 1) { |
|
|
if (sqlRow != 1) { |
|
|
@@ -159,7 +160,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
record = list.get(0); |
|
|
record = list.get(0); |
|
|
record.setShare(isShare); |
|
|
|
|
|
|
|
|
record.setShare(isShare.getCode()); |
|
|
payOrderNo = String.valueOf(record.getId()); |
|
|
payOrderNo = String.valueOf(record.getId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -244,7 +245,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { |
|
|
futureDate.setTime(currentDate.getTime() + 15*60*1000); |
|
|
futureDate.setTime(currentDate.getTime() + 15*60*1000); |
|
|
wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
wxPayOrderSP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 |
|
|
wxPayOrderSP.setSign_type("HMAC-SHA256"); |
|
|
wxPayOrderSP.setSign_type("HMAC-SHA256"); |
|
|
if(isShare) { |
|
|
|
|
|
|
|
|
if(isShare == EnumPayShare.YES) { |
|
|
wxPayOrderSP.setProfit_sharing("Y"); |
|
|
wxPayOrderSP.setProfit_sharing("Y"); |
|
|
} |
|
|
} |
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); |
|
|
Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderSP); |
|
|
|