|
@@ -341,81 +341,115 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
|
if (total.getTotalInAmount().doubleValue() > 0) {
|
|
|
total.setPracticeAmount(practiceAmount);
|
|
|
total.setPracticeRate(total.getPracticeAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setVipCourseAmount(vipCourseAmount);
|
|
|
total.setVipCourseRate(total.getVipCourseAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setLiveAmount(liveAmount);
|
|
|
total.setLiveRate(total.getLiveAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
|
|
|
total.setGroupAmount(groupAmount);
|
|
|
total.setGroupRate(total.getGroupAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setVideoAmount(videoAmount);
|
|
|
total.setVideoRate(total.getVideoAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setMusicAmount(musicAmount);
|
|
|
total.setMusicRate(total.getMusicAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setLiveShareAmount(liveShareAmount);
|
|
|
total.setLiveShareRate(total.getLiveShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setVideoShareAmount(videoShareAmount);
|
|
|
total.setVideoShareRate(total.getVideoShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setMusicShareAmount(musicShareAmount);
|
|
|
total.setMusicShareRate(total.getMusicShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setAlbumShareAmount(albumShareAmount);
|
|
|
total.setAlbumShareRate(total.getAlbumShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setVipShareAmount(vipShareAmount);
|
|
|
total.setVipShareRate(total.getVipShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setMallShareAmount(mallShareAmount);
|
|
|
total.setMallShareRate(total.getMallShareAmount()
|
|
|
- .divide(total.getTotalInAmount(), 4, RoundingMode.HALF_UP)
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
.multiply(new BigDecimal("100")));
|
|
|
|
|
|
total.setActiRegistShareAmount(actiRegistShareAmount);
|
|
|
total.setActiRegistShareRate(
|
|
|
- BigDecimal.valueOf(100)
|
|
|
- .subtract(total.getPracticeRate())
|
|
|
- .subtract(total.getVipCourseRate())
|
|
|
- .subtract(total.getLiveRate())
|
|
|
- .subtract(total.getGroupRate())
|
|
|
- .subtract(total.getVideoRate())
|
|
|
- .subtract(total.getMusicRate())
|
|
|
- .subtract(total.getMusicShareRate())
|
|
|
- .subtract(total.getLiveShareRate())
|
|
|
- .subtract(total.getVideoShareRate())
|
|
|
- .subtract(total.getAlbumShareRate())
|
|
|
- .subtract(total.getVipShareRate())
|
|
|
- .subtract(total.getMallShareRate())
|
|
|
+ total.getActiRegistShareAmount()
|
|
|
+ .divide(total.getTotalInAmount(), 4, RoundingMode.DOWN)
|
|
|
+ .multiply(new BigDecimal("100"))
|
|
|
);
|
|
|
+
|
|
|
+ BigDecimal subtract = BigDecimal.valueOf(100)
|
|
|
+ .subtract(total.getPracticeRate())
|
|
|
+ .subtract(total.getVipCourseRate())
|
|
|
+ .subtract(total.getLiveRate())
|
|
|
+ .subtract(total.getGroupRate())
|
|
|
+ .subtract(total.getVideoRate())
|
|
|
+ .subtract(total.getMusicRate())
|
|
|
+ .subtract(total.getMusicShareRate())
|
|
|
+ .subtract(total.getLiveShareRate())
|
|
|
+ .subtract(total.getVideoShareRate())
|
|
|
+ .subtract(total.getAlbumShareRate())
|
|
|
+ .subtract(total.getVipShareRate())
|
|
|
+ .subtract(total.getMallShareRate())
|
|
|
+ .subtract(total.getActiRegistShareAmount());
|
|
|
+ if (subtract.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ if (total.getVipCourseAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setVipCourseRate(total.getVipCourseRate().add(subtract));
|
|
|
+ } else if (total.getPracticeAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setPracticeRate(total.getPracticeRate().add(subtract));
|
|
|
+ } else if (total.getLiveAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setLiveRate(total.getLiveRate().add(subtract));
|
|
|
+ } else if (total.getGroupAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setGroupRate(total.getGroupRate().add(subtract));
|
|
|
+ } else if (total.getVideoAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setVideoRate(total.getVideoRate().add(subtract));
|
|
|
+ } else if (total.getMusicAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setMusicRate(total.getMusicRate().add(subtract));
|
|
|
+ } else if (total.getMusicShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setMusicShareRate(total.getMusicShareRate().add(subtract));
|
|
|
+ } else if (total.getLiveShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setLiveShareRate(total.getLiveShareRate().add(subtract));
|
|
|
+ } else if (total.getVideoShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setVideoShareRate(total.getVideoShareRate().add(subtract));
|
|
|
+ } else if (total.getAlbumShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setAlbumShareRate(total.getAlbumShareRate().add(subtract));
|
|
|
+ } else if (total.getVipShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setVipShareRate(total.getVipShareRate().add(subtract));
|
|
|
+ } else if (total.getMallShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setMallShareRate(total.getMallShareRate().add(subtract));
|
|
|
+ } else if (total.getActiRegistShareAmount().compareTo(BigDecimal.ZERO) >0) {
|
|
|
+ total.setActiRegistShareRate(total.getActiRegistShareRate().add(subtract));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
total.setInfoList(infoList);
|
|
|
return HttpResponseResult.succeed(total);
|