如果没有分销人的话分销提成给平台;把所有的支付方式改为延迟分账模式
This commit is contained in:
parent
4e3c29b0b1
commit
f31426a97d
|
|
@ -1,12 +1,12 @@
|
|||
package com.ghy.web.controller.pay;
|
||||
|
||||
import com.ghy.payment.service.AdapayService;
|
||||
import com.ghy.common.adapay.model.PayParam;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import com.ghy.payment.domain.FinancialMaster;
|
||||
import com.ghy.payment.service.AdapayService;
|
||||
import com.ghy.payment.service.FinancialMasterService;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -50,7 +50,7 @@ public class AlipayController extends BaseController {
|
|||
Map<String, Object> map;
|
||||
String payMoney = fm.getPayMoney().setScale(2, BigDecimal.ROUND_UNNECESSARY).toString();
|
||||
// TODO 这里需要补充商品标题和商品描述信息
|
||||
PayParam payParam = PayParam.createDelayPay(om.getCode() + "_" + System.currentTimeMillis(), "0.01", "商品标题", "商品描述信息");
|
||||
PayParam payParam = PayParam.delayPayParam(om.getCode() + "_" + System.currentTimeMillis(), "0.01", "商品标题", "商品描述信息");
|
||||
try {
|
||||
map = adapayService.alipayQrPay(om.getDeptId(), payParam, null, null, null);
|
||||
} catch (BaseAdaPayException e) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class WxPayController extends BaseController {
|
|||
|
||||
@PostMapping("drawCash")
|
||||
@ResponseBody
|
||||
public AjaxResult drawCash(@RequestBody JSONObject object){
|
||||
public AjaxResult drawCash(@RequestBody JSONObject object) {
|
||||
try {
|
||||
// 101 123dasda D0 1.00 C7D101
|
||||
Long deptId = object.getLong("deptId");
|
||||
|
|
@ -50,7 +50,7 @@ public class WxPayController extends BaseController {
|
|||
String remark = object.getStr("remark");
|
||||
adapayService.drawCash(deptId, orderNo, cashType, cashAmt, memberId, remark, null);
|
||||
return AjaxResult.success("操作成功");
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ public class WxPayController extends BaseController {
|
|||
List<DivMember> divMembers = new ArrayList<>();
|
||||
divMembers.add(new DivMember("C7D101", String.valueOf(financialMaster.getPayMoney()), true));
|
||||
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
||||
PayParam payParam = new PayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
||||
PayParam payParam = PayParam.delayPayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
||||
String.valueOf(financialMaster.getPayMoney()), "工圈子居家设备", "工圈子居家设备购买付费");
|
||||
map = adapayService.wxLitePay(orderMaster.getDeptId(), payParam, expend, null, null);
|
||||
} catch (BaseAdaPayException e) {
|
||||
|
|
@ -107,7 +107,7 @@ public class WxPayController extends BaseController {
|
|||
WxpayExpend expend = new WxpayExpend();
|
||||
expend.setOpenId(openId);
|
||||
Map<String, Object> map;
|
||||
PayParam payParam = new PayParam(orderMaster.getCode(), "0.01", "工圈子测试", "工圈子测试描述");
|
||||
PayParam payParam = PayParam.delayPayParam(orderMaster.getCode(), "0.01", "工圈子测试", "工圈子测试描述");
|
||||
map = adapayService.wxPubPay(orderMaster.getDeptId(), payParam, expend, null, null);
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class PayParam {
|
|||
* @param goodsDesc [必填项]商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
||||
* @return 支付参数
|
||||
*/
|
||||
public static PayParam createDelayPay(String orderNo, String payAmt, String goodsTittle, String goodsDesc) {
|
||||
public static PayParam delayPayParam(String orderNo, String payAmt, String goodsTittle, String goodsDesc) {
|
||||
PayParam payParam = new PayParam(orderNo, payAmt, goodsTittle, goodsDesc);
|
||||
payParam.setPayMode("delay");
|
||||
return payParam;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ghy.order.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ghy.common.adapay.model.AdapayStatusEnum;
|
||||
import com.ghy.common.adapay.model.DivMember;
|
||||
|
|
@ -168,8 +169,15 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
|||
break;
|
||||
case 3:
|
||||
// 分销
|
||||
memberId = AdapayUtils.getCustomerMemberId(financialDetail.getPayeeId(), orderMaster.getDeptId());
|
||||
memberMap.merge(memberId, financialDetail.getPayMoney(), BigDecimal::add);
|
||||
Long payeeId = financialDetail.getPayeeId();
|
||||
if (payeeId != null) {
|
||||
memberId = AdapayUtils.getCustomerMemberId(payeeId, orderMaster.getDeptId());
|
||||
// 如果有分销人 那这笔钱就是分销人的
|
||||
memberMap.merge(memberId, financialDetail.getPayMoney(), BigDecimal::add);
|
||||
} else {
|
||||
// 如果没有分销人 那这笔钱就分到平台账户
|
||||
memberMap.merge("0", financialDetail.getPayMoney(), BigDecimal::add);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// 退款
|
||||
|
|
@ -200,10 +208,11 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
logger.info("订单[code={}]分账信息: {}", orderMaster.getCode(), JSON.toJSONString(divMembers));
|
||||
JSONObject response = adapayService.paymentConfirm(orderMaster.getDeptId(), payment.getId(), payment.getOrderNo(),
|
||||
AdapayUtils.bigDecimalToString(confirmAmt), divMembers, null, null);
|
||||
logger.info("订单[code={}]分账结果: {}", orderMaster.getCode(), response.toJSONString());
|
||||
|
||||
boolean status = AdapayStatusEnum.succeeded.code.equals(response.getString("status"));
|
||||
// 如果确认支付失败 这里抛出异常
|
||||
Assert.isTrue(status, response.getString("error_msg"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue