|
|
@ -2,6 +2,7 @@ package com.example.demo.serviceImpl.bean; |
|
|
|
|
|
|
|
import com.example.demo.domain.vo.bean.BeanAuditInfo; |
|
|
|
import com.example.demo.domain.vo.bean.BeanRechargeInfo; |
|
|
|
import com.example.demo.domain.vo.bean.GoldBean; |
|
|
|
import com.example.demo.domain.vo.coin.Result; |
|
|
|
import com.example.demo.mapper.coin.BeanAuditMapper; |
|
|
|
import com.example.demo.service.bean.BeanAuditService; |
|
|
@ -95,4 +96,36 @@ public class BeanAuditServiceImpl implements BeanAuditService { |
|
|
|
public void updateStatus2(Long id) { |
|
|
|
beanAuditMapper.updateStatus2(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public GoldBean statsBean(BeanAuditInfo beanAuditInfo) { |
|
|
|
GoldBean gold = new GoldBean(); |
|
|
|
List<BeanAuditInfo> beanAuditInfos = beanAuditMapper.selectBy(beanAuditInfo); |
|
|
|
|
|
|
|
// 初始化累加器 |
|
|
|
int permanentGoldSum = 0; |
|
|
|
int freeGoldSum = 0; |
|
|
|
int num = 0; |
|
|
|
|
|
|
|
// 遍历充值记录并累加金币 |
|
|
|
for (BeanAuditInfo info : beanAuditInfos) { |
|
|
|
// 累加永久金币 |
|
|
|
if (info.getPermanentBean() != null) { |
|
|
|
permanentGoldSum += info.getPermanentBean(); |
|
|
|
} |
|
|
|
// 累加免费金币 |
|
|
|
if (info.getFreeBean() != null) { |
|
|
|
freeGoldSum += info.getFreeBean(); |
|
|
|
} |
|
|
|
num++; |
|
|
|
} |
|
|
|
|
|
|
|
// 将累加结果设置到Gold对象 |
|
|
|
gold.setPermanentBean(permanentGoldSum); |
|
|
|
gold.setFreeBean(freeGoldSum); |
|
|
|
gold.setNum(num); |
|
|
|
gold.setBeanNum(permanentGoldSum + freeGoldSum); |
|
|
|
return gold; |
|
|
|
} |
|
|
|
|
|
|
|
} |