From 0b57cfd62e842b309d03467b96a331c673ecad7c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 21 四月 2020 14:08:18 +0800 Subject: [PATCH] 删除普通会员等级 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java | 192 ++++++++++++----------------------------------- 1 files changed, 50 insertions(+), 142 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java index 442cbfb..745188c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java @@ -59,7 +59,6 @@ import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.user.UserLevelUtil; import com.yeshi.fanli.vo.order.CommonOrderVO; -import com.yeshi.fanli.vo.order.CurrentBonusVO; import com.yeshi.fanli.vo.order.GoodsRebateVO; import com.yeshi.fanli.vo.order.HongBaoCountVO; import com.yeshi.fanli.vo.order.OrderCountVO; @@ -480,24 +479,6 @@ dividend = new BigDecimal(0); // 鎬诲洟闃熷鍔� teamMoney = bonus.add(subsidy).add(dividend); - - JSONObject paramsFanli = new JSONObject(); - paramsFanli.put("type", "1"); - data.put("paramsFanli", paramsFanli); - data.put("jumpFanli", jumpDetailV2Service.getByTypeCache("fanli_share_statistics", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); - - JSONObject paramsShare = new JSONObject(); - paramsShare.put("type", "2"); - data.put("paramsShare", paramsShare); - data.put("jumpShare", jumpDetailV2Service.getByTypeCache("fanli_share_statistics", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); - - JSONObject paramsTeam = new JSONObject(); - paramsTeam.put("type", "3"); - data.put("paramsTeam", paramsTeam); - data.put("jumpTeam", jumpDetailV2Service.getByTypeCache("team_statistics", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); } data.put("inviteMoney", teamMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); out.print(JsonUtil.loadTrueResult(data)); @@ -591,8 +572,7 @@ hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); } } - orderRebateVO.setFanLiDesc(predictDesc + typeName); - orderRebateVO.setFanLi("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN)); + HongBaoV2 hongBaoV2 = hoList.get(0).getHongBaoV2(); UserLevelEnum userLevel = UserLevelUtil.getByOrderRank(hongBaoV2.getUrank()); @@ -600,6 +580,15 @@ userLevel = UserLevelEnum.daRen; UserLevelEnum upperLevel = UserLevelEnum.superVIP; + CommonOrder commonOrder1 = hoList.get(0).getCommonOrder(); + Date downTime = commonOrder1.getThirdCreateTime(); + Integer urank = commonOrder1.getUrank(); + UserLevelEnum buyerUserLevel = UserLevelUtil.getByOrderRank(urank); + boolean direct = false; + if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) { + direct = true; + } + BigDecimal upperTotalMoney = new BigDecimal(0); List<GoodsRebateVO> voList = new ArrayList<>(); for (HongBaoOrder hongBaoOrder : hoList) { @@ -623,20 +612,20 @@ payment = new BigDecimal(0); goodsVO.setActualPay("楼" + payment.setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal fanli = hongBaoOrder.getHongBaoV2().getMoney(); + // 鍩虹浣i噾 BigDecimal commission = orderHongBaoMoneyComputeService.computeBaseFanliMoney(commonOrder); - if (type == 3) { // 濂栭噾 - goodsVO.setBonus("楼" + hongBaoOrder.getHongBaoV2().getMoney() +""); - } else { // 浣i噾 - goodsVO.setCommision("楼" +commission); - } - - // 骞冲彴琛ヨ创 - BigDecimal vipFanli = hongBaoOrder.getHongBaoV2().getMoney(); - goodsVO.setSubsidy("楼" + vipFanli.subtract(commission).setScale(2, BigDecimal.ROUND_DOWN)); + goodsVO.setCommision("楼" +commission.setScale(2, BigDecimal.ROUND_DOWN)); + // 骞冲彴琛ヨ创 = 杩斿埄 - 鍩虹浣i噾 + goodsVO.setSubsidy("楼" + fanli.subtract(commission).setScale(2, BigDecimal.ROUND_DOWN)); // 杈句汉琛ヨ创 if (userLevel != UserLevelEnum.daRen) { BigDecimal darenFanli = orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, UserLevelEnum.daRen); goodsVO.setOriginSubsidy("楼" + darenFanli.subtract(commission).setScale(2, BigDecimal.ROUND_DOWN) + ""); + } + + if (type == 3) { // 濂栭噾 + goodsVO.setBonus("楼" + fanli.setScale(2, BigDecimal.ROUND_DOWN) +""); } voList.add(goodsVO); @@ -645,9 +634,12 @@ upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, upperLevel)); } else if (type == 2) { upperTotalMoney = upperTotalMoney.add(orderHongBaoMoneyComputeService.computeShareMoney(commonOrder, upperLevel)); + } else if (type == 3) { + upperTotalMoney = upperTotalMoney.add(hongBao); } } + // 鍥㈤槦琛ヨ创 if (type == 3) { BigDecimal teamSubsidy = null; @@ -655,17 +647,23 @@ InviteOrderSubsidy inviteOrderSubsidy = inviteOrderSubsidyServiceV2.getByOrderNoAndType(uid, orderNo, sourceType); if (inviteOrderSubsidy != null) { teamSubsidy = inviteOrderSubsidy.getMoney(); + // 璁$畻鍘熸瘮渚� + BigDecimal originRate = orderHongBaoMoneyComputeService.getTeamSubsidyRate(downTime,buyerUserLevel, userLevel, direct); + + // 璁$畻杈句汉琛ヨ创 if (userLevel != UserLevelEnum.daRen) { - CommonOrder commonOrder = hoList.get(0).getCommonOrder(); - Integer urank = commonOrder.getUrank(); - UserLevelEnum buyerUserLevel = UserLevelUtil.getByOrderRank(urank); - boolean direct = false; - if (hongBaoV2.getType() == HongBaoV2.TYPE_YIJI || hongBaoV2.getType() == HongBaoV2.TYPE_SHARE_YIJI) { - direct = true; - } - // 璁$畻涓婁竴绾цˉ璐� - lowerSubsidy = getLowerSubsidy(inviteOrderSubsidy.getMoney(), commonOrder.getThirdCreateTime(), buyerUserLevel, userLevel, direct); + BigDecimal daRenRate = orderHongBaoMoneyComputeService.getTeamSubsidyRate(downTime, buyerUserLevel, + UserLevelEnum.daRen, direct); + lowerSubsidy = MoneyBigDecimalUtil.div(teamSubsidy.multiply(daRenRate), originRate); } + + // 璁$畻瓒呯骇浼氬憳琛ヨ创 + if (userLevel != UserLevelEnum.superVIP && userLevel != UserLevelEnum.tearcher) { + BigDecimal vipRate = orderHongBaoMoneyComputeService.getTeamSubsidyRate(downTime, buyerUserLevel, + UserLevelEnum.superVIP, direct); + upperTotalMoney = upperTotalMoney.add(MoneyBigDecimalUtil.div(teamSubsidy.multiply(vipRate), originRate)); + } + } else { teamSubsidy = BigDecimal.valueOf(0.00); lowerSubsidy = BigDecimal.valueOf(0.00); @@ -677,17 +675,23 @@ orderRebateVO.setSubsidyDesc("鍥㈤槦琛ヨ创"); orderRebateVO.setSubsidy("楼" + teamSubsidy.setScale(2, BigDecimal.ROUND_DOWN) +""); - upperTotalMoney = upperTotalMoney.add(teamSubsidy); + hongBao = hongBao.add(teamSubsidy); } + + orderRebateVO.setFanLiDesc(predictDesc + typeName); + orderRebateVO.setFanLi("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN)); orderRebateVO.setType(type); orderRebateVO.setStateDesc(stateDesc); orderRebateVO.setListGoods(voList); - orderRebateVO.setUserLevel(userLevel.name()); + if (downTime.getTime() < Constant.NEW_ORDER_FANLI_RULE_TIME) { + orderRebateVO.setUserLevel(UserLevelEnum.superVIP.name()); // 闅愯棌 + } else { + orderRebateVO.setUserLevel(userLevel.name()); + } - // 涓婄骇杩斿埄 + // 瓒呯骇浼氬憳杩斿埄 if (upperLevel != null) { - upperTotalMoney = upperTotalMoney.add(hongBao); orderRebateVO.setUpperFanLi("楼" + upperTotalMoney); orderRebateVO.setJumpLink(upperLevel.getDetailLink()); } @@ -709,7 +713,6 @@ freeState = state; break; } - } } @@ -745,14 +748,14 @@ } } else { Date accountTime = hongBaoV2.getGetTime(); - if (accountTime != null) { + // 鍒拌处鏃堕棿 -绾㈠寘閲戦闄愬埗 + if (accountTime != null && hongBao.compareTo(Constant.REWARD_COUPON_LIMIT_MONEY) <= 0) { boolean vip = userInviteService.verifyVIP(uid); Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime); long currentTime = java.lang.System.currentTimeMillis(); if (endDay.getTime() > currentTime && !vip) { UserSystemCouponRecord couponRecord = userSystemCouponRecordService.getRecordByOrderNo(orderNo, null); - if (couponRecord == null - || (couponRecord.getCouponType() == CouponTypeEnum.rebatePercentCoupon.name() && couponRecord.getState() != UserSystemCouponRecord.STATE_SUCCESS)) { + if (couponRecord == null) { orderRebateVO.setCoupon(true); orderRebateVO.setCouponType(1); orderRebateVO.setCouponText("绔嬪嵆浣跨敤"); @@ -767,99 +770,4 @@ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } - - private BigDecimal getLowerSubsidy(BigDecimal money, Date downTime, UserLevelEnum buyerUserLevel, UserLevelEnum userLevel, boolean direct) { - // 鍘熷姣斾緥 - BigDecimal originRate = orderHongBaoMoneyComputeService.getTeamSubsidyRate(downTime, - buyerUserLevel, userLevel, direct); - - // 灏忎竴绾ф瘮渚� - BigDecimal darenRate = orderHongBaoMoneyComputeService.getTeamSubsidyRate(downTime, buyerUserLevel, UserLevelEnum.daRen, direct); - - return MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.div(money,originRate), darenRate); - } - - - /** - * 鏁版嵁缁熻 - * @param acceptData - * @param uid - * @param type 1鑷喘 2鍒嗕韩 3鍥㈤槦 - * @param out - */ - @RequestMapping(value = "getCurrentBonus", method = RequestMethod.POST) - public void getCurrentBonus(AcceptData acceptData, Long uid, Integer type, PrintWriter out) { - if (uid == null) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); - return; - } - - JSONObject data = new JSONObject(); - if (type == 1 || type == 2) { - CurrentBonusVO bonus = new CurrentBonusVO(); - bonus.setToday(hongBaoV2CountService.geBonusByuid(uid, 1, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setYesterday(hongBaoV2CountService.geBonusByuid(uid, 2, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setThisMonth(hongBaoV2CountService.geBonusByuid(uid, 3, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setLastMonth(hongBaoV2CountService.geBonusByuid(uid, 4, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - - CurrentBonusVO bonusNot = new CurrentBonusVO(); - bonusNot.setToday(hongBaoV2CountService.geBonusByuid(uid, 1, type, 1).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonusNot.setYesterday(hongBaoV2CountService.geBonusByuid(uid, 2, type, 1).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonusNot.setThisMonth(hongBaoV2CountService.geBonusByuid(uid, 3, type, 1).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonusNot.setLastMonth(hongBaoV2CountService.geBonusByuid(uid, 4, type, 1).setScale(2, BigDecimal.ROUND_DOWN).toString()); - - - data.put("bonus",bonus); - data.put("bonusNot",bonusNot); - data.put("total", hongBaoV2CountService.geBonusByuid(uid, null, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - data.put("totalNot", hongBaoV2CountService.geBonusByuid(uid, null, type, 1).setScale(2, BigDecimal.ROUND_DOWN).toString()); - } else { - CurrentBonusVO bonus = new CurrentBonusVO(); - bonus.setToday(hongBaoV2CountService.geBonusByuid(uid, 1, type, 4).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setYesterday(hongBaoV2CountService.geBonusByuid(uid, 2, type, 4).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setThisMonth(hongBaoV2CountService.geBonusByuid(uid, 3, type, 4).setScale(2, BigDecimal.ROUND_DOWN).toString()); - bonus.setLastMonth(hongBaoV2CountService.geBonusByuid(uid, 4, type, 2).setScale(2, BigDecimal.ROUND_DOWN).toString()); - - - CurrentBonusVO subsidy = new CurrentBonusVO(); - subsidy.setToday(inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid,1,null).setScale(2, BigDecimal.ROUND_DOWN).toString()); - subsidy.setYesterday(inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid,2,null).setScale(2, BigDecimal.ROUND_DOWN).toString()); - subsidy.setThisMonth(inviteOrderSubsidyServiceV2.sumValidMoneyByUidAndDate(uid,3,null).setScale(2, BigDecimal.ROUND_DOWN).toString()); - subsidy.setLastMonth(inviteOrderSubsidyServiceV2.sumMoneyByUidAndDateAndState(uid,4,null,3).setScale(2, BigDecimal.ROUND_DOWN).toString()); - - // TODO 鍒嗙孩缁熻 - CurrentBonusVO dividend = new CurrentBonusVO(); - dividend.setThisMonth("0.00"); - dividend.setLastMonth("0.00"); - - BigDecimal totalBonus = hongBaoV2CountService.geBonusByuid(uid, null, type, 2); - BigDecimal totalubsidy = inviteOrderSubsidyServiceV2.sumRecievedMoneyByUid(uid,null); - BigDecimal totalDividend = new BigDecimal(0); - - BigDecimal total = totalDividend.add(totalBonus).add(totalubsidy); - - - data.put("bonus",bonus); - data.put("subsidy",subsidy); - data.put("dividend",dividend); - data.put("subsidy",subsidy); - data.put("total", total.setScale(2, BigDecimal.ROUND_DOWN).toString()); - data.put("totalBonus", totalBonus.setScale(2, BigDecimal.ROUND_DOWN).toString()); - data.put("totalubsidy", totalubsidy.setScale(2, BigDecimal.ROUND_DOWN).toString()); - data.put("totalDividend", totalDividend.setScale(2, BigDecimal.ROUND_DOWN).toString()); - } - - String key = null; - if (type == 1) { - key = ConfigKeyEnum.bonusCountLinkFanli.getKey(); - } else if (type == 2) { - key = ConfigKeyEnum.bonusCountLinkShare.getKey(); - } else { - key = ConfigKeyEnum.bonusCountLinkTeam.getKey(); - } - - data.put("link",configService.get(key)); - out.print(JsonUtil.loadTrueResult(data)); - } - } -- Gitblit v1.8.0