提交 899b312f 作者: xiaowang

账单详情

上级 eef9072f
......@@ -22,6 +22,8 @@ import java.util.Date;
public class UserBillingDetailVO implements Serializable {
private static final long serialVersionUID = -113701726830167312L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "流水编号")
......@@ -35,4 +37,6 @@ public class UserBillingDetailVO implements Serializable {
private BigDecimal salaryAmtPaid;
@ApiModelProperty(value = "操作时间")
private Date payTime;
@ApiModelProperty(value = "操作名称")
private String name;
}
......@@ -70,7 +70,14 @@ public class PayWalletController extends BaseController {
@ApiOperation(value = "用户账单明细")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserBillingDetailVO.class)})
@GetMapping("customerBillingDetail")
public ResultBody<UserBillingDetailVO> customerBillingDetail(HttpServletRequest request) {
return payWalletService.customerBillingDetail(this.getUserLoginInfoFromRedis(request).getUserAccountId());
public ResultBody<UserBillingDetailVO> customerBillingDetail(HttpServletRequest request, Integer pageNo, Integer pageSize) {
return payWalletService.customerBillingDetail(this.getUserLoginInfoFromRedis(request).getUserAccountId(), pageNo, pageSize);
}
@ApiOperation(value = "账单详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserBillingDetailVO.class)})
@GetMapping("billingDetails")
public ResultBody<UserBillingDetailVO> billingDetails(Integer id) {
return payWalletService.billingDetails(id);
}
}
......@@ -21,5 +21,9 @@ public interface PayWalletDao {
int updatePayWallet(PayWalletDO updatePayWallet);
List<PayLogDO> getPayLog(Integer userAccountId);
List<PayLogDO> getPayLog(Integer userAccountId, Integer pageNo, Integer pageSize);
int countPayLog(Integer userAccountId);
PayLogDO getPayLogById(Integer id);
}
......@@ -64,10 +64,12 @@ public class PayLogDO implements Serializable {
private Date updateTime;
private String name;
public UserBillingDetailVO buildUserBillingDetailVO() {
return UserBillingDetailVO.builder().userAccountId(userAccountId).payNo(payNo)
.payTime(payTime).payMethod(payMethod).cashAmtPaid(cashAmtPaid)
.salaryAmtPaid(salaryAmtPaid).build();
.salaryAmtPaid(salaryAmtPaid).name(name).id(id).build();
}
}
......@@ -18,6 +18,7 @@ public interface PayWalletService {
ResultBody feignTopUpCash(TopUpOrderVO topUpOrderVO);
ResultBody customerBillingDetail(Integer userAccountId);
ResultBody customerBillingDetail(Integer userAccountId, Integer pageNo, Integer pageSize);
ResultBody billingDetails(Integer id);
}
package com.mmc.iuav.user.service.wallet.impl;
import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.dao.UserServiceDao;
import com.mmc.iuav.user.dao.wallet.PayWalletDao;
......@@ -455,8 +456,18 @@ public class PayWalletServiceImpl implements PayWalletService {
}
@Override
public ResultBody customerBillingDetail(Integer userAccountId) {
List<PayLogDO> payLogList = payWalletDao.getPayLog(userAccountId);
return ResultBody.success(payLogList == null ? null : payLogList.stream().map(PayLogDO::buildUserBillingDetailVO).collect(Collectors.toList()));
public ResultBody customerBillingDetail(Integer userAccountId, Integer pageNo, Integer pageSize) {
int count = payWalletDao.countPayLog(userAccountId);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<PayLogDO> payLogList = payWalletDao.getPayLog(userAccountId, (pageNo - 1) * pageSize, pageSize);
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, payLogList.stream().map(PayLogDO::buildUserBillingDetailVO).collect(Collectors.toList())));
}
@Override
public ResultBody billingDetails(Integer id) {
PayLogDO payLogDO = payWalletDao.getPayLogById(id);
return ResultBody.success(payLogDO.buildUserBillingDetailVO());
}
}
......@@ -63,17 +63,43 @@
where user_account_id = #{userAccountId}
</select>
<select id="getPayLog" resultType="com.mmc.iuav.user.entity.wallet.PayLogDO">
select id,
user_account_id,
pay_no,
pay_method,
cash_amt_paid,
salary_amt_paid,
pay_time,
remark,
operate_user,
create_time
SELECT pl.id,
pl.user_account_id,
pl.pay_no,
pl.pay_method,
pl.cash_amt_paid,
pl.salary_amt_paid,
pl.pay_time,
pl.remark,
pl.operate_user,
pl.create_time,
wd.`name`
FROM pay_log pl
INNER JOIN wallet_dictionary wd ON pl.pay_method = wd.`code`
WHERE pl.user_account_id = #{userAccountId}
ORDER BY pl.pay_time DESC
limit #{pageNo}
, #{pageSize}
</select>
<select id="countPayLog" resultType="java.lang.Integer">
select count(*)
from pay_log
where user_account_id = #{userAccountId}
</select>
<select id="getPayLogById" resultType="com.mmc.iuav.user.entity.wallet.PayLogDO">
SELECT pl.id,
pl.user_account_id,
pl.pay_no,
pl.pay_method,
pl.cash_amt_paid,
pl.salary_amt_paid,
pl.pay_time,
pl.remark,
pl.operate_user,
pl.create_time,
wd.`name`
FROM pay_log pl
INNER JOIN wallet_dictionary wd ON pl.pay_method = wd.`code`
WHERE pl.id = #{id}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论