```添加处理充值记录和查询充值记录的功能
新增加了处理充值记录和查询充值记录的功能。这包括在SysUserService和相关Mapper中添加处理逻辑和数据库交互,以及在PaymentController中添加接口,允许用户进行充值记录操作。 ```master
parent
734511b6ce
commit
145a88c3c9
|
@ -8,7 +8,9 @@ import com.alipay.api.request.AlipayTradePagePayRequest;
|
|||
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
|
@ -72,5 +74,13 @@ public class PaymentController {
|
|||
return Result.success(response.getBody());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
//TODO 充值记录添加
|
||||
@PostMapping("/records")
|
||||
public Result records(@RequestBody PaymentParam paymentParam) throws AlipayApiException {
|
||||
return Result.success(userService.addRecords(paymentParam));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,10 +10,7 @@ import com.muyu.common.log.enums.BusinessType;
|
|||
import com.muyu.common.security.annotation.InnerAuth;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.*;
|
||||
import com.muyu.system.domain.resp.AuthRoleResp;
|
||||
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
||||
import com.muyu.system.domain.resp.UserInfoResp;
|
||||
|
@ -276,6 +273,15 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
//TODO 查询充值记录
|
||||
@GetMapping("/userPayinfo")
|
||||
public Result<TableDataInfo<PaymentParam>> list (PaymentParam paymentParam) {
|
||||
startPage();
|
||||
List<PaymentParam> list = userService.selectPaymentParamList(paymentParam);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -151,4 +152,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
|
||||
int addUserMoney(SysUser user);
|
||||
|
||||
public int addRecords(PaymentParam paymentParam);
|
||||
|
||||
List<PaymentParam> selectPaymentParamList(PaymentParam paymentParam);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -235,4 +236,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
|
||||
String addUserMoney(SysUser user);
|
||||
|
||||
public int addRecords(PaymentParam paymentParam);
|
||||
|
||||
List<PaymentParam> selectPaymentParamList(PaymentParam paymentParam);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||
import com.muyu.common.datascope.annotation.DataScope;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.config.AlipayConfig;
|
||||
|
@ -141,6 +142,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
return "充值成功";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRecords(PaymentParam paymentParam) {
|
||||
return userMapper.addRecords(paymentParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PaymentParam> selectPaymentParamList(PaymentParam paymentParam) {
|
||||
return userMapper.selectPaymentParamList(paymentParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户所属角色组
|
||||
*
|
||||
|
|
|
@ -189,6 +189,17 @@
|
|||
select user_balance from sys_user where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectPaymentParamList" resultType="com.muyu.common.system.domain.PaymentParam">
|
||||
select
|
||||
id,
|
||||
out_trade_no,
|
||||
product_code,
|
||||
subject,
|
||||
total_amount,
|
||||
from sys_user_payment
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="addUserMoney">
|
||||
update sys_user set user_balance = user_balance + #{userBalance} where user_id = #{userId}
|
||||
|
@ -227,6 +238,13 @@
|
|||
</insert>
|
||||
|
||||
|
||||
<insert id="addRecords">
|
||||
INSERT INTO `wangxinyuan`.`pay_ment_param` (`out_trade_no`, `total_amount`, `create_time`, `product_code`)
|
||||
VALUES (#{outTradeNo}, #{totalAmount}, now(), #{productCode});
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="updateUser" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
|
|
Loading…
Reference in New Issue