From cab967d639b892208b79434fb005359ef2409c0c Mon Sep 17 00:00:00 2001 From: tangqian Date: Fri, 19 May 2023 19:08:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E4=BB=98=E5=AE=9D=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/notify/WxPayNotifyController.java | 1 + .../admin/recharge/RechargeGearController.java | 2 +- .../shop/controller/app/member/MemberController.java | 1 + .../shop/dal/dataobject/recharge/RechargeGearDO.java | 2 +- .../dal/dataobject/recharge/RechargeOrderInfoDO.java | 4 ++++ .../service/order/impl/StoreOrderServiceImpl.java | 8 ++++---- .../shop/service/recharge/RechargeGearService.java | 2 +- .../service/recharge/RechargeGearServiceImpl.java | 12 ++++++++---- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java index 32a5f41cb..c8945090c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/WxPayNotifyController.java @@ -136,6 +136,7 @@ public class WxPayNotifyController { return "failure"; } orderDO.setRefundStatus(2); + orderDO.setPaid(2); rechargeOrderMapper.updateById(orderDO); // 修改订单状态 // 写入 diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java index fdd887f65..e463aaf1b 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeGearController.java @@ -40,7 +40,7 @@ public class RechargeGearController { @PostMapping("/create") @Operation(summary = "创建充值档位") @PreAuthorize("@ss.hasPermission('shop:recharge-gear:create')") - public CommonResult createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) { + public CommonResult createRechargeGear(@Valid @RequestBody RechargeGearCreateReqVO createReqVO) { return success(rechargeGearService.createRechargeGear(createReqVO)); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java index 3a74bd3ce..5282f6aa6 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java @@ -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.dal.dataobject.recharge.RechargeOrderDO; 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.RechargeOrderService; import io.swagger.v3.oas.annotations.Operation; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java index 9cfe1775d..a13610386 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeGearDO.java @@ -28,7 +28,7 @@ public class RechargeGearDO extends BaseDO { * 主键 */ @TableId(type = IdType.ASSIGN_ID) - private String id; + private Long id; /** * 档位名称 */ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderInfoDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderInfoDO.java index cb5425226..7cd3fa544 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderInfoDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderInfoDO.java @@ -89,5 +89,9 @@ public class RechargeOrderInfoDO extends TenantBaseDO { * 用户id */ private Long uid; + /** + * 支付状态 + */ + private Integer paid; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 2d810972a..e620add2b 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -1402,11 +1402,11 @@ public class StoreOrderServiceImpl extends ServiceImpl orderInfos = request.getOrderInfos(); Assert.isTrue(!CollectionUtils.isEmpty(orderInfos), "订单信息不能为空!"); List collect = orderInfos.stream().map(OrderContentRequest.OrderInfo::getGearId).collect(Collectors.toList()); - List infoDOS = rechargeOrderInfoMapper.selectList(Wrappers.lambdaQuery() - .eq(RechargeOrderInfoDO::getUid, user.getId()) - .in(RechargeOrderInfoDO::getRechargeGearId, collect)); + List infoDOS = phoneRecordMapper.selectList(Wrappers.lambdaQuery() + .eq(PhoneRecordDO::getUserId, user.getId()) + .in(PhoneRecordDO::getRechargeGearId, collect)); if (!CollectionUtils.isEmpty(infoDOS)) { - Map> collect1 = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId)); + Map> collect1 = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId)); orderInfos.forEach(info -> { Assert.isTrue(CollectionUtils.isEmpty(collect1.get(info.getGearId())), "该挡位:" + info.getName() + "你已购买,请勿重复操作"); }); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java index 7df68dd83..507476d2e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java @@ -19,7 +19,7 @@ public interface RechargeGearService { * @param createReqVO 创建信息 * @return 编号 */ - String createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO); + Long createRechargeGear(@Valid RechargeGearCreateReqVO createReqVO); /** * 更新充值档位 diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java index dab8315ec..13c89394c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java @@ -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.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.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.RechargeOrderMapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -43,9 +45,11 @@ public class RechargeGearServiceImpl implements RechargeGearService { private RechargeOrderInfoMapper orderInfoMapper; @Resource private RechargeOrderMapper orderMapper; + @Resource + private PhoneRecordMapper phoneRecordMapper; @Override - public String createRechargeGear(RechargeGearCreateReqVO createReqVO) { + public Long createRechargeGear(RechargeGearCreateReqVO createReqVO) { // 插入 RechargeGearDO rechargeGear = RechargeGearConvert.INSTANCE.convert(createReqVO); rechargeGearMapper.insert(rechargeGear); @@ -105,10 +109,10 @@ public class RechargeGearServiceImpl implements RechargeGearService { List rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS); RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).last("LIMIT 1")); if (Objects.nonNull(orderDO)) { - List infoDOS = orderInfoMapper.selectList(Wrappers.lambdaQuery().eq(RechargeOrderInfoDO::getOrderNo, orderDO.getOrderId())); - Map> collect = infoDOS.stream().collect(Collectors.groupingBy(RechargeOrderInfoDO::getRechargeGearId)); + List infoDOS = phoneRecordMapper.selectList(Wrappers.lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, orderDO.getId())); + Map> collect = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId)); rechargeGearRespVOS.forEach(vo -> { - List infoDOS1 = collect.get(vo.getId()); + List infoDOS1 = collect.get(vo.getId()); if (!CollectionUtils.isEmpty(infoDOS1)) { vo.setIsExist("1"); } else {