增加充值记录列表
This commit is contained in:
parent
9deb398f92
commit
2f854d5a94
|
|
@ -1,11 +1,14 @@
|
||||||
package com.mdd.front.controller;
|
package com.mdd.front.controller;
|
||||||
|
|
||||||
import com.mdd.common.core.AjaxResult;
|
import com.mdd.common.core.AjaxResult;
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.front.LikeFrontThreadLocal;
|
import com.mdd.front.LikeFrontThreadLocal;
|
||||||
import com.mdd.front.service.IRechargeService;
|
import com.mdd.front.service.IRechargeService;
|
||||||
import com.mdd.front.validate.RechargeValidate;
|
import com.mdd.front.validate.RechargeValidate;
|
||||||
|
import com.mdd.front.validate.common.PageValidate;
|
||||||
|
import com.mdd.front.vo.RechargeRecordVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.models.auth.In;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
@ -20,18 +23,17 @@ public class RechargeController {
|
||||||
@Resource
|
@Resource
|
||||||
IRechargeService iRechargeService;
|
IRechargeService iRechargeService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/record")
|
||||||
public AjaxResult<Object> list() {
|
@ApiOperation(value = "充值记录")
|
||||||
return AjaxResult.success();
|
public AjaxResult<Object> record(@Validated PageValidate pageValidate) {
|
||||||
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
|
||||||
|
PageResult<RechargeRecordVo> list = iRechargeService.record(userId, pageValidate);
|
||||||
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建订单
|
|
||||||
*
|
|
||||||
* @param rechargeValidate 参数
|
|
||||||
* @return AjaxResult<Object>
|
|
||||||
*/
|
|
||||||
@PostMapping("/placeOrder")
|
@PostMapping("/placeOrder")
|
||||||
|
@ApiOperation(value = "充值下单")
|
||||||
public AjaxResult<Object> placeOrder(@Validated @RequestBody RechargeValidate rechargeValidate) {
|
public AjaxResult<Object> placeOrder(@Validated @RequestBody RechargeValidate rechargeValidate) {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
Integer terminal = LikeFrontThreadLocal.getTerminal();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.mdd.front.service;
|
package com.mdd.front.service;
|
||||||
|
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.front.validate.RechargeValidate;
|
import com.mdd.front.validate.RechargeValidate;
|
||||||
import io.swagger.models.auth.In;
|
import com.mdd.front.validate.common.PageValidate;
|
||||||
|
import com.mdd.front.vo.RechargeRecordVo;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -10,6 +12,23 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface IRechargeService {
|
public interface IRechargeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @return PageResult<RechargeRecordVo>
|
||||||
|
*/
|
||||||
|
PageResult<RechargeRecordVo> record(Integer userId, PageValidate pageValidate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值下单
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param terminal 总端
|
||||||
|
* @param rechargeValidate 充值参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
Map<String, Object> placeOrder(Integer userId, Integer terminal, RechargeValidate rechargeValidate);
|
Map<String, Object> placeOrder(Integer userId, Integer terminal, RechargeValidate rechargeValidate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,28 @@
|
||||||
package com.mdd.front.service.impl;
|
package com.mdd.front.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.mdd.common.core.PageResult;
|
||||||
import com.mdd.common.entity.RechargeOrder;
|
import com.mdd.common.entity.RechargeOrder;
|
||||||
|
import com.mdd.common.entity.article.Article;
|
||||||
|
import com.mdd.common.enums.PaymentEnum;
|
||||||
import com.mdd.common.mapper.RechargeOrderMapper;
|
import com.mdd.common.mapper.RechargeOrderMapper;
|
||||||
import com.mdd.common.util.TimeUtils;
|
import com.mdd.common.util.TimeUtils;
|
||||||
import com.mdd.common.util.ToolUtils;
|
import com.mdd.common.util.ToolUtils;
|
||||||
|
import com.mdd.common.util.UrlUtils;
|
||||||
import com.mdd.front.service.IRechargeService;
|
import com.mdd.front.service.IRechargeService;
|
||||||
import com.mdd.front.validate.RechargeValidate;
|
import com.mdd.front.validate.RechargeValidate;
|
||||||
|
import com.mdd.front.validate.common.PageValidate;
|
||||||
|
import com.mdd.front.vo.RechargeRecordVo;
|
||||||
|
import com.mdd.front.vo.article.ArticleListedVo;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,6 +34,31 @@ public class RechargeServiceImpl implements IRechargeService {
|
||||||
@Resource
|
@Resource
|
||||||
RechargeOrderMapper rechargeOrderMapper;
|
RechargeOrderMapper rechargeOrderMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RechargeRecordVo> record(Integer userId, PageValidate pageValidate) {
|
||||||
|
Integer pageNo = pageValidate.getPageNo();
|
||||||
|
Integer pageSize = pageValidate.getPageSize();
|
||||||
|
|
||||||
|
QueryWrapper<RechargeOrder> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("user_id", userId);
|
||||||
|
queryWrapper.eq("pay_status", PaymentEnum.OK_PAID.getCode());
|
||||||
|
queryWrapper.orderByDesc("id");
|
||||||
|
|
||||||
|
IPage<RechargeOrder> iPage = rechargeOrderMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||||
|
|
||||||
|
List<RechargeRecordVo> list = new LinkedList<>();
|
||||||
|
for (RechargeOrder rechargeOrder : iPage.getRecords()) {
|
||||||
|
RechargeRecordVo vo = new RechargeRecordVo();
|
||||||
|
vo.setId(rechargeOrder.getId());
|
||||||
|
vo.setOrderAmount(rechargeOrder.getOrderAmount());
|
||||||
|
vo.setPayTime(TimeUtils.timestampToDate(rechargeOrder.getPayTime()));
|
||||||
|
vo.setTips("充值" + vo.getOrderAmount() + "元");
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建充值订单
|
* 创建充值订单
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.mdd.front.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "充值记录Vo")
|
||||||
|
public class RechargeRecordVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单ID")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值金额")
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值描述")
|
||||||
|
private String tips;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "充值时间")
|
||||||
|
private String payTime;
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue