From 8870f82f07541e27dc6b94b310070625ff9cc6ff Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 14 十一月 2019 15:18:28 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java | 56 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 29 insertions(+), 27 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java index d16ce64..c85b54a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java @@ -14,6 +14,7 @@ import com.yeshi.fanli.dao.mybatis.redpack.RedPackWinInviteMapper; import com.yeshi.fanli.dto.msg.MsgRedPackAddContentDTO; import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum; +import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; @@ -90,28 +91,29 @@ } - @RedPackGetVersionLimit(uid = "#uid") @RequestSerializableByKeyService(key = "#uid") @Transactional(rollbackFor = Exception.class) @Override public void orderArriveReward(Long uid, Integer source, String orderNo) throws Exception { - if (uid == null || source == null || orderNo == null) + if (uid == null || source == null || StringUtil.isNullOrEmpty(orderNo)) return; - // 涓婁竴绾х殑濂栧姳 - UserInfo boss = threeSaleSerivce.getBoss(uid); - if(boss != null) { - UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(boss.getId()); - if (activeLog == null) - return; + ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(uid, Constant.RED_PACK_REWARD_TIME); + if(threeSale == null) + return; - // 灏忎簬2.0.2鐗堟湰涓嶅鍔� - if (!VersionUtil.greaterThan_2_0_2("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", - activeLog.getVersionCode())) - return; - - bossReward(boss.getId(), uid, source, orderNo); - } + Long bossId = threeSale.getBoss().getId(); + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId); + if (activeLog == null) + return; + + // 灏忎簬2.0.2鐗堟湰涓嶅鍔� + if (!VersionUtil.greaterThan_2_0_2("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", + activeLog.getVersionCode())) + return; + + // 濂栧姳涓婄骇 + bossReward(bossId, uid, source, orderNo); } @@ -123,7 +125,6 @@ * @param orderNo * @throws Exception */ - @RedPackGetVersionLimit(uid = "#uid") @Transactional private void bossReward(Long uid, Long teamUid, Integer source, String orderNo) throws Exception { firstSharedOrderRewardToBoss(uid, teamUid, source, orderNo); @@ -212,7 +213,7 @@ // 绗竴娆″埌璐︾殑娆℃湀寮�濮嬭繛缁�15涓湀 鑷劧鏈堣幏寰楋紙宸插埌璐︼級 int monthSpace = DateUtil.getMonthSpace( order.getAccountTime(), firstorder.getAccountTime()); - if (monthSpace == 0 || monthSpace > Constant.RED_PACK_REWARd_MONTH) + if (monthSpace == 0 || monthSpace > Constant.RED_PACK_REWARD_MONTH) return; @@ -247,16 +248,17 @@ @Override - @RedPackGetVersionLimit(uid = "#uid") @RequestSerializableByKeyService(key = "#uid") @Transactional(rollbackFor = Exception.class) public void inviteSucceedReward(Long uid) throws Exception{ // 楠岃瘉鏄惁瀛樺湪涓婄骇 - UserInfo boss = threeSaleSerivce.getBoss(uid); - if(boss == null) + ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(uid, Constant.RED_PACK_REWARD_TIME); + if (threeSale == null) return; - - UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(boss.getId()); + // 涓婄骇id + Long bossId = threeSale.getBoss().getId(); + + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId); if (activeLog == null) return; @@ -266,7 +268,7 @@ return; // 鍚屼竴闃熷憳濂栧姳涓�娆� - long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(boss.getId(), uid, RedPackWinInviteTypeEnum.inviteSucceed.name()); + long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, uid, RedPackWinInviteTypeEnum.inviteSucceed.name()); if (totalReward > 0) return; @@ -310,20 +312,20 @@ winInvite.setCreateTime(new Date()); winInvite.setUpdateTime(new Date()); winInvite.setType(RedPackWinInviteTypeEnum.inviteSucceed); - winInvite.setUid(boss.getId()); + winInvite.setUid(bossId); winInvite.setTeamUid(uid); winInvite.setMoney(money); redPackWinInviteMapper.insertSelective(winInvite); // 澧炲姞绾㈠寘 - redPackBalanceService.addRedPack(boss.getId(), money, RedPackDetailFactory.createInvite(winInvite)); + redPackBalanceService.addRedPack(bossId, money, RedPackDetailFactory.createInvite(winInvite)); // 娑堟伅 MsgRedPackAddContentDTO dto = new MsgRedPackAddContentDTO(); dto.setTitle("绾㈠寘澧炲姞"); dto.setMoney("楼" + money.setScale(2)); - dto.setBalance("楼" + redPackBalanceService.getBalance(boss.getId()).setScale(2)); - userMoneyMsgNotificationService.redPackMsg(boss.getId(), MsgTypeMoneyTypeEnum.redPackInviteSucceed, + dto.setBalance("楼" + redPackBalanceService.getBalance(bossId).setScale(2)); + userMoneyMsgNotificationService.redPackMsg(bossId, MsgTypeMoneyTypeEnum.redPackInviteSucceed, new Gson().toJson(dto), "璇峰埌鈥滄垜鐨�-绾㈠寘鈥濅腑鏌ョ湅"); } } -- Gitblit v1.8.0