|
|
@ -132,31 +132,11 @@ public class BeanRechargeServiceImpl implements BeanRechargeService { |
|
|
|
//统计系统金豆记录 |
|
|
|
@Override |
|
|
|
public GoldBean statsSystemBean(BeanSystemRechargeInfo beanSystemRechargeInfo) { |
|
|
|
GoldBean gold = new GoldBean(); |
|
|
|
List<BeanSystemRechargeInfo> beanSystemRechargeInfos = beanRechargeMapper2.selectBySystem(beanSystemRechargeInfo); |
|
|
|
|
|
|
|
// 初始化累加器 |
|
|
|
int permanentGoldSum = 0; |
|
|
|
int freeGoldSum = 0; |
|
|
|
BigDecimal moneySum = new BigDecimal("0.0"); |
|
|
|
|
|
|
|
// 遍历充值记录并累加金币 |
|
|
|
for (BeanSystemRechargeInfo info : beanSystemRechargeInfos) { |
|
|
|
// 累加永久金币 |
|
|
|
if (info.getPermanentBean() != null) { |
|
|
|
permanentGoldSum += info.getPermanentBean(); |
|
|
|
} |
|
|
|
// 累加免费金币 |
|
|
|
if (info.getFreeBean() != null) { |
|
|
|
freeGoldSum += info.getFreeBean(); |
|
|
|
} |
|
|
|
} |
|
|
|
moneySum = new BigDecimal(permanentGoldSum).divide(new BigDecimal("50"), 2, RoundingMode.HALF_UP); |
|
|
|
// 将累加结果设置到Gold对象 |
|
|
|
gold.setPermanentBean(permanentGoldSum); |
|
|
|
gold.setFreeBean(freeGoldSum); |
|
|
|
GoldBean gold = beanRechargeMapper2.selectSystemSum(beanSystemRechargeInfo); |
|
|
|
BigDecimal moneySum; |
|
|
|
moneySum = new BigDecimal(gold.getPermanentBean()).divide(new BigDecimal("50"), 2, RoundingMode.HALF_UP); |
|
|
|
gold.setMoney(moneySum.doubleValue()); |
|
|
|
gold.setBeanNum(permanentGoldSum+freeGoldSum); |
|
|
|
gold.setBeanNum(gold.getPermanentBean()+gold.getFreeBean()); |
|
|
|
return gold; |
|
|
|
} |
|
|
|
|
|
|
@ -182,28 +162,7 @@ public class BeanRechargeServiceImpl implements BeanRechargeService { |
|
|
|
//统计线上金豆记录 |
|
|
|
@Override |
|
|
|
public GoldBean statsOnlineBean(BeanOnlineRechargeInfo beanOnlineRechargeInfo) { |
|
|
|
GoldBean gold = new GoldBean(); |
|
|
|
List<BeanOnlineRechargeInfo> beanOnlineRechargeInfos = beanRechargeMapper3.selectByOnline(beanOnlineRechargeInfo); |
|
|
|
|
|
|
|
// 初始化累加器 |
|
|
|
int countSum = 0; |
|
|
|
BigDecimal moneySum = new BigDecimal("0.0"); |
|
|
|
|
|
|
|
// 遍历充值记录并累加金币 |
|
|
|
for (BeanOnlineRechargeInfo info : beanOnlineRechargeInfos) { |
|
|
|
// 累加数量 |
|
|
|
if (info.getNum() != null) { |
|
|
|
countSum += info.getNum(); |
|
|
|
} |
|
|
|
// 累加金额 |
|
|
|
if (info.getMoney() != null) { |
|
|
|
moneySum = moneySum.add(new BigDecimal(info.getMoney().toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 将累加结果设置到Gold对象 |
|
|
|
gold.setBeanNum(countSum); |
|
|
|
gold.setMoney(moneySum.doubleValue()); |
|
|
|
GoldBean gold = beanRechargeMapper3.selectOnlineSum(beanOnlineRechargeInfo); |
|
|
|
return gold; |
|
|
|
} |
|
|
|
|
|
|
|