Commit e2b86884 authored by liaoanyuan's avatar liaoanyuan

用户查询充值卡充值次数问题修改

parent 9ca80450
...@@ -95,15 +95,32 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -95,15 +95,32 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
} }
List<PayRecord> byId = payRecordMapper.getById(user.getId()); List<PayRecord> byId = payRecordMapper.getById(user.getId());
if (!CollectionUtils.isEmpty(byId)) { if (!CollectionUtils.isEmpty(byId)) {
//计算累计充值金额 //计算充值卡充值次数
Integer sumMoney = 0; Integer rechargeTimes = 0;
for (PayRecord payRecord : byId) {
sumMoney += payRecord.getMoney(); //支付宝充值总金额
Integer alipayMoney = 0;
//微信充值总金额
Integer weChatMoney = 0;
for (PayRecord payRecord : byId) {
if (payRecord.getType() == 1) {
alipayMoney += Integer.valueOf(null==payRecord.getMoney()?0:payRecord.getMoney());
} }
userInfoDto.setMoneyAmount(sumMoney.toString()); if (payRecord.getType() == 2) {
weChatMoney += Integer.valueOf(null==payRecord.getMoney()?0:payRecord.getMoney());
}
if (payRecord.getType() == 3) {
rechargeTimes += 1;
}
} }
userInfoDto.setWeChatMoney(String.valueOf(weChatMoney));
userInfoDto.setAlipayMoney(String.valueOf(alipayMoney));
userInfoDto.setRechargeTimes(rechargeTimes);
}
//将消息进行同步 //将消息进行同步
BeanUtils.copyProperties(user, userInfoDto); BeanUtils.copyProperties(user, userInfoDto);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment