From 9a24f2802a3d6fe3e82c05e52f2880d65ad04dcf Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期一, 29 四月 2019 08:59:47 +0800 Subject: [PATCH] Merge branch 'div_develop' into master_develop --- fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 98 insertions(+), 13 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java index ca7ce6f..7cf4837 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java @@ -175,7 +175,6 @@ if (hasAdd) { Iterator<Integer> its = notificationMap.keySet().iterator(); while (its.hasNext()) { - Integer t = its.next(); HongBaoV2 notify = notificationMap.get(t).getHongBaoV2(); CommonOrder commonOrder = notificationMap.get(t).getCommonOrder(); @@ -206,6 +205,11 @@ MsgOrderDetail.STATE_FK, null, money); userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(), money, goodsCount, state); + break; + + case HongBaoV2.TYPE_SHARE_YIJI: + userOrderMsgNotificationService.orderShareFirstLevelStatistic(uid, orderId, + commonOrder.getPayment(), money, goodsCount, state, notify.getBeizhu()); break; } } @@ -239,6 +243,9 @@ userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(), money, state); break; + case HongBaoV2.TYPE_SHARE_YIJI: + userOrderMsgNotificationService.orderShareFirstLevelStateChanged(uid, orderId, + commonOrder.getPayment(), money, state); } } } @@ -338,7 +345,7 @@ // 鑾峰彇瀛愮孩鍖� List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId()); - if (children != null&&children.size()>0) + if (children != null && children.size() > 0) for (HongBaoV2 child : children) { HongBaoV2 childUpdate = new HongBaoV2(child.getId()); childUpdate.setState(hongBao.getState()); @@ -390,7 +397,7 @@ else {// 淇涔嬪墠浜岀骇,涓夌骇璁㈠崟鏈粺璁″埌鐨勬儏鍐� if (!mianDan) { ThreeSale threeSale = threeSaleSerivce.selectByWorkerId(commonOrder.getUserInfo().getId()); - if (threeSale.getSucceedTime() != null + if (threeSale != null && threeSale.getSucceedTime() != null && threeSale.getSucceedTime() <= commonOrder.getThirdCreateTime().getTime()) { UserInfo boss = threeSaleSerivce.getBoss(commonOrder.getUserInfo().getId()); // 鎻掑叆涓�绾у瓙绾㈠寘 @@ -548,17 +555,20 @@ childUpdate.setUpdateTime(new Date()); BigDecimal rate = null; if (child.getType() == HongBaoV2.TYPE_SHARE_YIJI) {// 涓�绾у垎浜禋 - rate = hongBaoManageService.getFirstShareRate(child.getUrank(), - commonOrder.getCreateTime().getTime()); + rate = hongBaoManageService.getFirstShareRate(1, commonOrder.getCreateTime().getTime()); } else if (child.getType() == HongBaoV2.TYPE_SHARE_ERJI) {// 浜岀骇鍒嗕韩璧� - rate = hongBaoManageService.getSecondShareRate(child.getUrank(), - commonOrder.getCreateTime().getTime()); + rate = hongBaoManageService.getSecondShareRate(1, commonOrder.getCreateTime().getTime()); } // 浠ュ疄闄呮敹鍏ヤ负鍑嗚绠楅浼版敹鐩� if (CommonOrder.STATE_JS == commonOrder.getState()) { childUpdate.setMoney( MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100)))); + if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16", + "yyyy-MM-dd")) + childUpdate.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), + rate.divide(new BigDecimal(100)))); + Calendar calendar = Calendar.getInstance(); calendar.setTime(commonOrder.getSettleTime()); calendar.add(Calendar.MONTH, 1); @@ -566,13 +576,34 @@ calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", "yyyy-M-dd"))); } else if (CommonOrder.STATE_FK == commonOrder.getState()) { - if (commonOrder.getOrderNo().equalsIgnoreCase("314134177659155087")) - System.out.println(""); - - childUpdate.setMoney( - MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100)))); + if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-16", + "yyyy-MM-dd")) + childUpdate.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), + rate.divide(new BigDecimal(100)))); + else + childUpdate.setMoney( + MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100)))); } hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate); + // 娣诲姞閫氱煡 + if (notificationMap.get(child.getType()) == null) { + HongBaoV2 tempHongBao = new HongBaoV2(child.getId()); + tempHongBao.setUserInfo(child.getUserInfo()); + tempHongBao.setMoney(childUpdate.getMoney()); + CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId()); + tempCommonOrder.setPayment(commonOrder.getPayment()); + notificationMap.put(child.getType(), new HongBaoOrder(tempCommonOrder, tempHongBao)); + } else { + // 澧炲姞浠樻閲戦涓庤祫閲� + HongBaoOrder tempHongBaoOrder = notificationMap.get(child.getType()); + tempHongBaoOrder.getCommonOrder().setPayment( + tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment())); + tempHongBaoOrder.getHongBaoV2() + .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(childUpdate.getMoney())); + notificationMap.put(child.getType(), tempHongBaoOrder); + } + + } } else throw new HongBaoException(2, "type閿欒"); @@ -802,7 +833,6 @@ } } } - } HongBaoV2 hongBao = new HongBaoV2(); @@ -849,6 +879,56 @@ tempHongBaoOrder.getHongBaoV2() .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney())); notificationMap.put(type, tempHongBaoOrder); + } + + // 4鏈�17鏃ュ悗鎵嶆湁涓�绾у垎浜禋 + if (commonOrder.getThirdCreateTime().getTime() > TimeUtil.convertToTimeTemp("2019-04-17", "yyyy-MM-dd")) { + UserInfo boss = threeSaleSerivce.getBoss(hongBao.getUserInfo().getId()); + if (boss != null) { + BigDecimal firstLevelRate = hongBaoManageService.getFirstShareRate(1, + commonOrder.getThirdCreateTime().getTime()); + HongBaoV2 child = new HongBaoV2(); + child.setParent(hongBao); + child.setType(HongBaoV2.TYPE_SHARE_YIJI); + if (commonOrder.getState() == CommonOrder.STATE_FK) { + child.setState(HongBaoV2.STATE_BUKELINGQU); + child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), + firstLevelRate.divide(new BigDecimal(100)))); + } else if (commonOrder.getState() == CommonOrder.STATE_JS) { + child.setState(HongBaoV2.STATE_KELINGQU); + child.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), + firstLevelRate.divide(new BigDecimal(100)))); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(commonOrder.getSettleTime()); + calendar.add(Calendar.MONTH, 1); + child.setPreGetTime(new Date(TimeUtil.convertToTimeTemp( + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25", + "yyyy-M-dd"))); + } + child.setUserInfo(boss); + child.setUrank(boss.getRank()); + child.setVersion(2); + child.setCreateTime(new Date()); + hongBaoV2Mapper.insertSelective(child); + // 娣诲姞閫氱煡 + if (notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI) == null) { + HongBaoV2 tempHongBao = new HongBaoV2(child.getId()); + tempHongBao.setUserInfo(child.getUserInfo()); + tempHongBao.setMoney(child.getMoney()); + tempHongBao.setBeizhu(hongBao.getUserInfo().getNickName()); + CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId()); + tempCommonOrder.setPayment(commonOrder.getPayment()); + notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, new HongBaoOrder(tempCommonOrder, tempHongBao)); + } else { + // 澧炲姞浠樻閲戦涓庤祫閲� + HongBaoOrder tempHongBaoOrder = notificationMap.get(HongBaoV2.TYPE_SHARE_YIJI); + tempHongBaoOrder.getCommonOrder().setPayment( + tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment())); + tempHongBaoOrder.getHongBaoV2() + .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney())); + notificationMap.put(HongBaoV2.TYPE_SHARE_YIJI, tempHongBaoOrder); + } + } } // 淇敼缁熻鏁版嵁 @@ -943,4 +1023,9 @@ else return money; } + + @Override + public List<HongBaoV2> listChildrenById(Long id){ + return hongBaoV2Mapper.listChildrenById(id); + } } -- Gitblit v1.8.0