From 393e3a365b5ebbed6e9eef07fbd18881cde73711 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期六, 28 三月 2020 16:51:04 +0800 Subject: [PATCH] Merge branch 'div' into div-1 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java | 106 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 65 insertions(+), 41 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java index 15c0c11..b7f9e41 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java @@ -50,6 +50,7 @@ import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; @Service @@ -92,14 +93,12 @@ @Lazy @Resource private UserSystemCouponService userSystemCouponService; - + @Resource private UserVIPPreInfoService userVIPPreInfoService; - + @Resource private MsgAccountDetailService msgAccountDetailService; - - @Override @Transactional(rollbackFor = Exception.class) @@ -205,7 +204,7 @@ userInviteSeparateService.updateStateByWorkerIdAndBossId(uid, bossId, UserInviteSeparate.STATE_INVALID); // 闄愬埗鏃堕棿 - int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey())); + int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days")); UserInviteSeparate inviteSeparate = new UserInviteSeparate(); inviteSeparate.setBossId(bossId); inviteSeparate.setWorkerId(uid); @@ -271,8 +270,14 @@ @Override public boolean isVIP(Long uid) { + return isVIP(uid, System.currentTimeMillis()); + } + + @Override + public boolean isVIP(Long uid, Long time) { UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKey(uid); - if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS) + if (userInfo != null && userInfo.getState() == UserVIPInfo.STATE_SUCCESS + && userInfo.getSuccessTime().getTime() < time) return true; else return false; @@ -315,29 +320,26 @@ // 1銆佺洿鎺ョ矇涓濓紙浠� 2020 骞� 1 鏈� 1 鏃ヨ捣鐩存帴绮変笣浜х敓鏈夋晥璁㈠崟锛� BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay")); -// long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, -// TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney); + // long teamNum = + // hongBaoV2CountService.countValidOrderTeamUserByUid(uid, + // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney); long teamNum = 0L; long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME); List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin); if (listThreeSale != null && listThreeSale.size() > 0) { - for (ThreeSale three: listThreeSale) { + for (ThreeSale three : listThreeSale) { UserInfo worker = three.getWorker(); if (worker == null || worker.getId() == null) { continue; } // 1銆侀個璇峰叧绯绘垚鍔熷悗锛�2銆佸崟锛堝垎浜� + 鑷喘锛夊疄浠樻澶т簬1鍏� - long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney); + long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), + three.getSucceedTime(), payMoney); if (countValid > 0) { - teamNum ++; + teamNum++; } } } - - - - - // 鍖哄垎鑰佺敤鎴峰拰鏂扮敤鎴� String limtDate = userVipConfigService.getValueByKey("vip_execute_time"); @@ -438,7 +440,7 @@ // 鑴辩閭�璇峰叧绯� threeSaleSerivce.inviteSeparate(workerId, bossId); - int limitDays = Integer.parseInt(configService.get(ConfigKeyEnum.inviteSeparateLimitDays.getKey())); + int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days")); // 娑堟伅 UserInfo userInfo = userInfoService.selectByPKey(workerId); MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO(); @@ -450,18 +452,17 @@ } } - @Transactional(rollbackFor = Exception.class) @Override public void applyVIPNew(Long uid) throws UserVIPInfoException { UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid); if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) { throw new UserVIPInfoException(1, "璇ョ敤鎴疯繕涓嶆槸楂樼骇浼氬憳"); - } - + } + if (!verifyVipNew(uid)) throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢"); - + UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid); if (userInfo == null) { userInfo = new UserVIPInfo(); @@ -479,8 +480,7 @@ info.setState(UserVIPInfo.STATE_VERIFING); info.setUpdateTime(new Date()); userVIPInfoMapper.updateByPrimaryKeySelective(info); - - + MsgAccountDetail detail = new MsgAccountDetail(); detail.setTitle("灏婃暚鐨勯珮绾т細鍛橈紝绯荤粺宸叉敹鍒颁綘鐨勮秴绾т細鍛樺崌绾х敵璇凤紝姝e湪鍙楃悊涓�"); detail.setBeiZhu("濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇"); @@ -495,9 +495,7 @@ e.printStackTrace(); } } - - - + @Transactional(rollbackFor = Exception.class) @Override public void passVIPApplyNew(Long uid) throws UserVIPInfoException { @@ -508,15 +506,15 @@ if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) { throw new UserVIPInfoException(2, "鐢宠鏈浜庡鏍哥姸鎬�"); } - + UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid); if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) { throw new UserVIPInfoException(1, "璇ョ敤鎴疯繕涓嶆槸楂樼骇浼氬憳"); - } - + } + if (!verifyVipNew(uid)) throw new UserVIPInfoException(1, "绯荤粺楠岃瘉锛氫笉婊¤冻鍗囩骇鏉′欢"); - + // 棰濆淇℃伅 UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid); if (userInfoExtra == null) @@ -540,7 +538,7 @@ detail.setCreateTime(new Date()); detail.setUniqueKey("VIP-" + uid); integralDetailService.insertSelective(detail); - + try { // 濂栧姳鍒� BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey())); @@ -558,15 +556,13 @@ throw new UserVIPInfoException(1, "鍒歌禒閫佸け璐�"); } - // 娑堟伅 MsgAccountVipDTO msgDto = new MsgAccountVipDTO(); msgDto.setStatus("宸插皢浣犵殑璐︽埛鐢遍珮绾т細鍛樺崌绾т负瓒呯骇浼氬憳"); msgDto.setEquity("浠庢敹鍒版湰娑堟伅璧凤紝浣犲皢鑾峰緱鍏ㄩ儴瓒呯骇浼氬憳鏉冪泭"); msgAccountDetailService.addMsgVIP(uid, "鎭枩浣狅紒缁忎汉宸ュ鏍镐綘婊¤冻鍗囩骇瓒呯骇浼氬憳鏉′欢", "濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇", msgDto); } - - + /** * 楠岃瘉鏄惁绗﹀悎VIP * @param uid @@ -582,14 +578,37 @@ // 闃熷憳 long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1); long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1); - if (countZiGou >= Constant.VIP_PROCESS_3_ZIGOU || countShare >= Constant.VIP_PROCESS_3_SHARE - || (firstTeam >= Constant.VIP_PROCESS_3_TEAM && secondTeam >= Constant.VIP_PROCESS_3_TEAM_SECOND)) { + + long limitZiGou = 0; + String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count"); + if (!StringUtil.isNullOrEmpty(zigou)) { + limitZiGou = Long.parseLong(zigou); + } + + long limitShare = 0; + String share = userVipConfigService.getValueByKey("vip_pre_10_share_order_count"); + if (!StringUtil.isNullOrEmpty(share)) { + limitShare = Long.parseLong(share); + } + + long limitFirst = 0; + String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count"); + if (!StringUtil.isNullOrEmpty(first)) { + limitFirst = Long.parseLong(first); + } + + long limitSecond = 0; + String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count"); + if (!StringUtil.isNullOrEmpty(second)) { + limitSecond = Long.parseLong(second); + } + + if (countZiGou >= limitZiGou || countShare >= limitShare || (firstTeam >= limitFirst && secondTeam >= limitSecond)) { return true; - } + } return false; } - - + @Transactional(rollbackFor = Exception.class) @Override public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException { @@ -606,7 +625,12 @@ info.setState(UserVIPInfo.STATE_INVALID); info.setUpdateTime(new Date()); userVIPInfoMapper.updateByPrimaryKeySelective(info); - - // TODO娑堟伅 + + // 娑堟伅 + MsgAccountVipDTO msgDto = new MsgAccountVipDTO(); + msgDto.setStatus("浣犵殑璐﹀彿浠嶆槸楂樼骇浼氬憳"); + msgDto.setReason(reason); + msgAccountDetailService.addMsgVIP(uid, "寰堟姳姝夛紒缁忎汉宸ュ鏍镐綘鏈弧瓒虫垨涓嶇鍚堝崌绾ц秴绾т細鍛樼殑鏉′欢", "濡傛湁鐤戦棶璇疯仈绯绘垜鐨�-浜哄伐瀹㈡湇", msgDto); } + } -- Gitblit v1.8.0