|
@@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
import java.util.concurrent.*;
|
|
@@ -179,6 +180,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
}
|
|
|
//插入账户变更记录
|
|
|
detail.setAccountBalance(accountVo.getAmountUsable());
|
|
|
+ detail.setUpdateTime(new Date());
|
|
|
userAccountRecordService.updateById(detail);
|
|
|
return HttpResponseResult.succeed(detail);
|
|
|
}
|
|
@@ -191,40 +193,87 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
BigDecimal liveAmount = BigDecimal.ZERO;
|
|
|
BigDecimal videoAmount = BigDecimal.ZERO;
|
|
|
BigDecimal musicAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal liveShareAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal videoShareAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal musicShareAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal vipShareAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal mallShareAmount = BigDecimal.ZERO;
|
|
|
+
|
|
|
for (AccountTotal info : infoList) {
|
|
|
info.setPracticeAmount(null == info.getPracticeAmount() ? BigDecimal.ZERO : info.getPracticeAmount());
|
|
|
info.setLiveAmount(null == info.getLiveAmount() ? BigDecimal.ZERO : info.getLiveAmount());
|
|
|
info.setVideoAmount(null == info.getVideoAmount() ? BigDecimal.ZERO : info.getVideoAmount());
|
|
|
info.setMusicAmount(null == info.getMusicAmount() ? BigDecimal.ZERO : info.getMusicAmount());
|
|
|
|
|
|
+ info.setLiveShareAmount(null == info.getLiveShareAmount() ? BigDecimal.ZERO : info.getLiveShareRate());
|
|
|
+ info.setVideoShareAmount(null == info.getVideoShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
|
|
|
+ info.setMusicShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMusicShareAmount());
|
|
|
+ info.setVipShareAmount(null == info.getVipShareAmount() ? BigDecimal.ZERO : info.getVipShareAmount());
|
|
|
+ info.setMallShareAmount(null == info.getMusicShareAmount() ? BigDecimal.ZERO : info.getMusicShareAmount());
|
|
|
+
|
|
|
practiceAmount = practiceAmount.add(info.getPracticeAmount());
|
|
|
liveAmount = liveAmount.add(info.getLiveAmount());
|
|
|
videoAmount = videoAmount.add(info.getVideoAmount());
|
|
|
musicAmount = musicAmount.add(info.getMusicAmount());
|
|
|
+
|
|
|
+ liveShareAmount = liveShareAmount.add(info.getLiveShareAmount());
|
|
|
+ videoShareAmount = videoShareAmount.add(info.getVideoShareAmount());
|
|
|
+ musicShareAmount = musicShareAmount.add(info.getMusicShareAmount());
|
|
|
+ vipShareAmount = vipShareAmount.add(info.getVipShareAmount());
|
|
|
+ mallShareAmount = mallShareAmount.add(info.getMallShareAmount());
|
|
|
}
|
|
|
AccountTotal total = new AccountTotal();
|
|
|
|
|
|
- total.setTotalInAmount(practiceAmount.add(liveAmount).add(videoAmount).add(musicAmount));
|
|
|
+ total.setTotalInAmount(
|
|
|
+ practiceAmount.add(liveAmount).add(videoAmount).add(musicAmount)
|
|
|
+ .add(liveShareAmount).add(videoShareAmount).add(musicShareAmount)
|
|
|
+ .add(vipShareAmount).add(mallShareAmount)
|
|
|
+ );
|
|
|
if (total.getTotalInAmount().doubleValue() > 0) {
|
|
|
total.setPracticeAmount(practiceAmount);
|
|
|
- BigDecimal practiceRate = total.getPracticeAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- total.setPracticeRate(practiceRate);
|
|
|
+ total.setPracticeRate(total.getPracticeAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setLiveAmount(liveAmount);
|
|
|
- BigDecimal liveRate = total.getLiveAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- total.setLiveRate(liveRate);
|
|
|
+ total.setLiveRate(total.getLiveAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setVideoAmount(videoAmount);
|
|
|
- BigDecimal videoRate = total.getVideoAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- total.setVideoRate(videoRate);
|
|
|
+ total.setVideoRate(total.getVideoAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setMusicAmount(musicAmount);
|
|
|
- BigDecimal musicRate = total.getMusicAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- total.setMusicRate(musicRate);
|
|
|
+ total.setMusicRate(total.getMusicAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
+
|
|
|
+ total.setLiveShareAmount(liveShareAmount);
|
|
|
+ total.setLiveShareRate(total.getLiveShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
+
|
|
|
+ total.setVideoShareAmount(videoShareAmount);
|
|
|
+ total.setVideoShareRate(total.getVideoShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
+
|
|
|
+ total.setMusicShareAmount(musicShareAmount);
|
|
|
+ total.setMusicShareRate(total.getMusicShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
+
|
|
|
+ total.setVipShareAmount(vipShareAmount);
|
|
|
+ total.setVipShareRate(total.getVipShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
+
|
|
|
+ total.setMallShareAmount(mallShareAmount);
|
|
|
+ total.setMallShareRate(total.getMallShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100")));
|
|
|
}
|
|
|
total.setInfoList(infoList);
|
|
|
return HttpResponseResult.succeed(total);
|