feat: 支付宝相关支付

pull/2/head
tangqian 2023-05-19 19:08:59 +08:00
parent ea288188e8
commit cab967d639
8 changed files with 21 additions and 11 deletions

View File

@ -136,6 +136,7 @@ public class WxPayNotifyController {
return "failure"; return "failure";
} }
orderDO.setRefundStatus(2); orderDO.setRefundStatus(2);
orderDO.setPaid(2);
rechargeOrderMapper.updateById(orderDO); rechargeOrderMapper.updateById(orderDO);
// 修改订单状态 // 修改订单状态
// 写入 // 写入

View File

@ -40,7 +40,7 @@ public class RechargeGearController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建充值档位") @Operation(summary = "创建充值档位")
@PreAuthorize("@ss.hasPermission('shop:recharge-gear:create')") @PreAuthorize("@ss.hasPermission('shop:recharge-gear:create')")
public CommonResult<String> createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) { public CommonResult<Long> createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) {
return success(rechargeGearService.createRechargeGear(createReqVO)); return success(rechargeGearService.createRechargeGear(createReqVO));
} }

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRe
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert; import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse; import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService; import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService; import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -28,7 +28,7 @@ public class RechargeGearDO extends BaseDO {
* *
*/ */
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private String id; private Long id;
/** /**
* *
*/ */

View File

@ -89,5 +89,9 @@ public class RechargeOrderInfoDO extends TenantBaseDO {
* id * id
*/ */
private Long uid; private Long uid;
/**
*
*/
private Integer paid;
} }

View File

@ -1402,11 +1402,11 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos(); List<OrderContentRequest.OrderInfo> orderInfos = request.getOrderInfos();
Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!"); Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!");
List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList()); List<Long> collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList());
List<RechargeOrderInfoDO> infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery() List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery()
.eq(RechargeOrderInfoDO::getUid, user.getId()) .eq(PhoneRecordDO::getUserId, user.getId())
.in(RechargeOrderInfoDO::getRechargeGearId, collect)); .in(PhoneRecordDO::getRechargeGearId, collect));
if (!CollectionUtils.isEmpty(infoDOS)) { if (!CollectionUtils.isEmpty(infoDOS)) {
Map<Long, List<RechargeOrderInfoDO>> collect1 = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId)); Map<Long, List<PhoneRecordDO>> collect1 = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId));
orderInfos.forEach(info -> { orderInfos.forEach(info -> {
Assert.isTrue(CollectionUtils.isEmpty(collect1.get(info.getGearId())), "该挡位:" + info.getName() + "你已购买,请勿重复操作"); Assert.isTrue(CollectionUtils.isEmpty(collect1.get(info.getGearId())), "该挡位:" + info.getName() + "你已购买,请勿重复操作");
}); });

View File

@ -19,7 +19,7 @@ public interface RechargeGearService {
* @param createReqVO * @param createReqVO
* @return * @return
*/ */
String createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO); Long createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO);
/** /**
* *

View File

@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.shop.service.recharge;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.PhoneRecordMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -43,9 +45,11 @@ public class RechargeGearServiceImpl implements RechargeGearService {
private RechargeOrderInfoMapper orderInfoMapper; private RechargeOrderInfoMapper orderInfoMapper;
@Resource @Resource
private RechargeOrderMapper orderMapper; private RechargeOrderMapper orderMapper;
@Resource
private PhoneRecordMapper phoneRecordMapper;
@Override @Override
public String createRechargeGear(RechargeGearCreateReqVO createReqVO) { public Long createRechargeGear(RechargeGearCreateReqVO createReqVO) {
// 插入 // 插入
RechargeGearDO rechargeGear = RechargeGearConvert.INSTANCE.convert(createReqVO); RechargeGearDO rechargeGear = RechargeGearConvert.INSTANCE.convert(createReqVO);
rechargeGearMapper.insert(rechargeGear); rechargeGearMapper.insert(rechargeGear);
@ -105,10 +109,10 @@ public class RechargeGearServiceImpl implements RechargeGearService {
List<RechargeGearRespVO> rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS); List<RechargeGearRespVO> rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS);
RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).last("LIMIT 1")); RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).last("LIMIT 1"));
if (Objects.nonNull(orderDO)) { if (Objects.nonNull(orderDO)) {
List<RechargeOrderInfoDO> infoDOS = orderInfoMapper.selectList(Wrappers.<RechargeOrderInfoDO>lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderDO.getOrderId())); List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, orderDO.getId()));
Map<Long, List<RechargeOrderInfoDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId)); Map<Long, List<PhoneRecordDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId));
rechargeGearRespVOS.forEach(vo -> { rechargeGearRespVOS.forEach(vo -> {
List<RechargeOrderInfoDO> infoDOS1 = collect.get(vo.getId()); List<PhoneRecordDO> infoDOS1 = collect.get(vo.getId());
if (!CollectionUtils.isEmpty(infoDOS1)) { if (!CollectionUtils.isEmpty(infoDOS1)) {
vo.setIsExist("1"); vo.setIsExist("1");
} else { } else {