Merge remote-tracking branch 'origin/test' into test
# Conflicts: # cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkDistributionUserServiceImpl.java
This commit is contained in:
commit
a4a0f7b2d9
|
|
@ -1,13 +1,22 @@
|
|||
package com.czg.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.market.entity.MkDistributionDeliver;
|
||||
import com.czg.market.entity.MkDistributionFlow;
|
||||
import com.czg.market.service.MkBirthdayGiftService;
|
||||
import com.czg.market.service.MkDistributionDeliverService;
|
||||
import com.czg.market.service.MkDistributionFlowService;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.service.market.enums.OrderStatusEnums;
|
||||
import com.czg.utils.FunUtils;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -28,9 +37,13 @@ public class DistributionTask {
|
|||
private MkDistributionDeliverService distributionDeliverService;
|
||||
@Resource
|
||||
private MkDistributionUserService distributionUserService;
|
||||
@Resource
|
||||
private MkDistributionFlowService distributionFlowService;
|
||||
|
||||
@DubboReference
|
||||
private OrderInfoService orderInfoService;
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
|
||||
/**
|
||||
* 生日有礼奖励发放
|
||||
|
|
@ -38,18 +51,24 @@ public class DistributionTask {
|
|||
*/
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
public void deliver() {
|
||||
distributionDeliverService.list(new QueryWrapper().eq(MkDistributionDeliver::getStatus, "pending")).forEach(item -> {
|
||||
distributionFlowService.list(new QueryWrapper().ge(MkDistributionFlow::getDeliverTime, DateUtil.date())
|
||||
.eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.PENDING.getCode())).forEach(item -> {
|
||||
FunUtils.safeRunVoid(() -> {
|
||||
log.info("开始处理延时分账, orderNo: {}, 类型: {}", item.getOrderNo(), item.getType());
|
||||
log.info("开始处理延时分账, id: {}, orderNo: {}, 类型: {}", item.getId(), item.getOrderNo(), item.getType());
|
||||
|
||||
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getOrderNo, item.getOrderNo()));
|
||||
if (orderInfo == null) {
|
||||
log.warn("订单不存在, 订单号: {}", item.getOrderNo());
|
||||
return;
|
||||
}
|
||||
|
||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), orderInfo.getPayAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order", true);
|
||||
item.setStatus("success");
|
||||
distributionDeliverService.updateById(item);
|
||||
if (CollUtil.newArrayList(OrderStatusEnums.REFUND.getCode(), OrderStatusEnums.REFUNDING.getCode(), OrderStatusEnums.PART_REFUND.getCode()).contains(orderInfo.getStatus())) {
|
||||
log.warn("订单已退款, 订单号: {}", item.getOrderNo());
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.REFUND.getCode());
|
||||
}else {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
distributionUserService.updateShopInfoAmount(orderInfo.getShopId(), item.getRewardAmount(), orderInfo.getId());
|
||||
}
|
||||
distributionFlowService.updateById(item);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public class NotifyController {
|
|||
|
||||
@GetMapping("testOpen")
|
||||
public JSONObject test1(String code) throws Exception {
|
||||
JSONObject jsonObject = wxService.transferBalance("or1l86yipGvwyfPhrKIAcQuSfAV8", "叶明飞", new BigDecimal("0.01"), "转账测试", "testTranymf0001");
|
||||
return jsonObject;
|
||||
distributionUserService.distribute(54659L, "WX1983728389726539776", BigDecimal.valueOf(1), 474L, 122L, "order");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -112,4 +112,5 @@ public class MkDistributionFlow implements Serializable {
|
|||
|
||||
private BigDecimal commission;
|
||||
private BigDecimal parentCommission;
|
||||
private LocalDateTime deliverTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,17 +102,19 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||
/**
|
||||
* 分销员开通
|
||||
*
|
||||
* @param userId 用户
|
||||
* @param shopUserId 用户
|
||||
* @param amount 金额
|
||||
* @param shopId 店铺id
|
||||
*/
|
||||
void open(Long userId, BigDecimal amount, Long shopId, Long sourceId);
|
||||
void open(Long shopUserId, BigDecimal amount, Long shopId, Long sourceId);
|
||||
|
||||
/**
|
||||
* 分销商户运营余额充值回调
|
||||
*/
|
||||
void rechargeCallBack(Long shopId, BigDecimal amount, Long paymentId);
|
||||
|
||||
BigDecimal updateShopInfoAmount(Long shopId, BigDecimal changeAmount, Long sourceId);
|
||||
|
||||
/**
|
||||
* 发放分销奖励
|
||||
*
|
||||
|
|
@ -122,7 +124,7 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||
* @param userId 用户id
|
||||
* @param shopId 店铺id
|
||||
*/
|
||||
void distribute(Long sourceId, String orderNo, BigDecimal amount, Long userId, Long shopId, String type, boolean isTask);
|
||||
void distribute(Long sourceId, String orderNo, BigDecimal amount, Long userId, Long shopId, String type);
|
||||
|
||||
void updateIncome(BigDecimal pendingIncome, BigDecimal receivedIncome, BigDecimal withdrawIncome, Long id, Long userId, Long shopId, Integer isOne);
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ public interface TableValueConstant {
|
|||
enum Status {
|
||||
PENDING("pending", "待入账"),
|
||||
SUCCESS("success", "已入账"),
|
||||
REFUND("REFUND", "已退款"),
|
||||
FAIL("fail", "失败");
|
||||
private final String code;
|
||||
private final String msg;
|
||||
|
|
|
|||
|
|
@ -447,6 +447,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@CacheEvict(key = "#id")
|
||||
@Override
|
||||
public BigDecimal updateAmount(Long id, BigDecimal amount) {
|
||||
ShopInfo shopInfo = getShopInfo(id);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.czg.service.market.mapper.MkDistributionFlowMapper;
|
|||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -47,26 +48,29 @@ public class MkDistributionFlowServiceImpl extends ServiceImpl<MkDistributionFlo
|
|||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, startTime, endTime, status, key, id, null);
|
||||
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
||||
Map<String, Object> map = BeanUtil.beanToMap(page);
|
||||
map.put("successAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getType, TableValueConstant.DistributionFlow.Status.SUCCESS.getCode())
|
||||
.select("sum(reward_amount)")));
|
||||
map.put("pendingAmount", getOne(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getType, TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.select("sum(reward_amount)")));
|
||||
map.put("successAmount", getOneAs(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.SUCCESS.getCode())
|
||||
.select("sum(reward_amount)"), BigDecimal.class));
|
||||
map.put("pendingAmount", getOneAs(new QueryWrapper().eq(MkDistributionFlow::getShopId, shopId)
|
||||
.eq(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.select("sum(reward_amount)"), BigDecimal.class));
|
||||
map.put("balanceAmount", shopInfoService.getById(shopId).getAmount());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> distributionFlow(long userId, String startTime, String endTime, Long shopId, String status) {
|
||||
ShopUser shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
|
||||
ShopUser shopUserInfo = null;
|
||||
if (shopId != null) {
|
||||
shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
|
||||
}
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
List<MkDistributionFlowVO> list = mapper.pageInfo(shopId, StrUtil.isBlank(startTime) ? null : DateUtil.parseLocalDateTime(startTime),
|
||||
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, shopUserInfo.getId(), null);
|
||||
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, shopUserInfo == null ? null : shopUserInfo.getId(), null);
|
||||
Page<MkDistributionFlowVO> page = PageUtil.convert(new PageInfo<>(list));
|
||||
Map<String, Object> map = BeanUtil.beanToMap(page);
|
||||
map.put("totalAmount", mapper.totalAmount(shopId, StrUtil.isBlank(startTime) ? null : DateUtil.parseLocalDateTime(startTime),
|
||||
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, shopUserInfo.getId(), null));
|
||||
StrUtil.isBlank(endTime) ? null : DateUtil.parseLocalDateTime(endTime), status,null, shopUserInfo == null ? null : shopUserInfo.getId(), null));
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,7 +410,6 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
.eq(MkDistributionConfig::getIsEnable, 1));
|
||||
AssertUtil.isNull(config, "店铺未配置分销");
|
||||
param.setStatus(0);
|
||||
//自主申请、付费开通、手动添加
|
||||
param.setId(param.getId());
|
||||
param.setUserId(shopUser.getUserId());
|
||||
param.setInviteCode(CzgRandomUtils.randomString(10));
|
||||
|
|
@ -510,17 +509,21 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open(Long userId, BigDecimal amount, Long shopId, Long sourceId) {
|
||||
ShopUser shopUserInfo = shopUserService.getShopUserInfo(shopId, userId);
|
||||
public void open(Long shopUserId, BigDecimal amount, Long shopId, Long sourceId) {
|
||||
ShopUser shopUserInfo = shopUserService.getById(shopUserId);
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, amount);
|
||||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
.setType(TableValueConstant.DistributionAmountFlow.Type.OPEN.getCode())
|
||||
.setMainShopId(mainShopId).setShopId(shopId).setAmount(finalAmount).setChangeAmount(amount).setSourceId(sourceId)
|
||||
.setRemark("分销员购买"));
|
||||
addDistributionUser(new MkDistributionUser().setShopId(shopId)
|
||||
.setUserId(shopUserInfo.getUserId())
|
||||
.setId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
|
||||
try {
|
||||
addDistributionUser(new MkDistributionUser().setShopId(shopId)
|
||||
.setUserId(shopUserInfo.getUserId())
|
||||
.setId(shopUserInfo.getId()).setOpeningMethod("付费开通"));
|
||||
}catch (Exception e) {
|
||||
log.error("分销员开通失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -531,7 +534,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
.setType(TableValueConstant.DistributionAmountFlow.Type.SELF_RECHARGE.getCode())
|
||||
.setMainShopId(mainShopId).setShopId(shopId).setAmount(finalAmount).setChangeAmount(amount).setSourceId(paymentId)
|
||||
.setRemark("自助充值").setOpAccount(StpKit.USER.getAccount()));
|
||||
.setRemark("自助充值"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -555,10 +558,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
|
||||
// 上上级分销员
|
||||
if (currentShopUser.getDistributionUserId() != null) {
|
||||
MkDistributionUser parent = getOne(new QueryWrapper().eq(MkDistributionUser::getId, currentDistributionUser.getDistributionLevelId()));
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
MkDistributionUser parent = getOne(new QueryWrapper().eq(MkDistributionUser::getId, currentShopUser.getDistributionUserId()));
|
||||
try {
|
||||
deepReward(orderSourceShopUser, level, config, parent, amount, sourceId, type, orderNo, currentLevel + 1);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -587,56 +587,55 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
// }
|
||||
rewardAmount = amount.multiply(finalCommission.divide(BigDecimal.valueOf(100), RoundingMode.DOWN));
|
||||
|
||||
boolean flag = true;
|
||||
BigDecimal finalAmount = BigDecimal.ZERO;
|
||||
try {
|
||||
finalAmount = shopInfoService.updateAmount(currentDistributionUser.getShopId(), rewardAmount.negate());
|
||||
} catch (Exception e) {
|
||||
flag = false;
|
||||
}
|
||||
ShopUser shopUser = shopUserService.getById(currentDistributionUser.getId());
|
||||
// 延时发放时间
|
||||
LocalDateTime delayTime = config.getSettlementDay() == null || config.getSettlementDay() == 0 ? null : DateUtil.offsetDay(DateUtil.date(), config.getSettlementDay()).toLocalDateTime();
|
||||
|
||||
// 用户分账明细
|
||||
ShopUser shopUser = shopUserService.getById(currentDistributionUser.getId());
|
||||
MkDistributionFlow mkDistributionFlow = new MkDistributionFlow().setShopUserId(currentDistributionUser.getId())
|
||||
.setShopId(currentDistributionUser.getShopId()).setDistributionUserId(currentDistributionUser.getId())
|
||||
.setNickName(shopUser.getNickName()).setSourceShopUserId(orderSourceShopUser.getId()).setSourceNickName(orderSourceShopUser.getNickName())
|
||||
.setCommission(finalCommission).setParentCommission(parentLevel.getLevelOneCommission())
|
||||
.setCommission(finalCommission).setParentCommission(parentLevel != null ? parentLevel.getLevelOneCommission() : null)
|
||||
.setLevelId(currentDistributionUser.getDistributionLevelId()).setLevel(currentLevel == 1 ? 1 : 2).setOrderNo(orderNo)
|
||||
.setSourceId(sourceId).setAmount(amount).setType(type).setStatus(flag ? TableValueConstant.DistributionFlow.Status.SUCCESS.getCode() :
|
||||
TableValueConstant.DistributionFlow.Status.PENDING.getCode())
|
||||
.setSourceId(sourceId).setAmount(amount).setType(type)
|
||||
.setRewardAmount(rewardAmount).setBillNo(IdUtil.simpleUUID());
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
|
||||
updateIncome(!flag ? rewardAmount : BigDecimal.ZERO,
|
||||
flag ? rewardAmount : BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
|
||||
if (flag) {
|
||||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
.setType(TableValueConstant.DistributionAmountFlow.Type.SUB.getCode())
|
||||
.setShopId(config.getShopId()).setAmount(finalAmount).setChangeAmount(rewardAmount).setSourceId(mkDistributionFlow.getId())
|
||||
.setRemark("分账扣除"));
|
||||
if (delayTime == null) {
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
log.info("即时分销开始");
|
||||
try {
|
||||
updateShopInfoAmount(currentDistributionUser.getShopId(), rewardAmount, mkDistributionFlow.getId());
|
||||
updateIncome(BigDecimal.ZERO, rewardAmount, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
} catch (Exception e) {
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.PENDING.getCode());
|
||||
distributionFlowService.updateById(mkDistributionFlow);
|
||||
}
|
||||
}else {
|
||||
mkDistributionFlow.setStatus(TableValueConstant.DistributionFlow.Status.PENDING.getCode());
|
||||
distributionFlowService.save(mkDistributionFlow);
|
||||
log.info("延时分销开始");
|
||||
updateIncome(rewardAmount, BigDecimal.ZERO, BigDecimal.ZERO, currentDistributionUser.getId(), shopUser.getUserId(), shopUser.getMainShopId(), currentLevel == 1 ? 1 : 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distribute(Long sourceId, String orderNo, BigDecimal amount, Long sourceUserId, Long shopId, String type, boolean isTask) {
|
||||
MkDistributionDeliver deliver = new MkDistributionDeliver().setSourceId(sourceId).setOrderNo(orderNo).setShopId(shopId).setType(type).setStatus("pending");
|
||||
public BigDecimal updateShopInfoAmount(Long shopId, BigDecimal changeAmount, Long sourceId) {
|
||||
BigDecimal finalAmount = shopInfoService.updateAmount(shopId, changeAmount.negate());
|
||||
distributionAmountFlowService.save(new MkDistributionAmountFlow()
|
||||
.setType(TableValueConstant.DistributionAmountFlow.Type.SUB.getCode())
|
||||
.setShopId(shopId).setAmount(finalAmount).setChangeAmount(changeAmount).setSourceId(sourceId)
|
||||
.setRemark("分账扣除"));
|
||||
return finalAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distribute(Long sourceId, String orderNo, BigDecimal amount, Long sourceUserId, Long shopId, String type) {
|
||||
MkDistributionDeliver deliver = new MkDistributionDeliver().setSourceId(sourceId).setOrderNo(orderNo).setShopId(shopId).setType(type).setStatus("success");
|
||||
FunUtils.safeRunVoid(() -> {
|
||||
AssertUtil.isTrue(amount.compareTo(BigDecimal.ZERO) == 0, "分销金额不能为0");
|
||||
MkDistributionConfigVO config = mkDistributionConfigService.detail(shopId);
|
||||
AssertUtil.isTrue(config.getIsEnable() != 1, "分销未开启");
|
||||
|
||||
|
||||
if (!isTask) {
|
||||
if (config.getSettlementDay() != null && config.getSettlementDay() != 0) {
|
||||
deliver.setShouldDeliverTime(DateUtil.offsetDay(DateUtil.date(), config.getSettlementDay()).toLocalDateTime());
|
||||
log.info("延时发放, {}", config.getSettlementDay());
|
||||
return;
|
||||
} else {
|
||||
deliver.setStatus("success");
|
||||
}
|
||||
}
|
||||
|
||||
// 当前用户上级分销员
|
||||
ShopUser sourceShopUserInfo = shopUserService.getShopUserInfo(shopId, sourceUserId);
|
||||
if (sourceShopUserInfo.getDistributionUserId() == null) {
|
||||
|
|
@ -647,15 +646,16 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
MkDistributionUser distributionUser = getById(sourceShopUserInfo.getDistributionUserId());
|
||||
deepReward(sourceShopUserInfo, null, config, distributionUser, amount, sourceId, type, orderNo, 1);
|
||||
});
|
||||
if (!isTask) {
|
||||
distributionDeliverService.save(deliver);
|
||||
}
|
||||
distributionDeliverService.save(deliver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateIncome(BigDecimal pendingIncome, BigDecimal receivedIncome, BigDecimal withdrawIncome, Long id, Long userId, Long mainShopId, Integer isOne) {
|
||||
shopUserService.updateOneOrTwoAmount(userId, mainShopId, receivedIncome == null ? pendingIncome : receivedIncome, isOne);
|
||||
// 用户收益信息
|
||||
shopUserService.updateOneOrTwoAmount(userId, mainShopId, receivedIncome, isOne);
|
||||
// 用户可提现余额
|
||||
userInfoService.updateDistributionAmount(userId, receivedIncome);
|
||||
//分销员余额
|
||||
boolean flag = mapper.updateIncome(pendingIncome, receivedIncome, withdrawIncome, id);
|
||||
if (!flag) {
|
||||
throw new CzgException("操作失败");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
left join mk_distribution_user as d on d.id=a.distribution_user_id
|
||||
left join tb_shop_info as e on e.id=a.shop_id
|
||||
left join tb_shop_user as b on a.shop_user_id=b.id
|
||||
left join tb_shop_user as c on c.id=a.shop_user_id
|
||||
left join tb_shop_user as c on c.id=a.source_shop_user_id
|
||||
<where>
|
||||
<if test="shopId != null">
|
||||
and a.shop_id=#{shopId}
|
||||
|
|
|
|||
|
|
@ -74,16 +74,15 @@ public class DistributionPayServiceImpl implements DistributionPayService {
|
|||
orderPaymentService.save(orderPayment);
|
||||
|
||||
InitInfo initInfo = new InitInfo().setConfig(detail);
|
||||
if (!isRecharge) {
|
||||
if (isRecharge) {
|
||||
String openId = wxService.getOpenId(payParam.getCode());
|
||||
initInfo.setOpenId(openId);
|
||||
initInfo.setPayment(orderPayment);
|
||||
} else {
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
initInfo.setPayment(orderPayment).setShopUser(shopUserInfo)
|
||||
.setOpenId("aliPay".equals(payParam.getPayType()) ? userInfo.getAlipayOpenId() : userInfo.getWechatOpenId());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(payParam.getCode())) {
|
||||
String openId = wxService.getOpenId(payParam.getCode());
|
||||
initInfo.setOpenId(openId);
|
||||
}
|
||||
return initInfo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1066,7 +1066,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
// 分销员升级等级
|
||||
distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId());
|
||||
// 分销奖励
|
||||
distributionUserService.distribute(orderInfo.getId(), payment.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order",false);
|
||||
distributionUserService.distribute(orderInfo.getId(), payment.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||
} else if ("memberIn".equals(payment.getPayType()) || "free".equals(payment.getPayType())) {
|
||||
boolean isFree = "free".equals(payment.getPayType());
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue