Merge pull request '支付bug' (#79) from khy1 into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #79
This commit is contained in:
root 2024-10-25 14:48:48 +08:00
commit 45b6bf142e
5 changed files with 40 additions and 5 deletions

View File

@ -88,9 +88,6 @@ public class TradeTradePaidMemberUserServiceImpl implements TradePaidMemberUserS
public TradePaidMemberUserDO getByPayOrderId(Long payOrderId) {
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserMapper.selectOne(
new LambdaQueryWrapperX<TradePaidMemberUserDO>().eqIfPresent(TradePaidMemberUserDO::getPayOrderId,payOrderId));
if (tradePaidMemberUserDO == null) {
throw exception(PAID_MEMBER_ORDER_NOT_EXISTS);
}
return tradePaidMemberUserDO;
}

View File

@ -340,7 +340,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
//会员用户信息支付状态修改
TradeMemberUserDO tradeMemberUserDO = tradeMemberUserService.getUser(getLoginUserId());
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserService.getByPayOrderId(payOrderId);
if(tradePaidMemberUserDO != null && tradeMemberUserDO != null){
if(tradePaidMemberUserDO != null ){
System.out.println("进入会员支付修改操作paid"+tradePaidMemberUserDO+"和member"+tradeMemberUserDO);
tradePaidMemberUserDO.setPayTime(LocalDateTime.now());
tradePaidMemberUserDO.setPaid(true);

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.PaidMemberUserDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
/**
* 会员 Service 接口
@ -86,4 +87,9 @@ public interface PaidMemberUserService {
PaidMemberUserDO getByPayOrderId(Long payOrderId);
/***
* 创建交易订单
*/
public Long buildTradeOrder(PaidMemberUserDO updateReqVO);
}

View File

@ -6,6 +6,13 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -25,7 +32,9 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.dal.mysql.user.PaidMemberUserMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getTerminal;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
/**
@ -43,6 +52,11 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
@Resource
private PaidMemberCardTypeService memberCardTypeService;
@Resource
private TradeOrderUpdateService tradeOrderUpdateService;
@Resource
private TradeOrderMapper tradeOrderMapper;
@Override
@ -195,4 +209,22 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
return paidMemberUserDO;
}
@Override
public Long buildTradeOrder(PaidMemberUserDO updateReqVO) {
TradeOrderDO orderDO = new TradeOrderDO();
orderDO.setType(TradeOrderTypeEnum.NORMAL.getType());
orderDO.setNo(updateReqVO.getOrderNo());
orderDO.setStatus(TradeOrderStatusEnum.UNPAID.getStatus());
orderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus());
orderDO.setProductCount(1);
orderDO.setUserIp(getClientIP()).setTerminal(getTerminal());
orderDO.setPayOrderId(updateReqVO.getPayOrderId());
orderDO.setPayChannelCode(updateReqVO.getPayChannel());
orderDO.setDeliveryType(DeliveryTypeEnum.EXPRESS.getType());
tradeOrderMapper.insert(orderDO);
// orderDO = tradeOrderMapper.s
return orderDO.getId();
}
}

View File

@ -139,7 +139,7 @@ public class AppPaidMembeController {
Long id = paidMemberUserService.createMemberUser(paidMemberUserSaveReqVO);
//查询新增的会员订单记录
paidMemberUserDO = paidMemberUserService.getMemberUser(id);
// 创建支付订单号
//创建支付订单号
payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO()
.setAppId(1L).setUserIp(getClientIP())
.setMerchantOrderId(""+paidMemberUserDO.getId())