Compare commits

...

2 Commits

Author SHA1 Message Date
tangqian f1ac990de7 Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product 2023-05-25 17:44:42 +08:00
tangqian 88c8c3e459 fix: 充值相关 2023-05-25 17:44:35 +08:00
5 changed files with 37 additions and 6 deletions

View File

@ -147,7 +147,7 @@ public class WxPayNotifyController {
//删除提报记录 //删除提报记录
phoneRecordService.deletePhoneGear(orderDO.getOrderId()); phoneRecordService.deletePhoneGear(orderDO.getOrderId());
//删除本地提报记录 //删除本地提报记录
phoneRecordService.deletePhoneRecord(orderDO.getId()); phoneRecordService.deletePhoneGearByOrderId(orderDO.getId());
// 修改订单状态 // 修改订单状态
// 写入 // 写入
response.setStatus(HttpServletResponse.SC_OK); response.setStatus(HttpServletResponse.SC_OK);

View File

@ -1227,7 +1227,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
log.error("删除提报记录异常{}", e); log.error("删除提报记录异常{}", e);
} }
//删除本地提报记录 //删除本地提报记录
phoneRecordService.deletePhoneRecord(orderDO.getId()); phoneRecordService.deletePhoneGearByOrderId(orderDO.getId());
// 表示退款 // 表示退款
} else { } else {
// 表示支付 // 表示支付

View File

@ -36,6 +36,7 @@ public interface PhoneRecordService {
*/ */
void deletePhoneRecord(Long id); void deletePhoneRecord(Long id);
/** /**
* *
* *
@ -90,6 +91,16 @@ public interface PhoneRecordService {
* </pre> * </pre>
*/ */
Boolean deletePhoneGear(String orderId); Boolean deletePhoneGear(String orderId);
/**
* <pre>
* <b>deletePhoneGear</b>
* <b>Description:</b>
* <b>@author:</b> zenghuapei
* <b>@date:</b> 2023/5/24 12:44
* @return
* </pre>
*/
Boolean deletePhoneGearByOrderId(Long orderId);
/** /**
* <pre> * <pre>
* <b>insertPhone</b> * <b>insertPhone</b>

View File

@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import java.util.*;
@ -76,12 +77,23 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
// 校验存在 // 校验存在
validatePhoneRecordExists(id); validatePhoneRecordExists(id);
// 删除 // 删除
phoneRecordMapper.delete(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, id)); phoneRecordMapper.deleteById(id);;
}
@Override
public Boolean deletePhoneGearByOrderId(Long orderId) {
List<PhoneRecordDO> recordDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, orderId));
if (!CollectionUtils.isEmpty(recordDOS)) {
recordDOS.forEach(e->{
e.setDeleted(Boolean.TRUE);
phoneRecordMapper.updateById(e);
});
}
return null;
} }
private void validatePhoneRecordExists(Long id) { private void validatePhoneRecordExists(Long id) {
PhoneRecordDO phoneRecordDO = phoneRecordMapper.selectOne(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, id)); if (phoneRecordMapper.selectById(id) == null) {
if (phoneRecordDO == null) {
throw exception(PHONE_RECORD_NOT_EXISTS); throw exception(PHONE_RECORD_NOT_EXISTS);
} }
} }

View File

@ -2,12 +2,15 @@ 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.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
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.RechargeOrderInfoMapper; import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest; import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse; import cn.iocoder.yudao.module.shop.response.member.MemberHeadResponse;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -44,6 +47,10 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
private RechargeOrderMapper rechargeOrderMapper; private RechargeOrderMapper rechargeOrderMapper;
@Resource @Resource
private RechargeOrderInfoMapper infoMapper; private RechargeOrderInfoMapper infoMapper;
@Resource
private MemberUserApi userService;
@Resource
private PhoneRecordService phoneRecordService;
@Override @Override
public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) { public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
@ -151,7 +158,8 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
MemberHeadResponse response = new MemberHeadResponse(); MemberHeadResponse response = new MemberHeadResponse();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!"); Assert.notNull(loginUser, "登录失效,请重新登录!");
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid, loginUser.getId()).eq(RechargeOrderDO::getPaid, 1)); MemberUserRespDTO user = userService.getUser(loginUser.getId());
List<RechargeOrderDO> orderDOS = rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUserPhone, user.getMobile()).eq(RechargeOrderDO::getPaid, 1));
if (!CollectionUtils.isEmpty(orderDOS)) { if (!CollectionUtils.isEmpty(orderDOS)) {
BigDecimal amount = new BigDecimal("0"); BigDecimal amount = new BigDecimal("0");
for (RechargeOrderDO orderDO : orderDOS) { for (RechargeOrderDO orderDO : orderDOS) {