1.4.1新增账单流水
This commit is contained in:
@ -140,6 +140,7 @@ yshop基于当前流行技术组合的前后端分离商城系统: SpringBoot2
|
||||
- 1.6、修复拼团出现undefined
|
||||
- 1.7、会员后台新增余额调整
|
||||
- 1.8、修复新增配置数据有时候不成功问题等
|
||||
- 1.4.1个人中心新增账单流水
|
||||
|
||||
|
||||
#### 反馈交流
|
||||
|
@ -0,0 +1,57 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxUserRecharge对象", description = "用户充值表")
|
||||
public class YxUserRecharge extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "充值用户UID")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty(value = "充值金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "充值类型")
|
||||
private String rechargeType;
|
||||
|
||||
@ApiModelProperty(value = "是否充值")
|
||||
private Integer paid;
|
||||
|
||||
@ApiModelProperty(value = "充值支付时间")
|
||||
private Integer payTime;
|
||||
|
||||
@ApiModelProperty(value = "充值时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
@Repository
|
||||
public interface YxUserRechargeMapper extends BaseMapper<YxUserRecharge> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserRechargeQueryVo getYxUserRechargeById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxUserRechargeQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxUserRechargeQueryVo> getYxUserRechargePageList(@Param("page") Page page, @Param("param") YxUserRechargeQueryParam yxUserRechargeQueryParam);
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.param.RechargeParam;
|
||||
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
public interface YxUserRechargeService extends BaseService<YxUserRecharge> {
|
||||
|
||||
void addRecharge(RechargeParam param,int uid);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserRechargeQueryVo getYxUserRechargeById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxUserRechargeQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxUserRechargeQueryVo> getYxUserRechargePageList(YxUserRechargeQueryParam yxUserRechargeQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||
import co.yixiang.modules.user.mapper.YxUserRechargeMapper;
|
||||
import co.yixiang.modules.user.service.YxUserRechargeService;
|
||||
import co.yixiang.modules.user.web.param.RechargeParam;
|
||||
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMapper, YxUserRecharge> implements YxUserRechargeService {
|
||||
|
||||
@Autowired
|
||||
private YxUserRechargeMapper yxUserRechargeMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 充值(废弃掉)
|
||||
* @param param
|
||||
*/
|
||||
@Override
|
||||
public void addRecharge(RechargeParam param,int uid) {
|
||||
YxUserRecharge yxUserRecharge = new YxUserRecharge();
|
||||
String orderId = "re_"+OrderUtil.orderSn();
|
||||
yxUserRecharge.setOrderId(orderId);
|
||||
yxUserRecharge.setUid(uid);
|
||||
yxUserRecharge.setPrice(BigDecimal.valueOf(param.getPrice()));
|
||||
yxUserRecharge.setRechargeType("weixin");
|
||||
yxUserRecharge.setPaid(0);
|
||||
yxUserRecharge.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
|
||||
yxUserRechargeMapper.insert(yxUserRecharge);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxUserRechargeQueryVo getYxUserRechargeById(Serializable id) throws Exception{
|
||||
return yxUserRechargeMapper.getYxUserRechargeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxUserRechargeQueryVo> getYxUserRechargePageList(YxUserRechargeQueryParam yxUserRechargeQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxUserRechargeQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxUserRechargeQueryVo> iPage = yxUserRechargeMapper.getYxUserRechargePageList(page,yxUserRechargeQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package co.yixiang.modules.user.web.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.common.api.ApiResult;
|
||||
import co.yixiang.common.web.controller.BaseController;
|
||||
import co.yixiang.common.web.param.IdParam;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.user.entity.YxUserAddress;
|
||||
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||
import co.yixiang.modules.user.service.YxUserRechargeService;
|
||||
import co.yixiang.modules.user.web.param.AddressParam;
|
||||
import co.yixiang.modules.user.web.param.RechargeParam;
|
||||
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Api(value = "用户充值", tags = "用户充值", description = "用户充值")
|
||||
public class UserRechargeController extends BaseController {
|
||||
|
||||
|
||||
private final YxUserRechargeService userRechargeService;
|
||||
|
||||
/**
|
||||
* 公众号充值
|
||||
*/
|
||||
@PostMapping("/recharge/wechat")
|
||||
@ApiOperation(value = "公众号充值",notes = "公众号充值",response = ApiResult.class)
|
||||
public ApiResult<Map<String,Object>> add(@Valid @RequestBody RechargeParam param){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("id",null);
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
package co.yixiang.modules.user.web.controller;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||
import co.yixiang.modules.user.service.YxUserRechargeService;
|
||||
import co.yixiang.modules.user.web.param.YxUserRechargeQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo;
|
||||
import co.yixiang.common.web.controller.BaseController;
|
||||
import co.yixiang.common.api.ApiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.common.web.param.IdParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/yxUserRecharge")
|
||||
@Api("用户充值表 API")
|
||||
public class YxUserRechargeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private YxUserRechargeService yxUserRechargeService;
|
||||
|
||||
/**
|
||||
* 添加用户充值表
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "添加YxUserRecharge对象",notes = "添加用户充值表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> addYxUserRecharge(@Valid @RequestBody YxUserRecharge yxUserRecharge) throws Exception{
|
||||
boolean flag = yxUserRechargeService.save(yxUserRecharge);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户充值表
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改YxUserRecharge对象",notes = "修改用户充值表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> updateYxUserRecharge(@Valid @RequestBody YxUserRecharge yxUserRecharge) throws Exception{
|
||||
boolean flag = yxUserRechargeService.updateById(yxUserRecharge);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户充值表
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除YxUserRecharge对象",notes = "删除用户充值表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> deleteYxUserRecharge(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
boolean flag = yxUserRechargeService.removeById(idParam.getId());
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户充值表
|
||||
*/
|
||||
@PostMapping("/info")
|
||||
@ApiOperation(value = "获取YxUserRecharge对象详情",notes = "查看用户充值表",response = YxUserRechargeQueryVo.class)
|
||||
public ApiResult<YxUserRechargeQueryVo> getYxUserRecharge(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
YxUserRechargeQueryVo yxUserRechargeQueryVo = yxUserRechargeService.getYxUserRechargeById(idParam.getId());
|
||||
return ApiResult.ok(yxUserRechargeQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户充值表分页列表
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
@ApiOperation(value = "获取YxUserRecharge分页列表",notes = "用户充值表分页列表",response = YxUserRechargeQueryVo.class)
|
||||
public ApiResult<Paging<YxUserRechargeQueryVo>> getYxUserRechargePageList(@Valid @RequestBody(required = false) YxUserRechargeQueryParam yxUserRechargeQueryParam) throws Exception{
|
||||
Paging<YxUserRechargeQueryVo> paging = yxUserRechargeService.getYxUserRechargePageList(yxUserRechargeQueryParam);
|
||||
return ApiResult.ok(paging);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName RechargeParam
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/8
|
||||
**/
|
||||
@Data
|
||||
public class RechargeParam implements Serializable {
|
||||
private String from;
|
||||
|
||||
@NotNull(message = "金额必填")
|
||||
@Min(value = 1,message = "充值金额不能低于1")
|
||||
private Double price;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxUserRechargeQueryParam对象", description="用户充值表查询参数")
|
||||
public class YxUserRechargeQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户充值表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "YxUserRechargeQueryVo对象", description = "用户充值表查询参数")
|
||||
public class YxUserRechargeQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "充值用户UID")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty(value = "充值金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "充值类型")
|
||||
private String rechargeType;
|
||||
|
||||
@ApiModelProperty(value = "是否充值")
|
||||
private Integer paid;
|
||||
|
||||
@ApiModelProperty(value = "充值支付时间")
|
||||
private Integer payTime;
|
||||
|
||||
@ApiModelProperty(value = "充值时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "退款金额")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="co.yixiang.modules.user.mapper.YxUserRechargeMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, uid, order_id, price, recharge_type, paid, pay_time, add_time, refund_price
|
||||
</sql>
|
||||
|
||||
<select id="getYxUserRechargeById" resultType="co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_recharge where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxUserRechargePageList" resultType="co.yixiang.modules.user.web.vo.YxUserRechargeQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_recharge
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -47,7 +47,7 @@ public class CodeGenerator {
|
||||
// 作者
|
||||
private static final String AUTHOR = "hupeng";
|
||||
// 生成的表名称
|
||||
private static final String TABLE_NAME = "yx_user_task_finish"; // 主键数据库列名称
|
||||
private static final String TABLE_NAME = "yx_user_recharge"; // 主键数据库列名称
|
||||
private static final String PK_ID_COLUMN_NAME = "id";
|
||||
// 代码生成策略 true:All/false:SIMPLE
|
||||
private static final boolean GENERATOR_STRATEGY = true;
|
||||
|
Reference in New Issue
Block a user