From bcd889ab421166d31bc2f54a295d1174b722a3a3 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 12 十一月 2019 17:16:11 +0800 Subject: [PATCH] 版本区分 --- fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java | 76 ++++++++++++------------------------- 1 files changed, 25 insertions(+), 51 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 31d1d4a..479b4fe 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 @@ -12,8 +12,10 @@ import com.google.gson.Gson; import com.yeshi.fanli.dao.mybatis.redpack.RedPackWinInviteMapper; +import com.yeshi.fanli.dto.mq.user.body.UserAccountBindingMQMsg; import com.yeshi.fanli.dto.msg.MsgRedPackAddContentDTO; import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum; +import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.order.CommonOrder; @@ -24,6 +26,7 @@ import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService; import com.yeshi.fanli.service.inter.redpack.RedPackConfigService; import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService; +import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; @@ -31,6 +34,7 @@ import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService; import com.yeshi.fanli.util.annotation.redpack.RedPackGetVersionLimit; import com.yeshi.fanli.util.factory.RedPackDetailFactory; @@ -66,6 +70,9 @@ @Resource private IntegralTaskRecordService integralTaskRecordService; + @Resource + private UserActiveLogService userActiveLogService; + @Override public List<RedPackWinInvite> getRewardList(int start, int count, Long uid) { @@ -78,6 +85,12 @@ return redPackWinInviteMapper.countRewardRecord(uid); } + @Override + public BigDecimal getRewardMoney(Long uid) { + return redPackWinInviteMapper.getRewardMoney(uid); + } + + @RedPackGetVersionLimit(uid = "#uid") @RequestSerializableByKeyService(key = "#uid") @Transactional(rollbackFor = Exception.class) @@ -89,7 +102,15 @@ // 涓婁竴绾х殑濂栧姳 UserInfo boss = threeSaleSerivce.getBoss(uid); if(boss != null) { - firstReward(uid, source, orderNo); + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(boss.getId()); + if (activeLog != null) { + // 灏忎簬2.0.2鐗堟湰涓嶅鍔犵Н鍒� + if (!VersionUtil.greaterThan_2_0_2("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", + activeLog.getVersionCode())) + return; + } + + bossReward(boss.getId(), uid, source, orderNo); } } @@ -109,54 +130,6 @@ firstSharedOrderRewardToBoss(uid, teamUid, source, orderNo); firstSharedOrderRewardTheMonthToBoss(uid, teamUid, source, orderNo); } - - - /** - * 琚個璇蜂汉涓嬮鍗曡繑鍒╋紙涓嬪崟灏辩粰锛夛細 - * 瀹屾垚棣栫瑪璁㈠崟 锛堝凡鍒拌处锛� 棣栧崟=涓嶉檺鍒堕噾棰濄�佷笉闄愬埗鍟嗗搧銆佷笉闄愬埗鏁伴噺銆佷笉闄愬埗璁㈠崟绫诲瀷锛� - * @param uid - * @param source - * @param orderNo - * @param bossId - */ - @Transactional - private void firstReward(Long uid, Integer source, String orderNo) throws Exception{ - // 濂栧姳涓�娆� - long total = redPackWinInviteMapper.countByUidAndType(uid, RedPackWinInviteTypeEnum.newUserReward.name()); - if (total > 0) - return; - - // 1銆佸垽鏂槸鍚︾敤鎴烽涓鍗� - CommonOrderVO order = commonOrderService.firstValidOrderByUid(uid); - if (order == null || source != order.getSourceType() || !orderNo.equals(order.getOrderNo())) - return; - - // 閲戦 - BigDecimal money = new BigDecimal(redPackConfigService.getValueByKey("new_user_first_order")); - - // 3銆佽幏寰楃孩鍖呰褰� - RedPackWinInvite winInvite = new RedPackWinInvite(); - winInvite.setCreateTime(new Date()); - winInvite.setUpdateTime(new Date()); - winInvite.setType(RedPackWinInviteTypeEnum.newUserReward); - winInvite.setUid(uid); - winInvite.setTeamUid(null); - winInvite.setMoney(money); - winInvite.setSource(source); - winInvite.setOrderNo(orderNo); - redPackWinInviteMapper.insertSelective(winInvite); - - // 4銆佸鍔犵孩鍖� - redPackBalanceService.addRedPack(uid, money, RedPackDetailFactory.createNewUserReward(winInvite)); - - //娑堟伅 - MsgRedPackAddContentDTO dto = new MsgRedPackAddContentDTO(); - dto.setTitle("绾㈠寘澧炲姞"); - dto.setMoney("楼" + money.setScale(2)); - dto.setBalance("楼" + redPackBalanceService.getBalance(uid).setScale(2)); - userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackNewUserReward, new Gson().toJson(dto), "绾㈠寘鍙敤浜庤喘涔颁細鍛�"); - } - /** * 涓婄骇濂栧姳锛氳閭�璇蜂汉瀹屾垚棣栫瑪鍒嗕韩璁㈠崟 锛堝凡鍒拌处锛� @@ -272,9 +245,10 @@ } - @RequestSerializableByKeyService(key = "#uid") @Override - @Transactional + @RedPackGetVersionLimit(uid = "#uid") + @RequestSerializableByKeyService(key = "#uid") + @Transactional(rollbackFor = Exception.class) public void inviteSucceedReward(Long uid) throws Exception{ // 楠岃瘉鏄惁瀛樺湪涓婄骇 UserInfo boss = threeSaleSerivce.getBoss(uid); -- Gitblit v1.8.0