Commit 1830afdf by 吕明尚

增加权益和充值订单的取消订单接口

parent fd49f0cf
......@@ -96,12 +96,17 @@ public class EquityMembersOrderController extends BaseController {
@PostMapping("/createEquityMembers")
public R<EquityMembersResultResponse> createOrder(@RequestBody @Validated CreateEquityMembersRequest request) {
if ("1".equals(redisUtil.frontInOutLogSwitch())) {
log.info("SOrderController method preOrder 入参 {}", JsonConvertUtil.write2JsonStr(request));
log.info("EquityMembersOrderController method preOrder 入参 {}", JsonConvertUtil.write2JsonStr(request));
}
EquityMembersResultResponse response = equityMembersOrderService.createEquityMembers(request);
if ("1".equals(redisUtil.frontInOutLogSwitch())) {
log.info("SOrderController method preOrder 出参 {}", JsonConvertUtil.write2JsonStr(response));
log.info("EquityMembersOrderController method preOrder 出参 {}", JsonConvertUtil.write2JsonStr(response));
}
return R.ok(response);
}
@RequestMapping(value = "/cancelPay", method = RequestMethod.POST)
public R<Boolean> cancelPay(@RequestParam("equityOrderNo") String equityOrderNo) {
return R.ok(equityMembersOrderService.cancelPay(equityOrderNo));
}
}
......@@ -96,12 +96,17 @@ public class RechargeController extends BaseController {
@PostMapping("/createRecharge")
public R<RechargePayResultResponse> createOrder(@RequestBody @Validated CreateRechargeRequest request) {
if ("1".equals(redisUtil.frontInOutLogSwitch())) {
log.info("SOrderController method preOrder 入参 {}", JsonConvertUtil.write2JsonStr(request));
log.info("RechargeController method preOrder 入参 {}", JsonConvertUtil.write2JsonStr(request));
}
RechargePayResultResponse response = rechargeService.createRecharge(request);
if ("1".equals(redisUtil.frontInOutLogSwitch())) {
log.info("SOrderController method preOrder 出参 {}", JsonConvertUtil.write2JsonStr(response));
log.info("RechargeController method preOrder 出参 {}", JsonConvertUtil.write2JsonStr(response));
}
return R.ok(response);
}
@RequestMapping(value = "/cancelPay", method = RequestMethod.POST)
public R<Boolean> cancelPay(@RequestParam("rechargeNo") String rechargeNo) {
return R.ok(rechargeService.cancelPay(rechargeNo));
}
}
......@@ -68,4 +68,8 @@ public interface EquityMembersOrderService extends IService<EquityMembersOrder>
EquityMembersOrder getInfoByEntity(EquityMembersOrder equityMembersOrderParam);
void paymentSuccessful(EquityMembersOrder equityMembersOrder);
Boolean cancelPay(String equityOrderNo);
EquityMembersOrder getByEquityOrderNo(String equityOrderNo);
}
......@@ -68,4 +68,8 @@ public interface RechargeService extends IService<Recharge> {
Recharge getInfoByEntity(Recharge rechargeParam);
void paymentSuccessful(Recharge recharge);
Boolean cancelPay(String rechargeNo);
Recharge getByRechargeNo(String rechargeNo);
}
......@@ -3,6 +3,7 @@ package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,10 +24,7 @@ import share.system.request.CreateEquityMembersRequest;
import share.system.response.EquityMembersResultResponse;
import share.system.service.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 权益会员订单Service业务层处理
......@@ -195,6 +193,23 @@ public class EquityMembersOrderServiceImpl extends ServiceImpl<EquityMembersOrde
updateEquityMembersOrder(equityMembersOrder);
}
@Override
public Boolean cancelPay(String equityOrderNo) {
EquityMembersOrder equityMembersOrder = getByEquityOrderNo(equityOrderNo);
if (Objects.isNull(equityMembersOrder)) {
throw new BaseException("订单不存在!");
}
removeById(equityMembersOrder.getId());
return true;
}
@Override
public EquityMembersOrder getByEquityOrderNo(String equityOrderNo) {
LambdaQueryWrapper<EquityMembersOrder> lqw = Wrappers.lambdaQuery();
lqw.eq(EquityMembersOrder::getEquityOrderNo, equityOrderNo);
return getOne(lqw);
}
private EquityMembersOrder generatEquityMembersOrder(CreateEquityMembersRequest request, SConsumer user) {
EquityMembersOrder equityMembersOrder = new EquityMembersOrder();
BeanUtils.copyProperties(request, equityMembersOrder);
......
......@@ -2,6 +2,7 @@ package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,6 +26,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 充值记录Service业务层处理
......@@ -175,6 +177,23 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
updateRecharge(recharge);
}
@Override
public Boolean cancelPay(String rechargeNo) {
Recharge recharge = getByRechargeNo(rechargeNo);
if (Objects.isNull(recharge)) {
throw new BaseException("订单不存在!");
}
removeById(recharge.getId());
return true;
}
@Override
public Recharge getByRechargeNo(String rechargeNo) {
LambdaQueryWrapper<Recharge> lqw = Wrappers.lambdaQuery();
lqw.eq(Recharge::getRechargeNo, rechargeNo);
return getOne(lqw);
}
private void extracted(Recharge recharge) {
//新增会员钱包
RechargeConf rechargeConf = rechargeConfService.selectRechargeConfById(recharge.getRechargeConfId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment