提交 899b312f 作者: xiaowang

账单详情

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