diff --git a/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusStatisServiceApi.java b/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusStatisServiceApi.java index 57f831c3..b84ff819 100644 --- a/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusStatisServiceApi.java +++ b/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusStatisServiceApi.java @@ -4,28 +4,16 @@ import com.hzs.common.core.domain.R; /** * @description: 奖金拨比统计 - * @author: zhang jing - * @date: 2023/6/1 17:24 - * @param: - * @return: **/ public interface ICuBonusStatisServiceApi { /** * @description: 统计历史奖金拨比 - * @author: zhang jing - * @date: 2023/10/19 9:29 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ R statsHistoryBonus(String startDate, String endDate); /** * @description: 删除奖金拨比统计数据 - * @author: zhang jing - * @date: 2023/12/11 10:56 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ R delStats(String startDate, String endDate); diff --git a/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusVertexStatisServiceApi.java b/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusVertexStatisServiceApi.java index 34a1b211..9d1983d1 100644 --- a/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusVertexStatisServiceApi.java +++ b/bd-api/bd-api-member/src/main/java/com/hzs/member/statis/ICuBonusVertexStatisServiceApi.java @@ -3,32 +3,18 @@ package com.hzs.member.statis; import com.hzs.common.core.domain.R; /** - * @description: 顶点奖金拨比统计 - * @author: zhang jing - * @date: 2023/6/1 17:24 - * @param: - * @return: + * 顶点奖金拨比统计 **/ public interface ICuBonusVertexStatisServiceApi { /** * @description: 7天重算顶点奖金拨比统计 - * @author: zhang jing - * @date: 2024/8/15 10:30 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ R anewStatsHistoryBonus(String startDate, String endDate); - /** * @description: 删除奖金拨比统计数据 - * @author: zhang jing - * @date: 2023/12/11 10:56 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ R delStats(String startDate, String endDate); - } diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/achieve/service/impl/CuMemberSettlePeriodServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/achieve/service/impl/CuMemberSettlePeriodServiceImpl.java index 31388d63..9ef71ad8 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/achieve/service/impl/CuMemberSettlePeriodServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/achieve/service/impl/CuMemberSettlePeriodServiceImpl.java @@ -44,7 +44,6 @@ public class CuMemberSettlePeriodServiceImpl extends ServiceImpl queryCuMemberSettlePeriod(Date startDate, Date endDate) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/mapper/CuEnergySiloDetailMapper.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/mapper/CuEnergySiloDetailMapper.java index 4f14b3c9..e118b89f 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/mapper/CuEnergySiloDetailMapper.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/mapper/CuEnergySiloDetailMapper.java @@ -2,27 +2,13 @@ package com.hzs.member.attest.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hzs.common.domain.member.attest.CuEnergySiloDetail; -import com.hzs.common.domain.member.ext.CuEnergySiloDetailExt; -import com.hzs.member.attest.param.EnergySiloParam; - -import java.util.List; /** - *

* 抗衡能量仓明细表 Mapper 接口 - *

* * @author hzs * @since 2023-04-12 */ public interface CuEnergySiloDetailMapper extends BaseMapper { - /** - * 根据参数查询能量仓数据 - * @param energySiloParam 参数 - * @return: List - * @Author: sui q - * @Date: 2023/2/12 10:13 - */ - List queryEnergySiloDetailByCondition(EnergySiloParam energySiloParam); } diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/ICuEnergySiloDetailService.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/ICuEnergySiloDetailService.java index 2c9814c5..58359c8a 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/ICuEnergySiloDetailService.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/ICuEnergySiloDetailService.java @@ -2,10 +2,6 @@ package com.hzs.member.attest.service; import com.baomidou.mybatisplus.extension.service.IService; import com.hzs.common.domain.member.attest.CuEnergySiloDetail; -import com.hzs.common.domain.member.ext.CuEnergySiloDetailExt; -import com.hzs.member.attest.param.EnergySiloParam; - -import java.util.List; /** * 抗衡能量仓明细表 服务类 @@ -15,14 +11,4 @@ import java.util.List; */ public interface ICuEnergySiloDetailService extends IService { - /** - * 根据参数查询能量仓数据 - * - * @param energySiloParam 参数 - * @return: List - * @Author: sui q - * @Date: 2023/2/12 10:13 - */ - List queryEnergySiloDetailByCondition(EnergySiloParam energySiloParam); - } diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/impl/CuEnergySiloDetailServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/impl/CuEnergySiloDetailServiceImpl.java index cf111fc6..5074df64 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/impl/CuEnergySiloDetailServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/attest/service/impl/CuEnergySiloDetailServiceImpl.java @@ -1,17 +1,11 @@ package com.hzs.member.attest.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hzs.common.core.utils.DateUtils; import com.hzs.common.domain.member.attest.CuEnergySiloDetail; -import com.hzs.common.domain.member.ext.CuEnergySiloDetailExt; import com.hzs.member.attest.mapper.CuEnergySiloDetailMapper; -import com.hzs.member.attest.param.EnergySiloParam; import com.hzs.member.attest.service.ICuEnergySiloDetailService; import org.springframework.stereotype.Service; -import java.time.temporal.ChronoUnit; -import java.util.List; - /** * 抗衡能量仓明细表 服务实现类 * @@ -21,12 +15,4 @@ import java.util.List; @Service public class CuEnergySiloDetailServiceImpl extends ServiceImpl implements ICuEnergySiloDetailService { - @Override - public List queryEnergySiloDetailByCondition(EnergySiloParam energySiloParam) { - if (energySiloParam.getStartEndDate() != null) { - energySiloParam.setStartEndDate(DateUtils.afterDate(1, ChronoUnit.DAYS, energySiloParam.getStartEndDate())); - } - return baseMapper.queryEnergySiloDetailByCondition(energySiloParam); - } - } diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/mapper/CuMemberMapper.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/mapper/CuMemberMapper.java index 12828085..9194b8d2 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/mapper/CuMemberMapper.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/mapper/CuMemberMapper.java @@ -273,14 +273,6 @@ public interface CuMemberMapper extends BaseMapper { */ int insertBatchCuMember(@Param("memberList") List memberList); - /** - * 查询会员关系列表 - * - * @param memberId - * @return - */ - List selectByTreeMemberList(Long memberId); - /** * @description:特殊业务-修改结算国 **/ diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/ICuMemberService.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/ICuMemberService.java index fb630bfb..79f91083 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/ICuMemberService.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/ICuMemberService.java @@ -391,14 +391,6 @@ public interface ICuMemberService extends IService { **/ List selectBiddingList(MarketNewsParam marketNewsParam); - /** - * 查询会员关系列表 - * - * @param memberId - * @return - */ - List selectByTreeMemberList(Long memberId); - /** * @description: **/ diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/impl/CuMemberServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/impl/CuMemberServiceImpl.java index 5c19126d..fabc293c 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/impl/CuMemberServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/base/service/impl/CuMemberServiceImpl.java @@ -1969,17 +1969,6 @@ public class CuMemberServiceImpl extends ServiceImpl i return baseMapper.selectBiddingList(marketNewsParam); } - /** - * 查询会员关系列表 - * - * @param memberId - * @return - */ - @Override - public List selectByTreeMemberList(Long memberId) { - return baseMapper.selectByTreeMemberList(memberId); - } - /** * 后台设置推荐上下级 * diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/controller/manager/CuBonusStatisController.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/controller/manager/CuBonusStatisController.java index 36e6da2a..03c0d8c7 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/controller/manager/CuBonusStatisController.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/controller/manager/CuBonusStatisController.java @@ -32,16 +32,12 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.math.RoundingMode; -import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; /** * 奖金拨比统计 前端控制器 - * - * @author zhangjing - * @since 2023-05-31 */ @Slf4j @RestController @@ -54,31 +50,24 @@ public class CuBonusStatisController extends BaseController { private ICuMemberService iCuMemberService; @DubboReference - ICurrencyServiceApi currencyServiceApi; - + ICurrencyServiceApi iCurrencyServiceApi; /** * @description: 奖金拨比列表 - * @author: zhang jing - * @date: 2023/6/2 17:27 - * @param: [cuBonusStatisVO] - * @return: com.hzs.common.core.web.page.TableDataInfo **/ @AccessPermissions("performanceList") @GetMapping("/list") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.SELECT) public TableDataInfo list(CuBonusStatisVO cuBonusStatisVO) { int pkCountry = SecurityUtils.getPkCountry(); - List slList; - R currency = currencyServiceApi.getCurrency(pkCountry); + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); - R chCurrency = currencyServiceApi.getCurrency(CountryConstants.CHINA_COUNTRY); - BigDecimal chRate = chCurrency.getData().getInExchangeRate() == null ? BigDecimal.ONE : chCurrency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); cuBonusStatisVO.setRate(exchangeRate); - BigDecimal cent = new BigDecimal(100); cuBonusStatisVO.setPerCent(exchangeRate.multiply(cent)); cuBonusStatisVO.setPkCountry(pkCountry); - //默认查询当前日期的前一天 + // 默认查询当前日期的前一天 Date date = DateUtils.currentDate(); if (StringUtils.isEmpty(cuBonusStatisVO.getStartDate()) || StringUtils.isEmpty(cuBonusStatisVO.getEndDate())) { @@ -99,31 +88,22 @@ public class CuBonusStatisController extends BaseController { } //查询订单业绩,查询分红配置每月10号分红 -// List orderAchieveList; BigDecimal dividendRatio = BigDecimal.ZERO; //查询奖金扣项配置参数 0.8 - if (pkCountry == CountryConstants.CHINA_COUNTRY) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } - //查询天数 -// Integer days = DateUtils.betweenDay(DateUtils.parseDate(cuBonusStatisVO.getStartDate()), DateUtils.parseDate(cuBonusStatisVO.getEndDate())); -// if (days == 0) { -// days = 1; -// } + List orderTypeList = new ArrayList<>(); orderTypeList.add(EOrderType.REGISTER_ORDER.getValue()); orderTypeList.add(EOrderType.UPGRADE_ORDER.getValue()); orderTypeList.add(EOrderType.SPECIAL_REGISTER_ORDER.getValue()); orderTypeList.add(EOrderType.SPECIAL_UPGRADE_ORDER.getValue()); cuBonusStatisVO.setOrderTypeList(orderTypeList); - //查询分红比例配置 + List bdr = iCuBonusStatisService.bonusDividendRatiolist(cuBonusStatisVO); if (CollectionUtil.isNotEmpty(bdr)) { BigDecimal ratio = new BigDecimal("0.01"); @@ -135,200 +115,68 @@ public class CuBonusStatisController extends BaseController { } else { cuBonusStatisVO.setDividendRatio(BigDecimal.ZERO); } - //查询体系订单分红业绩 -// orderAchieveList = iCuBonusStatisService.queryOrderAchieveList(cuBonusStatisVO); -// if (CollectionUtil.isNotEmpty(orderAchieveList)) { -// Integer finalDays = days; -// BigDecimal finalDividendRatio = dividendRatio; -// orderAchieveList.forEach(itm -> { -// if (itm.getOrderAchieve().compareTo(BigDecimal.ZERO) > 0) { -// //计算平均每天分红 -// BigDecimal bidays = new BigDecimal(finalDays); -// itm.setOrderAchieve((itm.getOrderAchieve().divide(bidays, 4, RoundingMode.HALF_UP)).multiply(finalDividendRatio)); -// } -// }); -// } + startPage(); - if (pkCountry == CountryConstants.CHINA_COUNTRY) { - //查询中国奖金拨比列表 - slList = iCuBonusStatisService.queryCuBonusStatis(cuBonusStatisVO); - } else { - //查询国外奖金拨比 - slList = iCuBonusStatisService.queryForeignCountryCuBonusStatis(cuBonusStatisVO); - } + // 查询中国奖金拨比列表 + List slList = iCuBonusStatisService.queryCuBonusStatis(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(slList)) { - //查询能量舱订单金额 - List energyChamberAmount = iCuBonusStatisService.queryEnergyChamberOrderList(cuBonusStatisVO); -// List finalOrderAchieveList = orderAchieveList; slList.forEach(itm -> { - if (pkCountry == CountryConstants.CHINA_COUNTRY) { - if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getMakerDirect().compareTo(BigDecimal.ZERO) > 0) { - itm.setMakerDirect(itm.getMakerDirect().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getMakerShare().compareTo(BigDecimal.ZERO) > 0) { - itm.setMakerShare(itm.getMakerShare().multiply(currency.getData().getInExchangeRate())); - } - String creationTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, itm.getCreationTime()); - //首购金额减掉能量舱订单金额 - if (CollectionUtil.isNotEmpty(energyChamberAmount)) { - energyChamberAmount.forEach(itmm -> { - String payTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, itmm.getPayTime()); - if (itm.getPkVertex().equals(itmm.getPkVertex()) && - payTime.equals(creationTime) - ) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().subtract(itmm.getOrderAmount()).add(itmm.getEnergySum())); - itm.setEnergyAmountAll(itm.getEnergyAmountAll().add(itmm.getOrderAmount().subtract(itmm.getEnergySum()))); - } - }); - } - //重新算首购拨比 - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - BigDecimal mainBonusRate = cent.multiply((itm.getMainBonus()).multiply(currency.getData().getInExchangeRate())); - mainBonusRate = mainBonusRate.divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP); - itm.setMainBonusRate(mainBonusRate); - itm.setMainBonusPvRate(itm.getMainBonusPvRate().divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP)); - } - //重新算总拨比 - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || - itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - BigDecimal totalBonusRate = cent.multiply((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); - totalBonusRate = totalBonusRate.divide(itm.getFirstPurchaseAll().add(itm.getRepurchaseAllAmount()), 4, RoundingMode.HALF_UP); - itm.setTotalBonusRate(totalBonusRate); - } - //分红 -// if (CollectionUtil.isNotEmpty(finalOrderAchieveList)) { -// for (CuBonusStatisVO ordeac : finalOrderAchieveList) { -// if (ordeac.getPkVertex().equals(itm.getPkVertex())) { -// itm.setShareBonus(ordeac.getOrderAchieve().multiply(currency.getData().getInExchangeRate())); -// //重新算首购拨比 -// if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { -// BigDecimal mainBonusRate = cent.multiply((itm.getMainBonus().add(ordeac.getOrderAchieve())).multiply(currency.getData().getInExchangeRate())); -// mainBonusRate = mainBonusRate.divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP); -// itm.setMainBonusRate(mainBonusRate); -// } -// //重新算总拨比 -// if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || -// itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { -// BigDecimal totalBonusRate = cent.multiply((itm.getTotalBonus().add(ordeac.getOrderAchieve())).multiply(currency.getData().getInExchangeRate())); -// totalBonusRate = totalBonusRate.divide(itm.getFirstPurchaseAll().add(itm.getRepurchaseAllAmount()), 4, RoundingMode.HALF_UP); -// itm.setTotalBonusRate(totalBonusRate); -// } -// //首购拨出金额 -// itm.setMainBonus((itm.getMainBonus().add(ordeac.getOrderAchieve())).multiply(currency.getData().getInExchangeRate())); -// itm.setTotalBonus((itm.getTotalBonus().add(ordeac.getOrderAchieve())).multiply(currency.getData().getInExchangeRate())); -// } -// } -// } else { - //首购拨出金额 - itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); - itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); -// } -// if (itm.getShareBonus().compareTo(BigDecimal.ZERO) > 0) { -// itm.setShareBonus(itm.getShareBonus().multiply(currency.getData().getInExchangeRate())); -// } - if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { - itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); + if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); } - //国外转为人民币 - if (pkCountry != CountryConstants.CHINA_COUNTRY) { - //订单金额 - if (itm.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRegAmount(itm.getMainRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainUpAmount(itm.getMainUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRegAmount(itm.getAgentRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentUpAmount(itm.getAgentUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentFirstAmount(itm.getAgentFirstAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRepurAmount(itm.getAgentRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRepurAmount(itm.getMainRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setHifansRegAmount(itm.getHifansRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurchaseAllAmount(itm.getRepurchaseAllAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - //奖金 - if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(chRate)); - } - if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setOrgBonus(itm.getOrgBonus().multiply(chRate)); - } - if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setLeaderBonus(itm.getLeaderBonus().multiply(chRate)); - } - if (itm.getShareBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setShareBonus(itm.getShareBonus().multiply(chRate)); - } - if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setServiceBonus(itm.getServiceBonus().multiply(chRate)); - } - if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(chRate)); - } - if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(chRate)); - } - if (itm.getMainBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainBonus(itm.getMainBonus().multiply(chRate)); - } - if (itm.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurBonus(itm.getRepurBonus().multiply(chRate)); - } - if (itm.getTotalBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setTotalBonus(itm.getTotalBonus().multiply(chRate)); - } + if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); } + if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getMakerDirect().compareTo(BigDecimal.ZERO) > 0) { + itm.setMakerDirect(itm.getMakerDirect().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getMakerShare().compareTo(BigDecimal.ZERO) > 0) { + itm.setMakerShare(itm.getMakerShare().multiply(currency.getData().getInExchangeRate())); + } + // 重新算首购拨比 + if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { + BigDecimal mainBonusRate = cent.multiply((itm.getMainBonus()).multiply(currency.getData().getInExchangeRate())); + mainBonusRate = mainBonusRate.divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP); + itm.setMainBonusRate(mainBonusRate); + itm.setMainBonusPvRate(itm.getMainBonusPvRate().divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP)); + } + // 重新算总拨比 + if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || + itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { + BigDecimal totalBonusRate = cent.multiply((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); + totalBonusRate = totalBonusRate.divide(itm.getFirstPurchaseAll().add(itm.getRepurchaseAllAmount()), 4, RoundingMode.HALF_UP); + itm.setTotalBonusRate(totalBonusRate); + } + // 首购拨出金额 + itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); + itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); + if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { + itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); + } + itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); }); } return getDataTable(slList); } - /** * @description: 查询单个人奖金拨比列表 - * @author: zhang jing - * @date: 2024/1/13 15:37 - * @param: [csps] - * @return: com.hzs.common.core.web.page.TableDataInfo **/ @GetMapping("/singlePersonList") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_SINGLE_PERSON_LIST, method = EOperationMethod.SELECT) @@ -341,14 +189,12 @@ public class CuBonusStatisController extends BaseController { if (StringUtils.isNull(cmex)) { return AjaxResult.success(); } - R currency = currencyServiceApi.getCurrency(cmex.getPkSettleCountry()); + R currency = iCurrencyServiceApi.getCurrency(cmex.getPkSettleCountry()); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); - R chCurrency = currencyServiceApi.getCurrency(CountryConstants.CHINA_COUNTRY); - BigDecimal chRate = chCurrency.getData().getInExchangeRate() == null ? BigDecimal.ONE : chCurrency.getData().getInExchangeRate(); - csps.setRate(exchangeRate); + BigDecimal cent = new BigDecimal("100"); + csps.setRate(exchangeRate); csps.setPkMember(cmex.getPkId()); - BigDecimal cent = new BigDecimal(100); csps.setPkCountry(cmex.getPkSettleCountry()); //查询订单业绩,查询分红配置每月10号分红 @@ -356,17 +202,13 @@ public class CuBonusStatisController extends BaseController { CuBonusStatisVO cuBonusStatisVO = new CuBonusStatisVO(); cuBonusStatisVO.setPkCountry(cmex.getPkSettleCountry()); //查询奖金扣项配置参数 0.8 - if (cmex.getPkSettleCountry().equals(CountryConstants.CHINA_COUNTRY)) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } - //查询分红比例配置 + List bdr = iCuBonusStatisService.bonusDividendRatiolist(cuBonusStatisVO); if (CollectionUtil.isNotEmpty(bdr)) { BigDecimal ratio = new BigDecimal("0.01"); @@ -380,68 +222,30 @@ public class CuBonusStatisController extends BaseController { } startPage(); cspsSum = iCuBonusStatisService.bonusSingleSum(csps); - BigDecimal mainBonusRate; - BigDecimal repurBonusRate; - BigDecimal totalBonus; - BigDecimal totalBonusRate; - //国外转为人民币 - if (cspsSum != null && !cmex.getPkSettleCountry().equals(CountryConstants.CHINA_COUNTRY)) { - //订单金额 + + if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setFirstPurchaseAll(cspsSum.getFirstPurchaseAll().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); + BigDecimal mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); + cspsSum.setMainBonusRate(mainBonusRate); + } else { + cspsSum.setMainBonusRate(new BigDecimal(0)); } if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setRepurchaseAllAmount(cspsSum.getRepurchaseAllAmount().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); + BigDecimal repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); + cspsSum.setRepurBonusRate(repurBonusRate); + } else { + cspsSum.setRepurBonusRate(new BigDecimal(0)); } - if (cspsSum.getMainBonus().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setMainBonus(cspsSum.getMainBonus().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); - } - if (cspsSum.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setRepurBonus(cspsSum.getRepurBonus().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); - } - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setMainBonusRate(mainBonusRate); - } else { - cspsSum.setMainBonusRate(new BigDecimal(0)); - } - if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setRepurBonusRate(repurBonusRate); - } else { - cspsSum.setRepurBonusRate(new BigDecimal(0)); - } - totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); - cspsSum.setTotalBonus(totalBonus); - totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); - cspsSum.setTotalBonusRate(totalBonusRate); - cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); - } - } else { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setMainBonusRate(mainBonusRate); - } else { - cspsSum.setMainBonusRate(new BigDecimal(0)); - } - if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setRepurBonusRate(repurBonusRate); - } else { - cspsSum.setRepurBonusRate(new BigDecimal(0)); - } - if (cspsSum.getShareBonus() == null) { - cspsSum.setShareBonus(new BigDecimal(0)); - } - totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); - cspsSum.setTotalBonus(totalBonus); - totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); - cspsSum.setTotalBonusRate(totalBonusRate); - cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); + if (cspsSum.getShareBonus() == null) { + cspsSum.setShareBonus(new BigDecimal(0)); } + BigDecimal totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); + cspsSum.setTotalBonus(totalBonus); + BigDecimal totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); + cspsSum.setTotalBonusRate(totalBonusRate); + cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); } + return AjaxResult.success(cspsSum); } @@ -460,32 +264,27 @@ public class CuBonusStatisController extends BaseController { ExcelUtil util = new ExcelUtil<>(CuBonusSinglePersonStatisVO.class); util.exportExcel(response, cspsList, "个人拨比列表"); } - R currency = currencyServiceApi.getCurrency(cmex.getPkSettleCountry()); + R currency = iCurrencyServiceApi.getCurrency(cmex.getPkSettleCountry()); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); - R chCurrency = currencyServiceApi.getCurrency(CountryConstants.CHINA_COUNTRY); - BigDecimal chRate = chCurrency.getData().getInExchangeRate() == null ? BigDecimal.ONE : chCurrency.getData().getInExchangeRate(); - csps.setRate(exchangeRate); - csps.setPkMember(cmex.getPkId()); BigDecimal cent = new BigDecimal(100); + csps.setRate(exchangeRate); + csps.setPkMember(cmex.getPkId()); csps.setPkCountry(cmex.getPkSettleCountry()); //查询订单业绩,查询分红配置每月10号分红 BigDecimal dividendRatio = BigDecimal.ZERO; CuBonusStatisVO cuBonusStatisVO = new CuBonusStatisVO(); cuBonusStatisVO.setPkCountry(cmex.getPkSettleCountry()); + //查询奖金扣项配置参数 0.8 - if (cmex.getPkSettleCountry().equals(CountryConstants.CHINA_COUNTRY)) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } - //查询分红比例配置 + List bdr = iCuBonusStatisService.bonusDividendRatiolist(cuBonusStatisVO); if (CollectionUtil.isNotEmpty(bdr)) { BigDecimal ratio = new BigDecimal("0.01"); @@ -497,106 +296,59 @@ public class CuBonusStatisController extends BaseController { } else { csps.setDividendRatio(BigDecimal.ZERO); } + startPage(); cspsSum = iCuBonusStatisService.bonusSingleSum(csps); + BigDecimal mainBonusRate; BigDecimal repurBonusRate; BigDecimal totalBonus; BigDecimal totalBonusRate; - //国外转为人民币 - if (cspsSum != null && !cmex.getPkSettleCountry().equals(CountryConstants.CHINA_COUNTRY)) { - //订单金额 + if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setFirstPurchaseAll(cspsSum.getFirstPurchaseAll().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); + mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); + cspsSum.setMainBonusRate(mainBonusRate); + } else { + cspsSum.setMainBonusRate(new BigDecimal(0)); } if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setRepurchaseAllAmount(cspsSum.getRepurchaseAllAmount().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); + repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); + cspsSum.setRepurBonusRate(repurBonusRate); + } else { + cspsSum.setRepurBonusRate(new BigDecimal(0)); } - if (cspsSum.getMainBonus().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setMainBonus(cspsSum.getMainBonus().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); - } - if (cspsSum.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { - cspsSum.setRepurBonus(cspsSum.getRepurBonus().divide(exchangeRate, 2, RoundingMode.HALF_UP).multiply(chRate)); - } - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setMainBonusRate(mainBonusRate); - } else { - cspsSum.setMainBonusRate(new BigDecimal(0)); - } - if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setRepurBonusRate(repurBonusRate); - } else { - cspsSum.setRepurBonusRate(new BigDecimal(0)); - } - totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); - cspsSum.setTotalBonus(totalBonus); - totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); - cspsSum.setTotalBonusRate(totalBonusRate); - cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); - } - } else { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - if (cspsSum.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - mainBonusRate = ((cspsSum.getMainBonus().add(cspsSum.getShareBonus())).divide(cspsSum.getFirstPurchaseAll(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setMainBonusRate(mainBonusRate); - } else { - cspsSum.setMainBonusRate(new BigDecimal(0)); - } - if (cspsSum.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - repurBonusRate = (cspsSum.getRepurBonus().divide(cspsSum.getRepurchaseAllAmount(), 2, RoundingMode.HALF_UP)).multiply(cent); - cspsSum.setRepurBonusRate(repurBonusRate); - } else { - cspsSum.setRepurBonusRate(new BigDecimal(0)); - } - if (cspsSum.getShareBonus() == null) { - cspsSum.setShareBonus(new BigDecimal(0)); - } - totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); - cspsSum.setTotalBonus(totalBonus); - totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); - cspsSum.setTotalBonusRate(totalBonusRate); - cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); + if (cspsSum.getShareBonus() == null) { + cspsSum.setShareBonus(new BigDecimal(0)); } + totalBonus = cspsSum.getMainBonus().add(cspsSum.getRepurBonus()).add(cspsSum.getShareBonus()); + cspsSum.setTotalBonus(totalBonus); + totalBonusRate = totalBonus.divide((cspsSum.getFirstPurchaseAll().add(cspsSum.getRepurchaseAllAmount())), 2, RoundingMode.HALF_UP).multiply(cent); + cspsSum.setTotalBonusRate(totalBonusRate); + cspsSum.setMainBonus(cspsSum.getMainBonus().add(cspsSum.getShareBonus())); } + List cspsList = Collections.singletonList(cspsSum); ExcelUtil util = new ExcelUtil<>(CuBonusSinglePersonStatisVO.class); util.exportExcel(response, cspsList, "个人拨比列表"); } - //查询当前日期是否是10号,每月10号发上个月分红 - public boolean determineDate() { - LocalDate currentDate = LocalDate.now(); - if (currentDate.getDayOfMonth() == 9) { - return true; - } else { - return false; - } - } - /** * @description: 奖金拨比列表合计 - * @author: zhang jing - * @date: 2023/9/15 14:04 - * @param: [cuBonusStatisVO] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @AccessPermissions("performanceList") @GetMapping("/subtotal") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.SELECT) public AjaxResult subtotal(CuBonusStatisVO cuBonusStatisVO) { int pkCountry = SecurityUtils.getPkCountry(); - CuBonusStatisVO subtotal; - R currency = currencyServiceApi.getCurrency(pkCountry); + + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); - R chCurrency = currencyServiceApi.getCurrency(CountryConstants.CHINA_COUNTRY); - BigDecimal chRate = chCurrency.getData().getInExchangeRate() == null ? BigDecimal.ONE : chCurrency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); cuBonusStatisVO.setRate(exchangeRate); - BigDecimal cent = new BigDecimal(100); cuBonusStatisVO.setPerCent(exchangeRate.multiply(cent)); cuBonusStatisVO.setPkCountry(pkCountry); + Date date = DateUtils.currentDate(); //默认查询当前日期的前一天 if (StringUtils.isEmpty(cuBonusStatisVO.getStartDate()) || @@ -616,29 +368,14 @@ public class CuBonusStatisController extends BaseController { final List pkTeamCodeList = pkTeamCodeStr.stream().map(Integer::valueOf).collect(Collectors.toList()); cuBonusStatisVO.setPkTeamCodeList(pkTeamCodeList); } - //查询订单业绩,查询分红配置每月10号分红 //查询奖金扣项配置参数 0.8 - if (pkCountry == CountryConstants.CHINA_COUNTRY) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } - //查询能量舱订单金额 - List energyChamberAmount = iCuBonusStatisService.queryEnergyChamberOrderList(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(energyChamberAmount)) { - energyChamberAmount.forEach(itm -> { - cuBonusStatisVO.setEnergySum(cuBonusStatisVO.getEnergySum().add(itm.getEnergySum())); - cuBonusStatisVO.setEnergySub(cuBonusStatisVO.getEnergySub().add(itm.getOrderAmount())); - }); - cuBonusStatisVO.setEnergyAmountAll(cuBonusStatisVO.getEnergySub().subtract(cuBonusStatisVO.getEnergySum())); - } - //查询体系订单分红业绩 List orderTypeList = new ArrayList<>(); orderTypeList.add(EOrderType.REGISTER_ORDER.getValue()); orderTypeList.add(EOrderType.UPGRADE_ORDER.getValue()); @@ -646,12 +383,9 @@ public class CuBonusStatisController extends BaseController { orderTypeList.add(EOrderType.SPECIAL_UPGRADE_ORDER.getValue()); cuBonusStatisVO.setOrderTypeList(orderTypeList); cuBonusStatisVO.setDividendRatio(BigDecimal.ZERO); + startPage(); - if (pkCountry == CountryConstants.CHINA_COUNTRY) { - subtotal = iCuBonusStatisService.queryCuBonusSumStatis(cuBonusStatisVO); - } else { - subtotal = iCuBonusStatisService.queryForeignCountryCuBonusStatisSum(cuBonusStatisVO); - } + CuBonusStatisVO subtotal = iCuBonusStatisService.queryCuBonusSumStatis(cuBonusStatisVO); if (subtotal != null && pkCountry == CountryConstants.CHINA_COUNTRY) { if (subtotal.getIntroduceBonusSum().compareTo(BigDecimal.ZERO) > 0) { subtotal.setIntroduceBonusSum(subtotal.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); @@ -674,7 +408,6 @@ public class CuBonusStatisController extends BaseController { if (subtotal.getServiceBonusSum().compareTo(BigDecimal.ZERO) > 0) { subtotal.setServiceBonusSum(subtotal.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); } - if (subtotal.getRepurRangeBonusSum().compareTo(BigDecimal.ZERO) > 0) { subtotal.setRepurRangeBonusSum(subtotal.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); } @@ -688,91 +421,27 @@ public class CuBonusStatisController extends BaseController { subtotal.setRepurBonusSum(subtotal.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); subtotal.setTotalBonusSum(subtotal.getTotalBonusSum().multiply(currency.getData().getInExchangeRate())); } - //国外转为人民币 - if (subtotal != null && pkCountry != CountryConstants.CHINA_COUNTRY) { - //订单金额 - if (subtotal.getMainRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainRegAmountSum(subtotal.getMainRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getMainUpAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainUpAmountSum(subtotal.getMainUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentRegAmountSum(subtotal.getAgentRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentUpAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentUpAmountSum(subtotal.getAgentUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getFirstPurchaseAllSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setFirstPurchaseAllSum(subtotal.getFirstPurchaseAllSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentFirstAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentFirstAmountSum(subtotal.getAgentFirstAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentRepurAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentRepurAmountSum(subtotal.getAgentRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getMainRepurAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainRepurAmountSum(subtotal.getMainRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getHifansRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setHifansRegAmountSum(subtotal.getHifansRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getRepurchaseAllAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurchaseAllAmountSum(subtotal.getRepurchaseAllAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - //奖金 - if (subtotal.getIntroduceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setIntroduceBonusSum(subtotal.getIntroduceBonusSum().multiply(chRate)); - } - if (subtotal.getOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setOrgBonusSum(subtotal.getOrgBonusSum().multiply(chRate)); - } - if (subtotal.getLeaderBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setLeaderBonusSum(subtotal.getLeaderBonusSum().multiply(chRate)); - } - if (subtotal.getShareBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setShareBonusSum(subtotal.getShareBonusSum().multiply(chRate)); - } - if (subtotal.getServiceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setServiceBonusSum(subtotal.getServiceBonusSum().multiply(chRate)); - } - if (subtotal.getRepurRangeBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurRangeBonusSum(subtotal.getRepurRangeBonusSum().multiply(chRate)); - } - if (subtotal.getRepurOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurOrgBonusSum(subtotal.getRepurOrgBonusSum().multiply(chRate)); - } - if (subtotal.getMainBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainBonusSum(subtotal.getMainBonusSum().multiply(chRate)); - } - if (subtotal.getRepurBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurBonusSum(subtotal.getRepurBonusSum().multiply(chRate)); - } - if (subtotal.getTotalBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setTotalBonusSum(subtotal.getTotalBonusSum().multiply(chRate)); - } - } return AjaxResult.success(subtotal); } /** * @description: 奖金拨比图表统计 - * @author: zhang jing - * @date: 2023/6/2 17:27 - * @param: [cuBonusStatisVO] - * @return: com.hzs.common.core.web.page.TableDataInfo **/ @AccessPermissions("performanceChart") @GetMapping("/chart") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.SELECT) public TableDataInfo chart(CuBonusStatisChartVO chartVO) { Integer pkCountry = SecurityUtils.getPkCountry(); + chartVO.setPkCountry(pkCountry); - R currency = currencyServiceApi.getCurrency(pkCountry); + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); chartVO.setRate(exchangeRate); + chartVO.setPerCent(exchangeRate.multiply(cent)); + //默认查询当前日期的前一天 Date date = DateUtils.currentDate(); if (StringUtils.isEmpty(chartVO.getStartDate()) || @@ -780,8 +449,6 @@ public class CuBonusStatisController extends BaseController { chartVO.setStartDate(DateUtils.beforeDateStr(1, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, date)); chartVO.setEndDate(DateUtils.beforeDateStr(1, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, date)); } - BigDecimal cent = new BigDecimal(100); - chartVO.setPerCent(exchangeRate.multiply(cent)); if (StringUtils.isNotEmpty(chartVO.getPkBdVertexStr())) { String[] split = chartVO.getPkBdVertexStr().split(","); List pkBdVertexStr = Arrays.asList(split); @@ -794,22 +461,20 @@ public class CuBonusStatisController extends BaseController { final List pkTeamCodeList = pkTeamCodeStr.stream().map(Integer::valueOf).collect(Collectors.toList()); chartVO.setPkTeamCodeList(pkTeamCodeList); } + //查询奖金扣项配置参数 CuBonusStatisVO cuBonusStatisVO = new CuBonusStatisVO(); cuBonusStatisVO.setPkCountry(pkCountry); BigDecimal orderAchieve; BigDecimal dividendRatio = BigDecimal.ZERO; //查询奖金扣项配置参数 0.8 - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } + CuBonusStatisVO cuBonusStatisAchieve = new CuBonusStatisVO(); cuBonusStatisAchieve.setStartDate(chartVO.getStartDate()); cuBonusStatisAchieve.setEndDate(chartVO.getEndDate()); @@ -828,7 +493,6 @@ public class CuBonusStatisController extends BaseController { //查询分红比例配置 List bdr = iCuBonusStatisService.bonusDividendRatiolist(cuBonusStatisVO); if (CollectionUtil.isNotEmpty(bdr)) { - BigDecimal ratio = new BigDecimal("0.01"); for (CuBonusStatisVO cs : bdr) { dividendRatio = dividendRatio.add(cs.getDividendRatio()); @@ -844,79 +508,36 @@ public class CuBonusStatisController extends BaseController { List slList = iCuBonusStatisService.queryCuBonusStatisChart(chartVO); if (CollectionUtil.isNotEmpty(slList)) { slList.forEach(itm -> { - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getShareBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setShareBonus(itm.getShareBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { - itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); - itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); - itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); + if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); } - if (!pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (itm.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRegAmount(itm.getMainRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainUpAmount(itm.getMainUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRegAmount(itm.getAgentRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentUpAmount(itm.getAgentUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentFirstAmount(itm.getAgentFirstAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRepurAmount(itm.getAgentRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRepurAmount(itm.getMainRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setHifansRegAmount(itm.getHifansRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - - if (itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurchaseAllAmount(itm.getRepurchaseAllAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } + if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); } + if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getShareBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setShareBonus(itm.getShareBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { + itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); + } + itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); + itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); + itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); }); } return getDataTable(slList); @@ -924,21 +545,21 @@ public class CuBonusStatisController extends BaseController { /** * @description: 奖金拨比图表合计 - * @author: zhang jing - * @date: 2023/9/18 14:42 - * @param: [chartVO] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @AccessPermissions("performanceChart") @GetMapping("/chartSum") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.SELECT) public AjaxResult chartSum(CuBonusStatisChartVO chartVO) { Integer pkCountry = SecurityUtils.getPkCountry(); + chartVO.setPkCountry(pkCountry); - R currency = currencyServiceApi.getCurrency(pkCountry); + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); chartVO.setRate(exchangeRate); - BigDecimal cent = new BigDecimal(100); + chartVO.setPerCent(exchangeRate.multiply(cent)); + //默认查询当前日期的前一天 Date date = DateUtils.currentDate(); if (StringUtils.isEmpty(chartVO.getStartDate()) || @@ -946,7 +567,6 @@ public class CuBonusStatisController extends BaseController { chartVO.setStartDate(DateUtils.beforeDateStr(1, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, date)); chartVO.setEndDate(DateUtils.beforeDateStr(1, ChronoUnit.DAYS, DateUtils.YYYY_MM_DD, date)); } - chartVO.setPerCent(exchangeRate.multiply(cent)); if (StringUtils.isNotEmpty(chartVO.getPkBdVertexStr())) { String[] split = chartVO.getPkBdVertexStr().split(","); List pkBdVertexStr = Arrays.asList(split); @@ -959,6 +579,7 @@ public class CuBonusStatisController extends BaseController { final List pkTeamCodeList = pkTeamCodeStr.stream().map(Integer::valueOf).collect(Collectors.toList()); chartVO.setPkTeamCodeList(pkTeamCodeList); } + //查询奖金扣项配置参数 CuBonusStatisVO cuBonusStatisVO = new CuBonusStatisVO(); cuBonusStatisVO.setPkCountry(pkCountry); @@ -1006,7 +627,7 @@ public class CuBonusStatisController extends BaseController { chartVO.setOrderAchieve(orderAchieve.multiply(dividendRatio)); CuBonusStatisChartVO sumChart = iCuBonusStatisService.queryCuBonusSumStatisChart(chartVO); - if (sumChart != null && pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { + if (sumChart != null) { sumChart.setIntroduceBonusSum(sumChart.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); sumChart.setOrgBonusSum(sumChart.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); sumChart.setLeaderBonusSum(sumChart.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); @@ -1019,62 +640,25 @@ public class CuBonusStatisController extends BaseController { sumChart.setRepurBonusSum(sumChart.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); sumChart.setTotalBonusSum(sumChart.getTotalBonusSum().multiply(currency.getData().getInExchangeRate())); } - if (sumChart != null && !pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (sumChart.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainRegAmount(sumChart.getMainRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainUpAmount(sumChart.getMainUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentRegAmount(sumChart.getAgentRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentUpAmount(sumChart.getAgentUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setFirstPurchaseAll(sumChart.getFirstPurchaseAll().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentFirstAmount(sumChart.getAgentFirstAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentRepurAmount(sumChart.getAgentRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainRepurAmount(sumChart.getMainRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setHifansRegAmount(sumChart.getHifansRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setRepurchaseAllAmount(sumChart.getRepurchaseAllAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - } return AjaxResult.success(sumChart); } /** * @description: 导出奖金拨比列表 - * @author: zhang jing - * @date: 2023/8/16 20:07 - * @param: [response, cuBonusStatisVO] - * @return: void **/ @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, CuBonusStatisVO cuBonusStatisVO) { Integer pkCountry = SecurityUtils.getPkCountry(); - List slList; - CuBonusStatisVO subtotal; - R currency = currencyServiceApi.getCurrency(pkCountry); + + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); - R chCurrency = currencyServiceApi.getCurrency(CountryConstants.CHINA_COUNTRY); - BigDecimal chRate = chCurrency.getData().getInExchangeRate() == null ? BigDecimal.ONE : chCurrency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); cuBonusStatisVO.setRate(exchangeRate); - BigDecimal cent = new BigDecimal(100); cuBonusStatisVO.setPerCent(exchangeRate.multiply(cent)); cuBonusStatisVO.setPkCountry(pkCountry); + //默认查询当前日期的前一天 Date date = DateUtils.currentDate(); if (StringUtils.isEmpty(cuBonusStatisVO.getStartDate()) || @@ -1095,16 +679,13 @@ public class CuBonusStatisController extends BaseController { cuBonusStatisVO.setPkTeamCodeList(pkTeamCodeList); } //查询奖金扣项配置参数 0.8 - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } + List orderTypeList = new ArrayList<>(); orderTypeList.add(EOrderType.REGISTER_ORDER.getValue()); orderTypeList.add(EOrderType.UPGRADE_ORDER.getValue()); @@ -1113,355 +694,123 @@ public class CuBonusStatisController extends BaseController { cuBonusStatisVO.setOrderTypeList(orderTypeList); cuBonusStatisVO.setDividendRatio(BigDecimal.ZERO); - //查询能量舱订单金额 - List energyChamberAmount = iCuBonusStatisService.queryEnergyChamberOrderList(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(energyChamberAmount)) { - energyChamberAmount.forEach(itm -> { - cuBonusStatisVO.setEnergySum(cuBonusStatisVO.getEnergySum().add(itm.getEnergySum())); - cuBonusStatisVO.setEnergySub(cuBonusStatisVO.getEnergySub().add(itm.getOrderAmount())); - }); - cuBonusStatisVO.setEnergyAmountAll(cuBonusStatisVO.getEnergySub().subtract(cuBonusStatisVO.getEnergySum())); - } startPage(); - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - slList = iCuBonusStatisService.queryCuBonusStatis(cuBonusStatisVO); - //合计 - subtotal = iCuBonusStatisService.queryCuBonusSumStatis(cuBonusStatisVO); - subtotal.setEnergyAmountAll(cuBonusStatisVO.getEnergyAmountAll()); - } else { - slList = iCuBonusStatisService.queryForeignCountryCuBonusStatis(cuBonusStatisVO); - //合计 - subtotal = iCuBonusStatisService.queryForeignCountryCuBonusStatisSum(cuBonusStatisVO); - } + List slList = iCuBonusStatisService.queryCuBonusStatis(cuBonusStatisVO); + //合计 + CuBonusStatisVO subtotal = iCuBonusStatisService.queryCuBonusSumStatis(cuBonusStatisVO); + subtotal.setEnergyAmountAll(cuBonusStatisVO.getEnergyAmountAll()); + if (CollectionUtil.isNotEmpty(slList)) { slList.forEach(itm -> { - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getMakerDirect().compareTo(BigDecimal.ZERO) > 0) { - itm.setMakerDirect(itm.getMakerDirect().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getMakerShare().compareTo(BigDecimal.ZERO) > 0) { - itm.setMakerShare(itm.getMakerShare().multiply(currency.getData().getInExchangeRate())); - } - String creationTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, itm.getCreationTime()); - //首购金额减掉能量舱订单金额 - if (CollectionUtil.isNotEmpty(energyChamberAmount)) { - energyChamberAmount.forEach(itmm -> { - String payTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, itmm.getPayTime()); - if (itm.getPkVertex().equals(itmm.getPkVertex()) && - payTime.equals(creationTime) - ) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().subtract(itmm.getOrderAmount()).add(itmm.getEnergySum())); - itm.setEnergyAmountAll(itmm.getOrderAmount().subtract(itmm.getEnergySum())); - } - }); - } - //重新算首购拨比 - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - BigDecimal mainBonusRate = cent.multiply((itm.getMainBonus()).multiply(currency.getData().getInExchangeRate())); - mainBonusRate = mainBonusRate.divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP); - itm.setMainBonusRate(mainBonusRate); - } - //重新算总拨比 - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || - itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - BigDecimal totalBonusRate = cent.multiply((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); - totalBonusRate = totalBonusRate.divide(itm.getFirstPurchaseAll().add(itm.getRepurchaseAllAmount()), 4, RoundingMode.HALF_UP); - itm.setTotalBonusRate(totalBonusRate); - } - //首购拨出金额 - itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); - itm.setTotalBonus((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); - - - if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { - itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - } - if (itm.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurBonus(itm.getRepurBonus().multiply(chRate)); - } - + if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); } - //国外转为人民币 - if (!pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - //订单金额 - if (itm.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRegAmount(itm.getMainRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainUpAmount(itm.getMainUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRegAmount(itm.getAgentRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentUpAmount(itm.getAgentUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentFirstAmount(itm.getAgentFirstAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRepurAmount(itm.getAgentRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRepurAmount(itm.getMainRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setHifansRegAmount(itm.getHifansRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurchaseAllAmount(itm.getRepurchaseAllAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - //奖金 - if (itm.getIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(chRate)); - } - if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setOrgBonus(itm.getOrgBonus().multiply(chRate)); - } - if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setLeaderBonus(itm.getLeaderBonus().multiply(chRate)); - } - if (itm.getShareBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setShareBonus(itm.getShareBonus().multiply(chRate)); - } - if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setServiceBonus(itm.getServiceBonus().multiply(chRate)); - } - if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(chRate)); - } - if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(chRate)); - } - if (itm.getMainBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainBonus(itm.getMainBonus().multiply(chRate)); - } - if (itm.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurBonus(itm.getRepurBonus().multiply(chRate)); - } - if (itm.getTotalBonus().compareTo(BigDecimal.ZERO) > 0) { - itm.setTotalBonus(itm.getTotalBonus().multiply(chRate)); - } + if (itm.getOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getLeaderBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getMakerDirect().compareTo(BigDecimal.ZERO) > 0) { + itm.setMakerDirect(itm.getMakerDirect().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getMakerShare().compareTo(BigDecimal.ZERO) > 0) { + itm.setMakerShare(itm.getMakerShare().multiply(currency.getData().getInExchangeRate())); + } + //重新算首购拨比 + if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { + BigDecimal mainBonusRate = cent.multiply((itm.getMainBonus()).multiply(currency.getData().getInExchangeRate())); + mainBonusRate = mainBonusRate.divide(itm.getFirstPurchaseAll(), 4, RoundingMode.HALF_UP); + itm.setMainBonusRate(mainBonusRate); + } + //重新算总拨比 + if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0 || + itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { + BigDecimal totalBonusRate = cent.multiply((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); + totalBonusRate = totalBonusRate.divide(itm.getFirstPurchaseAll().add(itm.getRepurchaseAllAmount()), 4, RoundingMode.HALF_UP); + itm.setTotalBonusRate(totalBonusRate); + } + //首购拨出金额 + itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); + itm.setTotalBonus((itm.getTotalBonus()).multiply(currency.getData().getInExchangeRate())); + + if (itm.getServiceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getHiFunIncome().compareTo(BigDecimal.ZERO) > 0) { + itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurRangeBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurOrgBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getAgentIntroduceBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); + } + if (itm.getRepurBonus().compareTo(BigDecimal.ZERO) > 0) { + itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); } }); } //合计 - if (subtotal == null) { - subtotal = new CuBonusStatisVO(); - } subtotal.setVertexName("合计"); - if (subtotal != null && !pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (subtotal.getIntroduceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setIntroduceBonus(subtotal.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getMakerDirectSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMakerDirect(subtotal.getMakerDirectSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getMakerShareSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMakerShare(subtotal.getMakerShareSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setOrgBonus(subtotal.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getLeaderBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setLeaderBonus(subtotal.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getShareBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setShareBonus(subtotal.getShareBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getServiceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setServiceBonus(subtotal.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); - } - - if (subtotal.getRepurRangeBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurRangeBonus(subtotal.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getRepurOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurOrgBonus(subtotal.getRepurOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getAgentIntroduceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentIntroduceBonus(subtotal.getAgentIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - } - subtotal.setMainBonusSum(subtotal.getMainBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setRepurBonus(subtotal.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setTotalBonus((subtotal.getTotalBonusSum().add(subtotal.getShareBonusSum())).multiply(currency.getData().getInExchangeRate())); - } - //国外转为人民币 - if (subtotal != null && !pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - //订单金额 - if (subtotal.getMainRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainRegAmountSum(subtotal.getMainRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getMainUpAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainUpAmountSum(subtotal.getMainUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentRegAmountSum(subtotal.getAgentRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentUpAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentUpAmountSum(subtotal.getAgentUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getFirstPurchaseAllSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setFirstPurchaseAllSum(subtotal.getFirstPurchaseAllSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentFirstAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentFirstAmountSum(subtotal.getAgentFirstAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getAgentRepurAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setAgentRepurAmountSum(subtotal.getAgentRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getMainRepurAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainRepurAmountSum(subtotal.getMainRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getHifansRegAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setHifansRegAmountSum(subtotal.getHifansRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - if (subtotal.getRepurchaseAllAmountSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurchaseAllAmountSum(subtotal.getRepurchaseAllAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP).multiply(chRate)); - } - //奖金 - if (subtotal.getIntroduceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setIntroduceBonusSum(subtotal.getIntroduceBonusSum().multiply(chRate)); - } - if (subtotal.getOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setOrgBonusSum(subtotal.getOrgBonusSum().multiply(chRate)); - } - if (subtotal.getLeaderBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setLeaderBonusSum(subtotal.getLeaderBonusSum().multiply(chRate)); - } - if (subtotal.getShareBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setShareBonusSum(subtotal.getShareBonusSum().multiply(chRate)); - } - if (subtotal.getServiceBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setServiceBonusSum(subtotal.getServiceBonusSum().multiply(chRate)); - } - if (subtotal.getRepurRangeBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurRangeBonusSum(subtotal.getRepurRangeBonusSum().multiply(chRate)); - } - if (subtotal.getRepurOrgBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurOrgBonusSum(subtotal.getRepurOrgBonusSum().multiply(chRate)); - } - if (subtotal.getMainBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMainBonusSum(subtotal.getMainBonusSum().multiply(chRate)); - } - if (subtotal.getRepurBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setRepurBonusSum(subtotal.getRepurBonusSum().multiply(chRate)); - } - if (subtotal.getTotalBonusSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setTotalBonusSum((subtotal.getTotalBonusSum().add(subtotal.getShareBonusSum())).multiply(chRate)); - } - } - subtotal.setIntroduceBonus(subtotal.getIntroduceBonusSum()); - subtotal.setMakerDirect(subtotal.getMakerDirectSum()); - subtotal.setMakerShare(subtotal.getMakerShareSum()); - subtotal.setOrgBonus(subtotal.getOrgBonusSum()); - subtotal.setLeaderBonus(subtotal.getLeaderBonusSum()); - subtotal.setShareBonus(subtotal.getShareBonusSum()); - subtotal.setServiceBonus(subtotal.getServiceBonusSum()); - subtotal.setRepurRangeBonus(subtotal.getRepurRangeBonusSum()); - subtotal.setRepurOrgBonus(subtotal.getRepurOrgBonusSum()); - subtotal.setAgentIntroduceBonus(subtotal.getAgentIntroduceBonusSum()); - subtotal.setMainBonus(subtotal.getMainBonusSum()); - subtotal.setMainBonusRate(subtotal.getMainBonusRateSum()); - subtotal.setRepurBonus(subtotal.getRepurBonusSum()); - subtotal.setRepurBonusRate(subtotal.getRepurBonusRateSum()); - subtotal.setTotalBonus(subtotal.getTotalBonusSum()); - subtotal.setMainRegAmount(subtotal.getMainRegAmountSum()); - subtotal.setMainUpAmount(subtotal.getMainUpAmountSum()); - subtotal.setAgentRegAmount(subtotal.getAgentRegAmountSum()); - subtotal.setAgentUpAmount(subtotal.getAgentUpAmountSum()); - subtotal.setFirstPurchaseAll(subtotal.getFirstPurchaseAllSum()); - subtotal.setAgentFirstAmount(subtotal.getAgentFirstAmountSum()); - subtotal.setAgentRepurAmount(subtotal.getAgentRepurAmountSum()); - subtotal.setMainRepurAmount(subtotal.getMainRepurAmountSum()); - subtotal.setHifansRegAmount(subtotal.getHifansRegAmountSum()); - subtotal.setRepurchaseAllAmount(subtotal.getRepurchaseAllAmountSum()); - subtotal.setTotalBonusRate(subtotal.getTotalBonusRateSum()); - subtotal.setMainBonusPvRate(subtotal.getMainBonusPvRateSum()); - subtotal.setRepurBonusPvRate(subtotal.getRepurBonusPvRateSum()); - } else { - if (subtotal.getMakerDirectSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMakerDirect(subtotal.getMakerDirectSum().multiply(currency.getData().getInExchangeRate())); - } - if (subtotal.getMakerShareSum().compareTo(BigDecimal.ZERO) > 0) { - subtotal.setMakerShare(subtotal.getMakerShareSum().multiply(currency.getData().getInExchangeRate())); - } - subtotal.setMainBonusRate(subtotal.getMainBonusRateSum()); - subtotal.setRepurBonusRate(subtotal.getRepurBonusRateSum()); - subtotal.setIntroduceBonus(subtotal.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setOrgBonus(subtotal.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setLeaderBonus(subtotal.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setShareBonus(subtotal.getShareBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setServiceBonus(subtotal.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setRepurRangeBonus(subtotal.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setRepurOrgBonus(subtotal.getRepurOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setAgentIntroduceBonus(subtotal.getAgentIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setMainBonus(subtotal.getMainBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setRepurBonus(subtotal.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); - subtotal.setTotalBonus((subtotal.getTotalBonusSum()).multiply(currency.getData().getInExchangeRate())); - subtotal.setMainRegAmount(subtotal.getMainRegAmountSum()); - subtotal.setMainUpAmount(subtotal.getMainUpAmountSum()); - subtotal.setAgentRegAmount(subtotal.getAgentRegAmountSum()); - subtotal.setAgentUpAmount(subtotal.getAgentUpAmountSum()); - subtotal.setFirstPurchaseAll(subtotal.getFirstPurchaseAllSum()); - subtotal.setAgentFirstAmount(subtotal.getAgentFirstAmountSum()); - subtotal.setAgentRepurAmount(subtotal.getAgentRepurAmountSum()); - subtotal.setMainRepurAmount(subtotal.getMainRepurAmountSum()); - subtotal.setHifansRegAmount(subtotal.getHifansRegAmountSum()); - subtotal.setRepurchaseAllAmount(subtotal.getRepurchaseAllAmountSum()); - subtotal.setTotalBonusRate(subtotal.getTotalBonusRateSum()); - subtotal.setMainBonusPvRate(subtotal.getMainBonusPvRateSum()); - subtotal.setRepurBonusPvRate(subtotal.getRepurBonusPvRateSum()); + if (subtotal.getMakerDirectSum().compareTo(BigDecimal.ZERO) > 0) { + subtotal.setMakerDirect(subtotal.getMakerDirectSum().multiply(currency.getData().getInExchangeRate())); } + if (subtotal.getMakerShareSum().compareTo(BigDecimal.ZERO) > 0) { + subtotal.setMakerShare(subtotal.getMakerShareSum().multiply(currency.getData().getInExchangeRate())); + } + subtotal.setMainBonusRate(subtotal.getMainBonusRateSum()); + subtotal.setRepurBonusRate(subtotal.getRepurBonusRateSum()); + subtotal.setIntroduceBonus(subtotal.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setOrgBonus(subtotal.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setLeaderBonus(subtotal.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setShareBonus(subtotal.getShareBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setServiceBonus(subtotal.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setRepurRangeBonus(subtotal.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setRepurOrgBonus(subtotal.getRepurOrgBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setAgentIntroduceBonus(subtotal.getAgentIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setMainBonus(subtotal.getMainBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setRepurBonus(subtotal.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); + subtotal.setTotalBonus((subtotal.getTotalBonusSum()).multiply(currency.getData().getInExchangeRate())); + subtotal.setMainRegAmount(subtotal.getMainRegAmountSum()); + subtotal.setMainUpAmount(subtotal.getMainUpAmountSum()); + subtotal.setAgentRegAmount(subtotal.getAgentRegAmountSum()); + subtotal.setAgentUpAmount(subtotal.getAgentUpAmountSum()); + subtotal.setFirstPurchaseAll(subtotal.getFirstPurchaseAllSum()); + subtotal.setAgentFirstAmount(subtotal.getAgentFirstAmountSum()); + subtotal.setAgentRepurAmount(subtotal.getAgentRepurAmountSum()); + subtotal.setMainRepurAmount(subtotal.getMainRepurAmountSum()); + subtotal.setHifansRegAmount(subtotal.getHifansRegAmountSum()); + subtotal.setRepurchaseAllAmount(subtotal.getRepurchaseAllAmountSum()); + subtotal.setTotalBonusRate(subtotal.getTotalBonusRateSum()); + subtotal.setMainBonusPvRate(subtotal.getMainBonusPvRateSum()); + subtotal.setRepurBonusPvRate(subtotal.getRepurBonusPvRateSum()); + slList.add(subtotal); ExcelUtil util = new ExcelUtil<>(CuBonusStatisVO.class); util.exportExcel(response, slList, "拨比列表"); } - /** * @description: 导出奖金图表 - * @author: zhang jing - * @date: 2023/9/23 10:11 - * @param: [response, chartVO] - * @return: void **/ @PostMapping("/exportChart") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_LIST, method = EOperationMethod.EXPORT) public void exportChart(HttpServletResponse response, CuBonusStatisChartVO chartVO) { Integer pkCountry = SecurityUtils.getPkCountry(); - R currency = currencyServiceApi.getCurrency(pkCountry); + + R currency = iCurrencyServiceApi.getCurrency(pkCountry); BigDecimal exchangeRate = currency.getData().getInExchangeRate() == null ? BigDecimal.ONE : currency.getData().getInExchangeRate(); + + BigDecimal cent = new BigDecimal("100"); chartVO.setRate(exchangeRate); - BigDecimal cent = new BigDecimal(100); chartVO.setPerCent(exchangeRate.multiply(cent)); chartVO.setPkCountry(pkCountry); + if (StringUtils.isNotEmpty(chartVO.getPkBdVertexStr())) { String[] split = chartVO.getPkBdVertexStr().split(","); List pkBdVertexStr = Arrays.asList(split); @@ -1481,16 +830,13 @@ public class CuBonusStatisController extends BaseController { BigDecimal orderAchieve; BigDecimal dividendRatio = BigDecimal.ZERO; //查询奖金扣项配置参数 0.8 - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); - if (CollectionUtil.isNotEmpty(bonus)) { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); - } else { - cuBonusStatisVO.setBackRatio(BigDecimal.ONE); - } + List bonus = iCuBonusStatisService.bonusDeductlist(cuBonusStatisVO); + if (CollectionUtil.isNotEmpty(bonus)) { + cuBonusStatisVO.setBackRatio(BigDecimal.ONE.subtract(bonus.get(0).getBackRatio())); } else { cuBonusStatisVO.setBackRatio(BigDecimal.ONE); } + CuBonusStatisVO cuBonusStatisAchieve = new CuBonusStatisVO(); cuBonusStatisAchieve.setStartDate(cuBonusStatisVO.getStartDate()); cuBonusStatisAchieve.setEndDate(cuBonusStatisVO.getEndDate()); @@ -1509,7 +855,6 @@ public class CuBonusStatisController extends BaseController { //查询分红比例配置 List bdr = iCuBonusStatisService.bonusDividendRatiolist(cuBonusStatisVO); if (CollectionUtil.isNotEmpty(bdr)) { - BigDecimal ratio = new BigDecimal("0.01"); for (CuBonusStatisVO cs : bdr) { dividendRatio = dividendRatio.add(cs.getDividendRatio()); @@ -1526,131 +871,43 @@ public class CuBonusStatisController extends BaseController { sumChart = new CuBonusStatisChartVO(); } sumChart.setVertexName("合计"); - if (sumChart != null && !pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (sumChart.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainRegAmount(sumChart.getMainRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainUpAmount(sumChart.getMainUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentRegAmount(sumChart.getAgentRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentUpAmount(sumChart.getAgentUpAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setFirstPurchaseAll(sumChart.getFirstPurchaseAllSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentFirstAmount(sumChart.getAgentFirstAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setAgentRepurAmount(sumChart.getAgentRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setMainRepurAmount(sumChart.getMainRepurAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setHifansRegAmount(sumChart.getHifansRegAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (sumChart.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - sumChart.setRepurchaseAllAmount(sumChart.getRepurchaseAllAmountSum().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - sumChart.setIntroduceBonus(sumChart.getIntroduceBonusSum()); - sumChart.setOrgBonus(sumChart.getOrgBonusSum()); - sumChart.setLeaderBonus(sumChart.getLeaderBonusSum()); - sumChart.setShareBonus(sumChart.getShareBonusSum()); - sumChart.setServiceBonus(sumChart.getServiceBonusSum()); - sumChart.setRepurRangeBonus(sumChart.getRepurRangeBonusSum()); - sumChart.setRepurOrgBonus(sumChart.getRepurOrgBonusSum()); - sumChart.setAgentIntroduceBonus(sumChart.getAgentIntroduceBonusSum()); - sumChart.setMainBonus(sumChart.getMainBonusSum()); - sumChart.setRepurBonus(sumChart.getRepurBonusSum()); - sumChart.setTotalBonus(sumChart.getTotalBonusSum()); - sumChart.setTotalBonusRate(sumChart.getTotalBonusRateSum()); - sumChart.setMainRegAmount(sumChart.getMainRegAmountSum()); - sumChart.setMainUpAmount(sumChart.getMainUpAmountSum()); - sumChart.setAgentRegAmount(sumChart.getAgentRegAmountSum()); - sumChart.setAgentUpAmount(sumChart.getAgentUpAmountSum()); - sumChart.setFirstPurchaseAll(sumChart.getFirstPurchaseAllSum()); - sumChart.setAgentFirstAmount(sumChart.getAgentFirstAmountSum()); - sumChart.setAgentRepurAmount(sumChart.getAgentRepurAmountSum()); - sumChart.setMainRepurAmount(sumChart.getMainRepurAmountSum()); - sumChart.setHifansRegAmount(sumChart.getHifansRegAmountSum()); - sumChart.setRepurchaseAllAmount(sumChart.getRepurchaseAllAmountSum()); - } else { - sumChart.setIntroduceBonus(sumChart.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setOrgBonus(sumChart.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setLeaderBonus(sumChart.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setShareBonus(sumChart.getShareBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setServiceBonus(sumChart.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setRepurRangeBonus(sumChart.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setRepurOrgBonus(sumChart.getRepurOrgBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setAgentIntroduceBonus(sumChart.getAgentIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setMainBonus(sumChart.getMainBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setRepurBonus(sumChart.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setTotalBonus(sumChart.getTotalBonusSum().multiply(currency.getData().getInExchangeRate())); - sumChart.setTotalBonusRate(sumChart.getTotalBonusRateSum()); - sumChart.setMainRegAmount(sumChart.getMainRegAmountSum()); - sumChart.setMainUpAmount(sumChart.getMainUpAmountSum()); - sumChart.setAgentRegAmount(sumChart.getAgentRegAmountSum()); - sumChart.setAgentUpAmount(sumChart.getAgentUpAmountSum()); - sumChart.setFirstPurchaseAll(sumChart.getFirstPurchaseAllSum()); - sumChart.setAgentFirstAmount(sumChart.getAgentFirstAmountSum()); - sumChart.setAgentRepurAmount(sumChart.getAgentRepurAmountSum()); - sumChart.setMainRepurAmount(sumChart.getMainRepurAmountSum()); - sumChart.setHifansRegAmount(sumChart.getHifansRegAmountSum()); - sumChart.setRepurchaseAllAmount(sumChart.getRepurchaseAllAmountSum()); - } + sumChart.setIntroduceBonus(sumChart.getIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setOrgBonus(sumChart.getOrgBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setLeaderBonus(sumChart.getLeaderBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setShareBonus(sumChart.getShareBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setServiceBonus(sumChart.getServiceBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setRepurRangeBonus(sumChart.getRepurRangeBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setRepurOrgBonus(sumChart.getRepurOrgBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setAgentIntroduceBonus(sumChart.getAgentIntroduceBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setMainBonus(sumChart.getMainBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setRepurBonus(sumChart.getRepurBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setTotalBonus(sumChart.getTotalBonusSum().multiply(currency.getData().getInExchangeRate())); + sumChart.setTotalBonusRate(sumChart.getTotalBonusRateSum()); + sumChart.setMainRegAmount(sumChart.getMainRegAmountSum()); + sumChart.setMainUpAmount(sumChart.getMainUpAmountSum()); + sumChart.setAgentRegAmount(sumChart.getAgentRegAmountSum()); + sumChart.setAgentUpAmount(sumChart.getAgentUpAmountSum()); + sumChart.setFirstPurchaseAll(sumChart.getFirstPurchaseAllSum()); + sumChart.setAgentFirstAmount(sumChart.getAgentFirstAmountSum()); + sumChart.setAgentRepurAmount(sumChart.getAgentRepurAmountSum()); + sumChart.setMainRepurAmount(sumChart.getMainRepurAmountSum()); + sumChart.setHifansRegAmount(sumChart.getHifansRegAmountSum()); + sumChart.setRepurchaseAllAmount(sumChart.getRepurchaseAllAmountSum()); + if (CollectionUtil.isNotEmpty(slList)) { slList.forEach(itm -> { - if (pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); - itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); - itm.setShareBonus(itm.getShareBonus().multiply(currency.getData().getInExchangeRate())); - itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); - itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); - itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); - itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); - itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); - itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); - itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); - itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); - } - if (!pkCountry.equals(CountryConstants.CHINA_COUNTRY)) { - if (itm.getMainRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRegAmount(itm.getMainRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getMainUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainUpAmount(itm.getMainUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getAgentRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRegAmount(itm.getAgentRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getAgentUpAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentUpAmount(itm.getAgentUpAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getFirstPurchaseAll().compareTo(BigDecimal.ZERO) > 0) { - itm.setFirstPurchaseAll(itm.getFirstPurchaseAll().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getAgentFirstAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentFirstAmount(itm.getAgentFirstAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getAgentRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setAgentRepurAmount(itm.getAgentRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getMainRepurAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setMainRepurAmount(itm.getMainRepurAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getHifansRegAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setHifansRegAmount(itm.getHifansRegAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - if (itm.getRepurchaseAllAmount().compareTo(BigDecimal.ZERO) > 0) { - itm.setRepurchaseAllAmount(itm.getRepurchaseAllAmount().divide(currency.getData().getInExchangeRate(), 4, RoundingMode.HALF_UP)); - } - } + itm.setIntroduceBonus(itm.getIntroduceBonus().multiply(currency.getData().getInExchangeRate())); + itm.setOrgBonus(itm.getOrgBonus().multiply(currency.getData().getInExchangeRate())); + itm.setLeaderBonus(itm.getLeaderBonus().multiply(currency.getData().getInExchangeRate())); + itm.setShareBonus(itm.getShareBonus().multiply(currency.getData().getInExchangeRate())); + itm.setServiceBonus(itm.getServiceBonus().multiply(currency.getData().getInExchangeRate())); + itm.setHiFunIncome(itm.getHiFunIncome().multiply(currency.getData().getInExchangeRate())); + itm.setRepurRangeBonus(itm.getRepurRangeBonus().multiply(currency.getData().getInExchangeRate())); + itm.setRepurOrgBonus(itm.getRepurOrgBonus().multiply(currency.getData().getInExchangeRate())); + itm.setAgentIntroduceBonus(itm.getAgentIntroduceBonus().multiply(currency.getData().getInExchangeRate())); + itm.setMainBonus(itm.getMainBonus().multiply(currency.getData().getInExchangeRate())); + itm.setRepurBonus(itm.getRepurBonus().multiply(currency.getData().getInExchangeRate())); + itm.setTotalBonus(itm.getTotalBonus().multiply(currency.getData().getInExchangeRate())); }); slList.add(sumChart); } @@ -1658,13 +915,8 @@ public class CuBonusStatisController extends BaseController { util.exportExcel(response, slList, "拨比图表表"); } - /** * @description: 奖金拨比柱形图 - * @author: zhang jing - * @date: 2023/6/3 15:12 - * @param: [cuBonusStatisVO] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @AccessPermissions("performanceRatio") @GetMapping("/pillarRatio") @@ -1673,8 +925,8 @@ public class CuBonusStatisController extends BaseController { Integer pkCountry = SecurityUtils.getPkCountry(); columnarVO.setPkCountry(pkCountry); CuBonusStatisColumnarVO cbs = new CuBonusStatisColumnarVO(); - if (StringUtils.isNotEmpty(columnarVO.getStartDate()) && - StringUtils.isNotEmpty(columnarVO.getEndDate())) { + if (StringUtils.isNotEmpty(columnarVO.getStartDate()) + && StringUtils.isNotEmpty(columnarVO.getEndDate())) { cbs = iCuBonusStatisService.pillarRatio(columnarVO); } return AjaxResult.success(cbs); @@ -1682,10 +934,6 @@ public class CuBonusStatisController extends BaseController { /** * @description: 导出奖金拨比柱形图 - * @author: zhang jing - * @date: 2023/9/23 10:14 - * @param: [columnarVO] - * @return: void **/ @PostMapping("/export-pillarRatio") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_CHART, method = EOperationMethod.EXPORT) @@ -1693,8 +941,8 @@ public class CuBonusStatisController extends BaseController { Integer pkCountry = SecurityUtils.getPkCountry(); columnarVO.setPkCountry(pkCountry); CuBonusStatisColumnarVO cbs = new CuBonusStatisColumnarVO(); - if (StringUtils.isNotEmpty(columnarVO.getStartDate()) && - StringUtils.isNotEmpty(columnarVO.getEndDate())) { + if (StringUtils.isNotEmpty(columnarVO.getStartDate()) + && StringUtils.isNotEmpty(columnarVO.getEndDate())) { cbs = iCuBonusStatisService.pillarRatio(columnarVO); } List list = new ArrayList<>(); @@ -1705,10 +953,6 @@ public class CuBonusStatisController extends BaseController { /** * @description: 奖金拨比饼状图 - * @author: zhang jing - * @date: 2023/6/5 10:42 - * @param: [cuBonusStatisVO] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @AccessPermissions("performanceRatio") @GetMapping("/pieChartRatio") @@ -1744,10 +988,6 @@ public class CuBonusStatisController extends BaseController { /** * @description: 导出奖金拨比饼状图 - * @author: zhang jing - * @date: 2023/9/23 10:20 - * @param: [response, roundVO] - * @return: void **/ @PostMapping("/export-pieChartRatio") @Log(module = EOperationModule.BONUS_DIAL_RATIO, business = EOperationBusiness.BONUS_DIAL_RATIO_CHART, method = EOperationMethod.EXPORT) @@ -1785,10 +1025,6 @@ public class CuBonusStatisController extends BaseController { /** * @description: 统计历史奖金拨比数据, 手动统计某一天 - * @author: zhang jing - * @date: 2023/8/16 11:43 - * @param: [] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @GetMapping("/statis-history") public AjaxResult statisHistoryBonus(String startDate, String endDate) { @@ -1813,7 +1049,6 @@ public class CuBonusStatisController extends BaseController { endDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date)); startDateStr = (DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endDate)); } - System.out.println(startDateStr + "--" + endDateStr); //删除前6天的数据 Boolean delstatis = iCuBonusStatisService.delStatis(startDateStr, endDateStr); if (delstatis) { @@ -1828,10 +1063,6 @@ public class CuBonusStatisController extends BaseController { /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:04 - * @param: [] - * @return: com.hzs.common.core.web.domain.AjaxResult **/ @GetMapping("/delStatis") public AjaxResult delStatis(String startDate, String endDate) { diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusStatisMapper.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusStatisMapper.java index f9bbbb45..152b236b 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusStatisMapper.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusStatisMapper.java @@ -1,6 +1,5 @@ package com.hzs.member.statis.mapper; - import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hzs.common.domain.member.statis.CuBonusStatis; import com.hzs.member.statis.vo.*; @@ -9,9 +8,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - *

* 奖金拨比统计 Mapper 接口 - *

* * @author zhangjing * @since 2023-05-31 @@ -20,186 +17,76 @@ public interface CuBonusStatisMapper extends BaseMapper { /** * @description: 查询当天团队统计数据 - * @author: zhang jing - * @date: 2023/6/1 11:31 - * @param: [cuBonusStatis] - * @return: com.hzs.common.domain.member.statis.CuBonusStatis **/ List getCuBonusStatis(CuBonusStatis cuBonusStatis); /** * @description: 奖金拨比列表 - * @author: zhang jing - * @date: 2023/6/3 11:21 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List queryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO); - /** - * @description: 查询国外奖金拨比 - * @author: zhang jing - * @date: 2023/9/28 16:43 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryForeignCountryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询国外奖金拨比合计 - * @author: zhang jing - * @date: 2023/10/7 16:01 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - CuBonusStatisVO queryForeignCountryCuBonusStatisSum(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询体系合计的订单业绩 - * @author: zhang jing - * @date: 2024/7/2 9:48 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ CuBonusStatisVO queryOrderAchieveSum(CuBonusStatisVO cuBonusStatisVO); - /** - * @description: 查询能量舱订单金额 - * @author: zhang jing - * @date: 2024/7/1 10:52 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryEnergyChamberOrderList(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 奖金拨比列表统计小计(最后一行) - * @author: zhang jing - * @date: 2023/9/13 9:20 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisVO queryCuBonusSumStatis(CuBonusStatisVO cuBonusStatisVO); /** * @description: 查询个人奖金拨比 - * @author: zhang jing - * @date: 2024/1/13 15:44 - * @param: [csps] - * @return: java.util.List **/ CuBonusSinglePersonStatisVO bonusSingleSum(CuBonusSinglePersonStatisVO csps); - /** * @description: 奖金拨比图表 - * @author: zhang jing - * @date: 2023/9/5 13:42 - * @param: [chartVO] - * @return: java.util.List **/ List queryCuBonusStatisChart(CuBonusStatisChartVO chartVO); /** * @description: 奖金拨比图表合计 - * @author: zhang jing - * @date: 2023/9/18 14:39 - * @param: [chartVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisChartVO **/ CuBonusStatisChartVO queryCuBonusSumStatisChart(CuBonusStatisChartVO chartVO); - /** * @description: 查询一年注册、升级、复购、嗨粉合计 - * @author: zhang jing - * @date: 2023/6/5 9:45 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisColumnarVO queryYearData(CuBonusStatisColumnarVO columnarVO); /** * @description: 查询奖金拨比(饼状图) - * @author: zhang jing - * @date: 2023/6/5 15:49 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisRoundVO queryDiallingRatio(CuBonusStatisRoundVO roundVO); /** * @description: 查询小于当天全部已支付或撤单订单信息 - * @author: zhang jing - * @date: 2023/8/16 17:14 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List querySaOrderByLessDay(CuBonusStatisVO cuBonusStatisVO); /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:03 - * @param: [] - * @return: java.lang.Boolean **/ Boolean delStatis(@Param("startDate") String startDate, @Param("endDate") String endDate); /** * @description: 查询奖金扣项配置参数 - * @author: zhang jing - * @date: 2023/9/15 14:00 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List bonusDeductlist(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询分红比例配置 - * @author: zhang jing - * @date: 2023/9/28 17:04 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List bonusDividendRatiolist(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询国外奖金 - * @author: zhang jing - * @date: 2023/9/28 14:12 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryForeignCountryBonus(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:05 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List queryChinaCountryBonus(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询生效国外国家列表 - * @author: zhang jing - * @date: 2023/9/21 16:09 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List countrylist(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询有效体系 - * @author: zhang jing - * @date: 2023/9/22 9:37 - * @param: [] - * @return: java.util.List **/ List vertexList(); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusVertexStatisMapper.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusVertexStatisMapper.java index cea74afb..4b31df76 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusVertexStatisMapper.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/mapper/CuBonusVertexStatisMapper.java @@ -17,48 +17,28 @@ public interface CuBonusVertexStatisMapper extends BaseMapper **/ List queryCuBonusStatis(CuBonusVertexStatisVO cuBonusVertexStatisVO); /** * @description: 查询顶点奖金拨比汇总 - * @author: zhang jing - * @date: 2024/9/19 15:17 - * @param: [cuBonusVertexStatisTotalVO] - * @return: java.util.List **/ List queryCuBonusStatisTotal(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 顶点奖金拨比汇总查询总和 - * @author: zhang jing - * @date: 2024/9/23 13:23 - * @param: [cuBonusVertexStatisTotalVO] - * @return: com.hzs.member.statis.vo.CuBonusVertexStatisTotalVO **/ CuBonusVertexStatisTotalVO queryCuBonusStatisSum(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 查询时间内奖金拨比顶点会员 - * @author: zhang jing - * @date: 2024/9/20 14:11 - * @param: [cuBonusVertexStatisTotalVO] - * @return: java.util.List **/ List queryCuBonusVertex(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 查询能量舱订单金额 - * @author: zhang jing - * @date: 2024/7/1 10:52 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryEnergyChamberOrderList(CuBonusVertexStatisVO CuBonusVertexStatisVO); @@ -66,57 +46,33 @@ public interface CuBonusVertexStatisMapper extends BaseMapper **/ List querySaOrderByLessDay(CuBonusVertexStatisVO CuBonusVertexStatisVO); /** * @description: 7天重算查询订单 - * @author: zhang jing - * @date: 2024/8/15 11:02 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryAnewSaOrderByLessDay(CuBonusVertexStatisVO CuBonusVertexStatisVO); /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:03 - * @param: [] - * @return: java.lang.Boolean **/ Boolean delStatis(@Param("startDate") String startDate, @Param("endDate") String endDate, @@ -124,57 +80,31 @@ public interface CuBonusVertexStatisMapper extends BaseMapper **/ List bonusDeductlist(CuBonusVertexStatisVO CuBonusVertexStatisVO); - /** * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:05 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryChinaCountryBonus(CuBonusVertexStatisVO CuBonusVertexStatisVO); /** * @description: 查询7天重算奖金查询 - * @author: zhang jing - * @date: 2024/8/15 14:38 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryVertexChinaCountryBonus(CuBonusVertexStatisVO CuBonusVertexStatisVO); - /** * @description: 查询生效国外国家列表 - * @author: zhang jing - * @date: 2023/9/21 16:09 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List countrylist(CuBonusVertexStatisVO CuBonusVertexStatisVO); /** * @description: 查询有效顶点 - * @author: zhang jing - * @date: 2023/9/22 9:37 - * @param: [] - * @return: java.util.List **/ List vertexList(@Param("pkVertex") Integer pkVertex); /** * @description: 查询当天团队统计数据 - * @author: zhang jing - * @date: 2023/6/1 11:31 - * @param: [CuBonusVertexStatis] - * @return: com.hzs.common.domain.member.statis.CuBonusVertexStatis **/ List getCuBonusStatis(CuBonusVertexStatis CuBonusVertexStatis); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusStatisServiceProvider.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusStatisServiceProvider.java index 44631c31..7bb167be 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusStatisServiceProvider.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusStatisServiceProvider.java @@ -9,24 +9,16 @@ import org.springframework.beans.factory.annotation.Autowired; /** * @description: 奖金拨比统计Dubbo 服务 - * @author: zhang jing - * @date: 2023/6/1 17:25 - * @param: - * @return: **/ @Slf4j @DubboService public class ICuBonusStatisServiceProvider implements ICuBonusStatisServiceApi { @Autowired - ICuBonusStatisService iCuBonusStatisService; + private ICuBonusStatisService iCuBonusStatisService; /** * @description: 统计历史奖金拨比 - * @author: zhang jing - * @date: 2023/10/19 9:29 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ @Override public R statsHistoryBonus(String startDate, String endDate) { @@ -35,10 +27,6 @@ public class ICuBonusStatisServiceProvider implements ICuBonusStatisServiceApi { /** * @description: 删除奖金拨比统计数据 - * @author: zhang jing - * @date: 2023/12/11 10:56 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ @Override public R delStats(String startDate, String endDate) { diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusVertexStatisServiceProvider.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusVertexStatisServiceProvider.java index 23660966..466fbb51 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusVertexStatisServiceProvider.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/provider/ICuBonusVertexStatisServiceProvider.java @@ -14,11 +14,7 @@ import java.util.List; import java.util.stream.Collectors; /** - * @description: 顶点奖金拨比统计Dubbo 服务 - * @author: zhang jing - * @date: 2023/6/1 17:25 - * @param: - * @return: + * 顶点奖金拨比统计Dubbo 服务 **/ @Slf4j @DubboService @@ -31,23 +27,14 @@ public class ICuBonusVertexStatisServiceProvider implements ICuBonusVertexStatis /** * @description: 7天重算顶点奖金拨比统计 - * @author: zhang jing - * @date: 2024/8/15 9:58 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ @Override public R anewStatsHistoryBonus(String startDate, String endDate) { return R.ok(iCuBonusVertexStatisService.anewStatisHistoryBonus(startDate, endDate)); } - /** * @description: 删除奖金拨比统计数据 - * @author: zhang jing - * @date: 2023/12/11 10:56 - * @param: [startDate, endDate] - * @return: com.hzs.common.core.domain.R **/ @Override public R delStats(String startDate, String endDate) { diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusLenjoyStatisService.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusLenjoyStatisService.java index 1a03746c..f58ef18d 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusLenjoyStatisService.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusLenjoyStatisService.java @@ -1,18 +1,13 @@ package com.hzs.member.statis.service; - import com.baomidou.mybatisplus.extension.service.IService; import com.hzs.common.domain.member.statis.CuBonusVertexStatis; -import com.hzs.member.statis.vo.CuBonusSinglePersonStatisVO; -import com.hzs.member.statis.vo.CuBonusVertexStatisTotalVO; import com.hzs.member.statis.vo.CuBonusLenjoyStatisVO; import java.util.List; /** - *

* 奖金拨比零线统计 服务类 - *

* * @author hzs * @since 2024-08-12 @@ -21,55 +16,31 @@ public interface ICuBonusLenjoyStatisService extends IService **/ List queryCuBonusStatis(CuBonusLenjoyStatisVO CuBonusLenjoyStatisVO); /** * @description: 奖金拨比列表统计小计(最后一行) - * @author: zhang jing - * @date: 2023/9/13 9:21 - * @param: [CuBonusLenjoyStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusLenjoyStatisVO **/ CuBonusLenjoyStatisVO queryCuBonusSumStatis(CuBonusLenjoyStatisVO CuBonusLenjoyStatisVO); /** * @description: 7天重算顶点奖金拨比统计 - * @author: zhang jing - * @date: 2024/8/15 9:57 - * @param: [startDate, endDate] - * @return: java.lang.Boolean **/ - Boolean anewStatisHistoryBonus(String startDate,String endDate); + Boolean anewStatisHistoryBonus(String startDate, String endDate); /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:04 - * @param: [] - * @return: java.lang.Boolean **/ - Boolean delStatis(String startDate,String endDate,List pkVertexList); + Boolean delStatis(String startDate, String endDate, List pkVertexList); /** * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:06 - * @param: [CuBonusLenjoyStatisVO] - * @return: java.util.List **/ List queryChinaCountryBonus(CuBonusLenjoyStatisVO CuBonusLenjoyStatisVO); /** * @description: 查询所有体系 - * @author: zhang jing - * @date: 2023/9/22 9:36 - * @param: [] - * @return: java.util.List **/ List vertexList(Integer pkVertex); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusStatisService.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusStatisService.java index 453499c6..997d898b 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusStatisService.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusStatisService.java @@ -8,191 +8,76 @@ import java.util.List; /** * 奖金拨比统计 服务类 - * - * @author zhangjing - * @since 2023-05-31 */ public interface ICuBonusStatisService extends IService { - /** * @description: 奖金拨比列表 - * @author: zhang jing - * @date: 2023/6/3 11:21 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List queryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO); - /** - * @description: 查询国外奖金拨比 - * @author: zhang jing - * @date: 2023/9/28 16:41 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryForeignCountryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询国外奖金拨比合计 - * @author: zhang jing - * @date: 2023/10/7 16:06 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO - **/ - CuBonusStatisVO queryForeignCountryCuBonusStatisSum(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询体系合计的订单业绩 - * @author: zhang jing - * @date: 2024/7/2 9:40 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ CuBonusStatisVO queryOrderAchieveSum(CuBonusStatisVO cuBonusStatisVO); - /** - * @description: 查询能量舱订单金额 - * @author: zhang jing - * @date: 2024/7/1 10:53 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryEnergyChamberOrderList(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 奖金拨比列表统计小计(最后一行) - * @author: zhang jing - * @date: 2023/9/13 9:21 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisVO queryCuBonusSumStatis(CuBonusStatisVO cuBonusStatisVO); /** * @description: 查询个人奖金拨比 - * @author: zhang jing - * @date: 2024/1/13 15:43 - * @param: [csps] - * @return: java.util.List **/ CuBonusSinglePersonStatisVO bonusSingleSum(CuBonusSinglePersonStatisVO csps); /** * @description: 奖金拨比图表 - * @author: zhang jing - * @date: 2023/9/5 13:41 - * @param: [chartVO] - * @return: java.util.List **/ List queryCuBonusStatisChart(CuBonusStatisChartVO chartVO); /** * @description: 奖金拨比图表合计 - * @author: zhang jing - * @date: 2023/9/18 14:38 - * @param: [chartVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisChartVO **/ CuBonusStatisChartVO queryCuBonusSumStatisChart(CuBonusStatisChartVO chartVO); /** * @description: 查询奖金拨比图形数据-柱形图 - * @author: zhang jing - * @date: 2023/6/5 9:19 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisColumnarVO pillarRatio(CuBonusStatisColumnarVO columnarVO); /** * @description: 查询一年注册、升级、复购、嗨粉合计 - * @author: zhang jing - * @date: 2023/6/5 10:25 - * @param: [cuBonusStatisVO, queryDate] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisColumnarVO queryYearData(CuBonusStatisColumnarVO columnarVO); /** * @description: 查询奖金拨比(饼状图) - * @author: zhang jing - * @date: 2023/6/5 15:49 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ CuBonusStatisRoundVO queryDiallingRatio(CuBonusStatisRoundVO roundVO); /** * @description: 统计历史奖金拨比数据 - * @author: zhang jing - * @date: 2023/8/16 11:35 - * @param: [] - * @return: java.lang.Boolean **/ Boolean statisHistoryBonus(String startDate, String endDate); /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:04 - * @param: [] - * @return: java.lang.Boolean **/ Boolean delStatis(String startDate, String endDate); /** * @description: 查询奖金扣项配置参数 - * @author: zhang jing - * @date: 2023/9/15 14:02 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List bonusDeductlist(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询分红比例配置 - * @author: zhang jing - * @date: 2023/9/28 17:03 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ List bonusDividendRatiolist(CuBonusStatisVO cuBonusStatisVO); - /** - * @description: 查询国外奖金 - * @author: zhang jing - * @date: 2023/9/28 14:12 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryForeignCountryBonus(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:06 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List queryChinaCountryBonus(CuBonusStatisVO cuBonusStatisVO); - - /** - * @description: 查询生效国外国家列表 - * @author: zhang jing - * @date: 2023/9/21 16:10 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - List countrylist(CuBonusStatisVO cuBonusStatisVO); - /** * @description: 查询所有体系 - * @author: zhang jing - * @date: 2023/9/22 9:36 - * @param: [] - * @return: java.util.List **/ List vertexList(); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusVertexStatisService.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusVertexStatisService.java index bc58567a..78131b8e 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusVertexStatisService.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/ICuBonusVertexStatisService.java @@ -9,54 +9,31 @@ import java.util.List; /** * 奖金拨比零线统计 服务类 - * - * @author hzs - * @since 2024-08-12 */ public interface ICuBonusVertexStatisService extends IService { /** * @description: 奖金拨比列表 - * @author: zhang jing - * @date: 2023/6/3 11:21 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryCuBonusStatis(CuBonusVertexStatisVO cuBonusVertexStatisVO); /** * @description: 查询顶点奖金拨比汇总 - * @author: zhang jing - * @date: 2024/9/19 15:18 - * @param: [cuBonusVertexStatisTotalVO] - * @return: java.util.List **/ List queryCuBonusStatisTotal(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 查询顶点奖金拨比汇总总和(最后一行) - * @author: zhang jing - * @date: 2024/9/23 13:22 - * @param: [cuBonusVertexStatisTotalVO] - * @return: com.hzs.member.statis.vo.CuBonusVertexStatisTotalVO **/ CuBonusVertexStatisTotalVO queryCuBonusStatisSum(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 查询时间内奖金拨比顶点会员 - * @author: zhang jing - * @date: 2024/9/20 14:12 - * @param: [cuBonusVertexStatisTotalVO] - * @return: java.util.List **/ List queryCuBonusVertex(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO); /** * @description: 查询能量舱订单金额 - * @author: zhang jing - * @date: 2024/7/1 10:53 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryEnergyChamberOrderList(CuBonusVertexStatisVO cuBonusVertexStatisVO); @@ -64,82 +41,46 @@ public interface ICuBonusVertexStatisService extends IService pkVertexList); /** * @description: 查询奖金扣项配置参数 - * @author: zhang jing - * @date: 2023/9/15 14:02 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List bonusDeductlist(CuBonusVertexStatisVO cuBonusVertexStatisVO); /** * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:06 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List queryChinaCountryBonus(CuBonusVertexStatisVO cuBonusVertexStatisVO); /** * @description: 查询生效国外国家列表 - * @author: zhang jing - * @date: 2023/9/21 16:10 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ List countrylist(CuBonusVertexStatisVO cuBonusVertexStatisVO); /** * @description: 查询所有体系 - * @author: zhang jing - * @date: 2023/9/22 9:36 - * @param: [] - * @return: java.util.List **/ List vertexList(Integer pkVertex); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusLenjoyStatisServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusLenjoyStatisServiceImpl.java index 5315ee4b..9714b040 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusLenjoyStatisServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusLenjoyStatisServiceImpl.java @@ -4,20 +4,13 @@ import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hzs.common.core.constant.CountryConstants; import com.hzs.common.core.constant.TableNameConstants; -import com.hzs.common.core.enums.EBonusItems; import com.hzs.common.core.enums.EDelFlag; import com.hzs.common.core.enums.EOrderStatus; -import com.hzs.common.core.enums.EOrderType; import com.hzs.common.domain.member.statis.CuBonusVertexStatis; import com.hzs.member.achieve.service.ICuMemberSettlePeriodService; import com.hzs.member.base.service.ICuMemberService; import com.hzs.member.statis.mapper.CuBonusLenjoyStatisMapper; -import com.hzs.member.statis.mapper.CuBonusVertexStatisMapper; import com.hzs.member.statis.service.ICuBonusLenjoyStatisService; -import com.hzs.member.statis.service.ICuBonusVertexStatisService; -import com.hzs.member.statis.vo.CuBonusLenjoyStatisVO; -import com.hzs.member.statis.vo.CuBonusSinglePersonStatisVO; -import com.hzs.member.statis.vo.CuBonusVertexStatisTotalVO; import com.hzs.member.statis.vo.CuBonusLenjoyStatisVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -33,9 +26,7 @@ import java.util.Map; import java.util.stream.Collectors; /** - *

* 奖金拨比零线统计 服务实现类 - *

* * @author hzs * @since 2024-08-12 @@ -44,16 +35,12 @@ import java.util.stream.Collectors; public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl implements ICuBonusLenjoyStatisService { @Autowired - private ICuMemberSettlePeriodService cuMemberSettlePeriodService; + private ICuMemberSettlePeriodService iCuMemberSettlePeriodService; @Autowired private ICuMemberService iCuMemberService; /** * @description: 通过日期范围,返回范围内每天的日期 - * @author: zhang jing - * @date: 2024/8/15 10:44 - * @param: [startDate, endDate] - * @return: java.util.List **/ public static List getDatesInRange(String startDate, String endDate) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); @@ -70,10 +57,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl dates = getDatesInRange(startDate, endDate); for (String date : dates) { - int period = cuMemberSettlePeriodService.getCuMemberSettlePeriodByDate(date).getPkId(); + int period = iCuMemberSettlePeriodService.getCuMemberSettlePeriodByDate(date).getPkId(); String settleTableName = TableNameConstants.CU_MEMBER_RANGE + period; Integer count = iCuMemberService.selectExistTable(settleTableName); if (count == 0) { @@ -115,7 +98,7 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl> entry : orachListMap.entrySet()) { for (CuBonusLenjoyStatisVO ve : vertexList) { CuBonusLenjoyStatisVO oldSo = new CuBonusLenjoyStatisVO(); - oldSo = addOrderAmount(oldSo, null, ve.getPkVertex(), entry.getValue(), 2); + addOrderAmount(oldSo, null, ve.getPkVertex(), entry.getValue(), 2); if (oldSo.getPkCountry() != null) { soAll.add(oldSo); } @@ -137,7 +120,7 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl pkVertexList) { @@ -170,10 +149,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusStatis(CuBonusLenjoyStatisVO CuBonusLenjoyStatisVO) { @@ -183,10 +158,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl **/ @Override public List vertexList(Integer pkVertex) { return baseMapper.vertexList(pkVertex); } - /** * @description: 累加订单金额 - * @author: zhang jing - * @date: 2023/9/22 9:50 - * @param: [so, type] - * @return: void **/ private CuBonusLenjoyStatisVO addOrderAmount(CuBonusLenjoyStatisVO oldSo, Integer pkCountry, Integer pkVertex, List orachList, int type) { for (CuBonusLenjoyStatisVO newSo : orachList) { @@ -265,10 +223,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl soList) { for (CuBonusLenjoyStatisVO so : soList) { @@ -295,10 +249,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl **/ @Override public List queryChinaCountryBonus(CuBonusLenjoyStatisVO CuBonusLenjoyStatisVO) { @@ -324,10 +274,6 @@ public class CuBonusLenjoyStatisServiceImpl extends ServiceImpl getCuBonusStatis(CuBonusVertexStatis CuBonusVertexStatis) { return baseMapper.getCuBonusStatis(CuBonusVertexStatis); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusStatisServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusStatisServiceImpl.java index f7e3ac8f..e2256152 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusStatisServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusStatisServiceImpl.java @@ -22,9 +22,6 @@ import java.util.stream.Collectors; /** * 奖金拨比统计 服务实现类 - * - * @author zhangjing - * @since 2023-05-31 */ @Service @Slf4j @@ -32,14 +29,10 @@ public class CuBonusStatisServiceImpl extends ServiceImpl soList) { for (CuBonusStatisVO so : soList) { - if (so.getPkCountry() == null) { + if (null == so.getPkCountry()) { continue; } CuBonusStatis bs = new CuBonusStatis(); @@ -69,94 +62,66 @@ public class CuBonusStatisServiceImpl extends ServiceImpl existingRecord = getCuBonusStatis(bs); if (CollectionUtil.isEmpty(existingRecord)) { - baseMapper.insert(bs); // 不存在则插入新记录 + // 不存在则插入新记录 + baseMapper.insert(bs); } else { - bs.setPkId(existingRecord.get(0).getPkId()); // 设置主键ID - baseMapper.updateById(bs); // 存在则更新记录 + // 设置主键ID + bs.setPkId(existingRecord.get(0).getPkId()); + // 存在则更新记录 + baseMapper.updateById(bs); } } - } /** * @description: 累加订单金额 - * @author: zhang jing - * @date: 2023/9/22 9:50 - * @param: [so, type] - * @return: void **/ private CuBonusStatisVO addOrderAmount(CuBonusStatisVO oldSo, Integer pkCountry, Integer pkVertex, List orachList, int type) { for (CuBonusStatisVO newSo : orachList) { // 修改统计数据 - if ((pkCountry == null && pkVertex != null && pkVertex.equals(newSo.getPkVertex())) || - (pkCountry != null && pkVertex == null && pkCountry.equals(newSo.getPkCountry()))) { + if ( + (pkCountry == null && pkVertex != null && pkVertex.equals(newSo.getPkVertex())) + || + (pkCountry != null && pkVertex == null && pkCountry.equals(newSo.getPkCountry())) + ) { + // 国家国空,体系不为 并且 体系相同 + // 国家不为空,体系为空 并且 国家相同 oldSo.setPkCountry(newSo.getPkCountry()); oldSo.setCreationTime(newSo.getCreationTime()); if (newSo.getPkVertex() != null) { @@ -168,32 +133,39 @@ public class CuBonusStatisServiceImpl extends ServiceImpl cblist) { for (CuBonusStatisVO cb : cblist) { @@ -327,6 +262,7 @@ public class CuBonusStatisServiceImpl extends ServiceImpl existingRecord = getCuBonusStatis(bs); if (CollectionUtil.isEmpty(existingRecord)) { - baseMapper.insert(bs); // 不存在则插入新记录 + // 不存在则插入新记录 + baseMapper.insert(bs); } else { - bs.setPkId(existingRecord.get(0).getPkId()); // 设置主键ID - baseMapper.updateById(bs); // 存在则更新记录 - } - } - } - - /** - * @description: 保存国外奖金拨比奖金数据 - * @author: zhang jing - * @date: 2023/9/28 14:18 - * @param: [cblist] - * @return: void - **/ - private void saveForeignCountryBonus(List cblist) { - for (CuBonusStatisVO cb : cblist) { - if (cb.getPkCountry() == null) { - continue; - } - //查询体系是否添加 - CuBonusStatis bs = new CuBonusStatis(); - bs.setCreationTime(cb.getCreationTime()); - bs.setPkCountry(cb.getPkCountry()); - bs.setIntroduceBonus(cb.getIntroduceBonus()); - bs.setOrgBonus(cb.getOrgBonus()); - bs.setLeaderBonus(cb.getLeaderBonus()); - bs.setShareBonus(cb.getShareBonus()); - bs.setServiceBonus(cb.getServiceBonus()); - bs.setRepurRangeBonus(cb.getRepurRangeBonus()); - bs.setRepurOrgBonus(cb.getRepurOrgBonus()); - bs.setRepurPushIncome(cb.getRepurPushIncome()); - // 查询数据库判断记录是否存在 - List existingRecord = getCuBonusStatis(bs); - if (CollectionUtil.isEmpty(existingRecord)) { - baseMapper.insert(bs); // 不存在则插入新记录 - } else { - bs.setPkId(existingRecord.get(0).getPkId()); // 设置主键ID - baseMapper.updateById(bs); // 存在则更新记录 + // 设置主键ID + bs.setPkId(existingRecord.get(0).getPkId()); + // 存在则更新记录 + baseMapper.updateById(bs); } } } @@ -406,70 +306,22 @@ public class CuBonusStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO) { return baseMapper.queryCuBonusStatis(cuBonusStatisVO); } - /** - * @description: 查询国外奖金拨比 - * @author: zhang jing - * @date: 2023/9/28 16:42 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public List queryForeignCountryCuBonusStatis(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.queryForeignCountryCuBonusStatis(cuBonusStatisVO); - } - - /** - * @description: 查询国外奖金拨比合计 - * @author: zhang jing - * @date: 2023/10/7 16:02 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public CuBonusStatisVO queryForeignCountryCuBonusStatisSum(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.queryForeignCountryCuBonusStatisSum(cuBonusStatisVO); - } - /** * @description: 查询体系合计的订单业绩 - * @author: zhang jing - * @date: 2024/7/2 9:48 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ @Override public CuBonusStatisVO queryOrderAchieveSum(CuBonusStatisVO cuBonusStatisVO) { return baseMapper.queryOrderAchieveSum(cuBonusStatisVO); } - /** - * @description: 查询能量舱订单金额 - * @author: zhang jing - * @date: 2024/7/1 10:52 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public List queryEnergyChamberOrderList(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.queryEnergyChamberOrderList(cuBonusStatisVO); - } - /** * @description: 奖金拨比列表统计小计(最后一行) - * @author: zhang jing - * @date: 2023/9/13 9:21 - * @param: [cuBonusStatisVO] - * @return: com.hzs.member.statis.vo.CuBonusStatisVO **/ @Override public CuBonusStatisVO queryCuBonusSumStatis(CuBonusStatisVO cuBonusStatisVO) { @@ -478,10 +330,6 @@ public class CuBonusStatisServiceImpl extends ServiceImpl **/ @Override public CuBonusSinglePersonStatisVO bonusSingleSum(CuBonusSinglePersonStatisVO csps) { @@ -490,10 +338,6 @@ public class CuBonusStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusStatisChart(CuBonusStatisChartVO chartVO) { @@ -502,10 +346,6 @@ public class CuBonusStatisServiceImpl extends ServiceImpl getCuBonusStatis(CuBonusStatis cuBonusStatis) { return baseMapper.getCuBonusStatis(cuBonusStatis); @@ -583,35 +407,34 @@ public class CuBonusStatisServiceImpl extends ServiceImpl vertexlist = vertexList(); + //查询新增订单 CuBonusStatisVO cbs = new CuBonusStatisVO(); - //累加好的数据存入soAll - List soAll = new ArrayList<>(); cbs.setDelFlag(EDelFlag.UN_DELETE.getValue()); cbs.setOrderStatus(EOrderStatus.PAY.getValue()); cbs.setStartDate(startDate); cbs.setEndDate(endDate); cbs.setPkCountry(CountryConstants.CHINA_COUNTRY); -// //先查中国订单 + + //累加好的数据存入soAll + List soAll = new ArrayList<>(); + // 先查中国订单 List orachList = baseMapper.querySaOrderByLessDay(cbs); + // 按支付时间(年月日)把订单进行分组(key:支付时间(年月日),value:订单统计数据列表) Map> orachListMap = orachList.stream() .collect(Collectors.groupingBy(CuBonusStatisVO::getCreationTime)); - //查询所有体系 - List vertexlist = vertexList(); if (CollectionUtil.isNotEmpty(orachList)) { if (CollectionUtil.isNotEmpty(vertexlist)) { for (Map.Entry> entry : orachListMap.entrySet()) { for (CuBonusStatisVO ve : entry.getValue()) { CuBonusStatisVO oldSo = new CuBonusStatisVO(); - oldSo = addOrderAmount(oldSo, null, ve.getPkVertex(), entry.getValue(), 2); + addOrderAmount(oldSo, null, ve.getPkVertex(), entry.getValue(), 2); if (oldSo.getPkCountry() != null) { soAll.add(oldSo); } @@ -619,11 +442,12 @@ public class CuBonusStatisServiceImpl extends ServiceImpl acAll = new ArrayList<>(); //查询中国统计奖金 -// List listCn = cuMemberBonusService.queryMemberBonusByPeriod(null, startDate, endDate, CountryConstants.CHINA_COUNTRY); - List listCn = queryChinaCountryBonus(cbs); + List listCn = baseMapper.queryChinaCountryBonus(cbs); + // 按支付时间(年月日)把订单进行分组(key:支付时间(年月日),value:订单统计数据列表) Map> listCnMap = listCn.stream() .collect(Collectors.groupingBy(CuBonusStatisVO::getCreationTime)); if (CollectionUtil.isNotEmpty(listCn)) { @@ -633,86 +457,27 @@ public class CuBonusStatisServiceImpl extends ServiceImpl fcAll = new ArrayList<>(); - List countrylist = countrylist(cbs); - if (CollectionUtil.isNotEmpty(countrylist)) { - for (CuBonusStatisVO con : countrylist) { - cbs.setDelFlag(EDelFlag.UN_DELETE.getValue()); - cbs.setOrderStatus(EOrderStatus.PAY.getValue()); - cbs.setStartDate(startDate); - cbs.setEndDate(endDate); - cbs.setPkCountry(con.getPkCountry()); - //查询国外订单 - List orach = baseMapper.querySaOrderByLessDay(cbs); - Map> orachMap = orach.stream() - .collect(Collectors.groupingBy(CuBonusStatisVO::getCreationTime)); - if (CollectionUtil.isNotEmpty(orach)) { - for (Map.Entry> entry : orachMap.entrySet()) { - CuBonusStatisVO oldSo = new CuBonusStatisVO(); - oldSo = addOrderAmount(oldSo, con.getPkCountry(), null, entry.getValue(), 2); - if (oldSo.getPkCountry() != null) { - soAll.add(oldSo); - } - } - } - - //查询国外统计奖金 - //累加好的数据存入fcAll - CuBonusStatisVO cuBonusStatisVO = new CuBonusStatisVO(); - cuBonusStatisVO.setStartDate(startDate); - cuBonusStatisVO.setEndDate(endDate); - cuBonusStatisVO.setPkCountry(con.getPkCountry()); - //查询国外奖金 - List bsList = queryForeignCountryBonus(cuBonusStatisVO); - Map> bsListMap = bsList.stream() - .collect(Collectors.groupingBy(CuBonusStatisVO::getCreationTime)); - if (CollectionUtil.isNotEmpty(bsList)) { - for (Map.Entry> entry : bsListMap.entrySet()) { - CuBonusStatisVO oldSo1 = new CuBonusStatisVO(); - for (CuBonusStatisVO cb : entry.getValue()) { - if (con.getPkCountry().equals(cb.getPkCountry())) { - oldSo1 = addFcAchieve(oldSo1, cb); - } - } - if (oldSo1.getPkCountry() != null) { - fcAll.add(oldSo1); - } - } - - } - } - } - - //存入订单信息 saveBonusStatis(soAll); //存入国内奖金信息 saveBonusStatisAchieve(acAll); - //存入国外奖金信息 - saveForeignCountryBonus(fcAll); + return true; } /** * @description: 删除奖金拨比统计表数据 - * @author: zhang jing - * @date: 2023/9/11 16:04 - * @param: [] - * @return: java.lang.Boolean **/ @Override public Boolean delStatis(String startDate, String endDate) { @@ -721,72 +486,22 @@ public class CuBonusStatisServiceImpl extends ServiceImpl **/ @Override public List bonusDeductlist(CuBonusStatisVO cuBonusStatisVO) { return baseMapper.bonusDeductlist(cuBonusStatisVO); } - /** * @description: 查询分红比例配置 - * @author: zhang jing - * @date: 2023/9/28 17:04 - * @param: [cuBonusStatisVO] - * @return: java.util.List **/ @Override public List bonusDividendRatiolist(CuBonusStatisVO cuBonusStatisVO) { return baseMapper.bonusDividendRatiolist(cuBonusStatisVO); } - /** - * @description: 查询国外奖金 - * @author: zhang jing - * @date: 2023/9/28 14:12 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public List queryForeignCountryBonus(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.queryForeignCountryBonus(cuBonusStatisVO); - } - - /** - * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:06 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public List queryChinaCountryBonus(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.queryChinaCountryBonus(cuBonusStatisVO); - } - - - /** - * @description: 查询生效国外国家列表 - * @author: zhang jing - * @date: 2023/9/21 16:10 - * @param: [cuBonusStatisVO] - * @return: java.util.List - **/ - @Override - public List countrylist(CuBonusStatisVO cuBonusStatisVO) { - return baseMapper.countrylist(cuBonusStatisVO); - } - /** * @description: 查询有效体系 - * @author: zhang jing - * @date: 2023/9/22 9:37 - * @param: [] - * @return: java.util.List **/ @Override public List vertexList() { diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusVertexStatisServiceImpl.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusVertexStatisServiceImpl.java index 8347eb75..444a65e8 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusVertexStatisServiceImpl.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/service/impl/CuBonusVertexStatisServiceImpl.java @@ -29,9 +29,6 @@ import java.util.stream.Collectors; /** * 奖金拨比零线统计 服务实现类 - * - * @author hzs - * @since 2024-08-12 */ @Service public class CuBonusVertexStatisServiceImpl extends ServiceImpl implements ICuBonusVertexStatisService { @@ -41,10 +38,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ public static List getDatesInRange(String startDate, String endDate) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); @@ -61,10 +54,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl pkVertexList) { @@ -157,10 +142,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List bonusDeductlist(CuBonusVertexStatisVO cuBonusVertexStatisVO) { @@ -169,10 +150,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusStatis(CuBonusVertexStatisVO cuBonusVertexStatisVO) { @@ -181,10 +158,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusStatisTotal(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO) { @@ -193,10 +166,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List queryCuBonusVertex(CuBonusVertexStatisTotalVO cuBonusVertexStatisTotalVO) { @@ -218,10 +183,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List queryEnergyChamberOrderList(CuBonusVertexStatisVO cuBonusVertexStatisVO) { @@ -236,10 +197,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List countrylist(CuBonusVertexStatisVO cuBonusVertexStatisVO) { @@ -345,10 +301,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl **/ @Override public List vertexList(Integer pkVertex) { @@ -358,10 +310,6 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl orachList, int type) { for (CuBonusVertexStatisVO newSo : orachList) { @@ -379,32 +327,39 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl existingRecord = getCuBonusStatis(bs); if (CollectionUtil.isEmpty(existingRecord)) { - baseMapper.insert(bs); // 不存在则插入新记录 + // 不存在则插入新记录 + baseMapper.insert(bs); } else { - bs.setPkId(existingRecord.get(0).getPkId()); // 设置主键ID - baseMapper.updateById(bs); // 存在则更新记录 + // 设置主键ID + bs.setPkId(existingRecord.get(0).getPkId()); + // 存在则更新记录 + baseMapper.updateById(bs); } } } /** * @description: 保存奖金拨比订单数据 - * @author: zhang jing - * @date: 2023/9/14 14:44 - * @param: [so, type] - * @return: void **/ private void saveBonusStatis(List soList) { for (CuBonusVertexStatisVO so : soList) { @@ -489,88 +441,54 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl existingRecord = getCuBonusStatis(bs); if (CollectionUtil.isEmpty(existingRecord)) { - baseMapper.insert(bs); // 不存在则插入新记录 + // 不存在则插入新记录 + baseMapper.insert(bs); } else { - bs.setPkId(existingRecord.get(0).getPkId()); // 设置主键ID - baseMapper.updateById(bs); // 存在则更新记录 + // 设置主键ID + bs.setPkId(existingRecord.get(0).getPkId()); + // 存在则更新记录 + baseMapper.updateById(bs); } } - } /** * @description: 查询中国奖金 - * @author: zhang jing - * @date: 2023/10/8 11:06 - * @param: [CuBonusVertexStatisVO] - * @return: java.util.List **/ @Override public List queryChinaCountryBonus(CuBonusVertexStatisVO cuBonusVertexStatisVO) { @@ -594,13 +512,8 @@ public class CuBonusVertexStatisServiceImpl extends ServiceImpl getCuBonusStatis(CuBonusVertexStatis CuBonusVertexStatis) { return baseMapper.getCuBonusStatis(CuBonusVertexStatis); diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusStatisVO.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusStatisVO.java index 52e5d849..8fa55728 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusStatisVO.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusStatisVO.java @@ -10,11 +10,9 @@ import java.util.Date; import java.util.List; /** - *

* 奖金拨比统计 * 每个团队,每天一条数据 * 数据来自 订单表和 CU_MEMBER_BONUS 会员奖金-会员奖金汇总表 - *

* * @author zhangjing * @since 2023-05-31 @@ -278,6 +276,12 @@ public class CuBonusStatisVO { @Excel(name = "复购拓展收益(¥)", scale = 2) @BigDecimalFormat private BigDecimal repurOrgBonus = BigDecimal.ZERO; + /** + * 复购辅导收益(¥) + */ + @Excel(name = "复购辅导收益(¥)", scale = 2) + @BigDecimalFormat + private BigDecimal repurLeaderBonus = BigDecimal.ZERO; /** * (直推收益+拓展收益+辅导收益+分红收益+报单收益(服务补贴))*0.8+创客空间3000元的店补+1万里面的2000元直推奖=实际拨出之和。 diff --git a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusVertexStatisVO.java b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusVertexStatisVO.java index 8e11dd71..6ff318e2 100644 --- a/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusVertexStatisVO.java +++ b/bd-business/bd-business-member/src/main/java/com/hzs/member/statis/vo/CuBonusVertexStatisVO.java @@ -279,6 +279,12 @@ public class CuBonusVertexStatisVO { @Excel(name = "复购拓展收益(¥)", scale = 2) @BigDecimalFormat private BigDecimal repurOrgBonus = BigDecimal.ZERO; + /** + * 复购辅导收益(¥) + */ + @Excel(name = "复购辅导收益(¥)", scale = 2) + @BigDecimalFormat + private BigDecimal repurLeaderBonus = BigDecimal.ZERO; /** * 海粉直推收益(海粉推荐收益)(%) diff --git a/bd-business/bd-business-member/src/main/resources/mapper/member/attest/CuEnergySiloDetailMapper.xml b/bd-business/bd-business-member/src/main/resources/mapper/member/attest/CuEnergySiloDetailMapper.xml index b4814667..62bf4af6 100644 --- a/bd-business/bd-business-member/src/main/resources/mapper/member/attest/CuEnergySiloDetailMapper.xml +++ b/bd-business/bd-business-member/src/main/resources/mapper/member/attest/CuEnergySiloDetailMapper.xml @@ -2,69 +2,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bd-business/bd-business-member/src/main/resources/mapper/member/base/CuMemberMapper.xml b/bd-business/bd-business-member/src/main/resources/mapper/member/base/CuMemberMapper.xml index a34351c1..9c9641b2 100644 --- a/bd-business/bd-business-member/src/main/resources/mapper/member/base/CuMemberMapper.xml +++ b/bd-business/bd-business-member/src/main/resources/mapper/member/base/CuMemberMapper.xml @@ -1377,18 +1377,6 @@ order by mbp.ROUND asc ,mbp.SECOND asc - - - @@ -139,7 +131,6 @@ - - SELECT - pk_id as pkVertex, - MEMBER_CODE as memberCode, - MEMBER_NAME as memberName - FROM - cu_member m - WHERE - m.pk_place_parent = 2 - AND m.del_flag = 0 - AND m.pk_country = 1 - AND m.category = 0 - AND m.pay_status =1 - AND m.SYSTEM_TYPE =1 - - AND m.pk_id=#{pkVertex} - - + SELECT + pk_id as pkVertex, + MEMBER_CODE as memberCode, + MEMBER_NAME as memberName + FROM + cu_member m + WHERE + m.pk_place_parent = 2 + AND m.del_flag = 0 + AND m.pk_country = 1 + AND m.category = 0 + AND m.pay_status =1 + AND m.SYSTEM_TYPE =1 + + AND m.pk_id=#{pkVertex} + - - + diff --git a/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusStatisMapper.xml b/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusStatisMapper.xml index 3aae3d77..8ac02be3 100644 --- a/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusStatisMapper.xml +++ b/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusStatisMapper.xml @@ -2,59 +2,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PK_ID - , STATIS_TYPE, PERIOD, START_DATE, END_DATE, MAIN_REG_AMOUNT, MAIN_UP_AMOUNT, MAIN_REPUR_AMOUNT, AGENT_REG_AMOUNT, AGENT_UP_AMOUNT, AGENT_REPUR_AMOUNT, HIFANS_REG_AMOUNT, TOTAL_AMOUNT, INTRODUCE_BONUS, INTRODUCE_BONUS_RATE, ORG_BONUS, ORG_BONUS_RATE, LEADER_BONUS, LEADER_BONUS_RATE, SHARE_BONUS, SHARE_BONUS_RATE, SERVICE_BONUS, SERVICE_BONUS_RATE, SEABEAN, REPUR_RANGE_BONUS, SEABEAN_REPUR_RANGE, REPUR_ORG_BONUS, AGENT_INTRODUCE_BONUS, AGENT_AREA_BONUS, MAIN_BONUS, MAIN_BONUS_RATE, REPUR_BONUS, REPUR_BONUS_RATE, TOTAL_BONUS, TOTAL_BONUS_RATE, TOTAL_BONUS_REAL, STATIS_SYS - - - - - - - - - - - - - @@ -875,6 +507,7 @@ ORDER BY cbs.CREATION_TIME DESC + + delete from CU_BONUS_STATIS @@ -1126,7 +757,6 @@ @@ -1591,16 +1219,6 @@ ORDER BY ba.ABONUS_RATIO DESC - - - - - - - + - diff --git a/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusVertexStatisMapper.xml b/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusVertexStatisMapper.xml index e29650cb..83ecad09 100644 --- a/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusVertexStatisMapper.xml +++ b/bd-business/bd-business-member/src/main/resources/mapper/member/statis/CuBonusVertexStatisMapper.xml @@ -891,12 +891,12 @@ pk_member FROM ${settleTableName} - WHERE category=0 + WHERE category = 0 start with pk_place_parent = #{pkVertex} connect by pk_place_parent = prior pk_member ) cm - INNER JOIN SA_ORDER so on so.pk_member=cm.pk_member - where so.ORDER_TYPE in (1,2,3,4,5,6,7,12,13,14,18,19,20,22,24,25,26,27,28,31) + INNER JOIN SA_ORDER so on so.pk_member = cm.pk_member + where so.ORDER_TYPE in (1, 3, 4, 5, 7, 8, 9, 12, 14, 15, 16, 20, 21, 24, 25) and so.pk_country=#{pkCountry} @@ -906,7 +906,6 @@ AND so.order_status=#{orderStatus} - and so.PAY_TIME >= to_date(#{startDate}, 'yyyy-mm-dd') @@ -1118,32 +1117,32 @@ GROUP BY bbi.BONUS_VALUE, mbd.PK_COUNTRY, to_char(so.PAY_TIME, 'yyyy-mm-dd') - +