ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AgentApplication.java
@@ -36,6 +36,10 @@ @ApiModelProperty(value = "用户id") @TableField("app_user_id") private Long appUserId; @ApiModelProperty(value = "当前vip") @TableField("vip_id") private Integer vipId; @ApiModelProperty(value = "申请类型 对应vip_id") @TableField("application_vip_id") @@ -94,8 +98,5 @@ @TableField(exist = false) private String idStr; @TableField(exist = false) private Integer vipId; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -49,6 +49,10 @@ private BaseSettingClient baseSettingClient; @Resource private VipCenterService vipCenterService; @Resource private VipSettingClient vipSettingClient; @Resource private UserChangeLogService userChangeLogService; @PostMapping("/apply") @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) @@ -61,16 +65,9 @@ @ApiOperation(value = "会员申请列表", tags = {"后台"}) public R<IPage<AgentApplication>> page(@RequestBody AgentQuery agentQuery) { IPage<AgentApplication> agentApplicationIPage = agentApplicationService.pageList(agentQuery); for (AgentApplication record : agentApplicationIPage.getRecords()) { AppUser byId = appUserService.getById(record.getAppUserId()); if (byId!=null){ record.setVipId(byId.getVipId()); } } return R.ok(agentApplicationIPage); } @Resource private VipSettingClient vipSettingClient; @GetMapping("/detail") @ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"}) public R<AgentApplication> detail(@RequestParam Long id) { @@ -82,31 +79,11 @@ VipSettingDto vipSettingDto = new VipSettingDto(); BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); agentApplication.setVipSettingDto(vipSettingDto); // List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() // .ne(AppUser::getStatus, 3) // .eq(AppUser::getDelFlag, 0)); // ArrayList<Long> userIds = new ArrayList<>(); // userIds.add(appUser.getId()); // getUserAncestorList(appUser,userIds,new ArrayList<>(),appUserList); agentApplication.setVipId(agentApplication.getApplicationVipId()); return R.ok(agentApplication); } public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(children)){ user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); getUserAncestorList(user,userIdList, children,list); } } @Resource private UserChangeLogService userChangeLogService; @GetMapping("/auth") @ApiOperation(value = "会员申请审核", tags = {"会员中心-小程序"}) ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java
@@ -47,52 +47,52 @@ @GetMapping("/saveAppUserShare") @ApiOperation(value = "操作分享调用接口", tags = {"小程序-推广中心"}) public R saveAppUserShare(){ Long userid = tokenService.getLoginUserApplet().getUserid(); AppUserShare appUserShare = appUserShareService.getOne(new LambdaQueryWrapper<AppUserShare>().eq(AppUserShare::getAppUserId, userid) .last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')")); if(null == appUserShare){ appUserShare = new AppUserShare(); appUserShare.setAppUserId(userid); appUserShare.setCreateTime(LocalDateTime.now()); appUserShareService.save(appUserShare); //添加用户分佣积分 AppUser appUser = appUserService.getById(userid); PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); if(null != pointSetting){ Integer everySharePoint = pointSetting.getEverySharePoint(); Integer everySharePoint1 = 0; if(1 == pointSetting.getWorkPointOpen()){ everySharePoint1 = new BigDecimal(everySharePoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); } Integer lavePoint = appUser.getLavePoint(); appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint); appUser.setLavePoint(appUser.getLavePoint() + everySharePoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + everySharePoint1); if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint1); } appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint); appUserService.updateById(appUser); //添加积分变动记录 if(everySharePoint > 0){ UserPoint userPoint = new UserPoint(); userPoint.setType(6); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(everySharePoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPointService.save(userPoint); } //变更等级 appUserService.vipUpgrade(appUser.getId()); } } return R.ok(); } // @GetMapping("/saveAppUserShare") // @ApiOperation(value = "操作分享调用接口", tags = {"小程序-推广中心"}) // public R saveAppUserShare(){ // Long userid = tokenService.getLoginUserApplet().getUserid(); // AppUserShare appUserShare = appUserShareService.getOne(new LambdaQueryWrapper<AppUserShare>().eq(AppUserShare::getAppUserId, userid) // .last(" and DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(create_time, '%Y-%m-%d')")); // if(null == appUserShare){ // appUserShare = new AppUserShare(); // appUserShare.setAppUserId(userid); // appUserShare.setCreateTime(LocalDateTime.now()); // appUserShareService.save(appUserShare); // // //添加用户分佣积分 // AppUser appUser = appUserService.getById(userid); // PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); // if(null != pointSetting){ // Integer everySharePoint = pointSetting.getEverySharePoint(); // Integer everySharePoint1 = 0; // if(1 == pointSetting.getWorkPointOpen()){ // everySharePoint1 = new BigDecimal(everySharePoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); // } // Integer lavePoint = appUser.getLavePoint(); // appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint); // appUser.setLavePoint(appUser.getLavePoint() + everySharePoint); // appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint1); // appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + everySharePoint1); // if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ // appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint1); // } // appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint); // appUserService.updateById(appUser); // //添加积分变动记录 // if(everySharePoint > 0){ // UserPoint userPoint = new UserPoint(); // userPoint.setType(4); // userPoint.setHistoricalPoint(lavePoint); // userPoint.setVariablePoint(everySharePoint); // userPoint.setBalance(appUser.getLavePoint()); // userPoint.setCreateTime(LocalDateTime.now()); // userPoint.setAppUserId(appUser.getId()); // userPointService.save(userPoint); // } // //变更等级 // appUserService.vipUpgrade(appUser.getId()); // } // } // return R.ok(); // } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AgentApplicationServiceImpl.java
@@ -60,6 +60,7 @@ throw new RuntimeException("已发起申请,请等待平台工作人员与您联系"); } agentApplication.setAppUserId(loginUserApplet.getUserid()); agentApplication.setVipId(appUser.getVipId()); agentApplication.setStatus(1); agentApplication.setApplicationTime(LocalDateTime.now()); agentApplication.setShopPoint(appUser.getShopPoint()); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -898,13 +898,13 @@ Long userid = tokenService.getLoginUserApplet().getUserid(); Object cacheObject = redisService.getCacheObject("ONLINE_" + userid); if(null == cacheObject){ redisService.setCacheObject("ONLINE_" + userid, 0, 15L, TimeUnit.MINUTES); redisService.setCacheObject("ONLINE_" + userid, System.currentTimeMillis(), 1L, TimeUnit.HOURS); }else{ Integer duration = (Integer) cacheObject; duration += 10; Long duration = (Long) cacheObject; long time = (System.currentTimeMillis() - duration) / 3600000; //满足一个小时,开始发放积分,计时归0 if(60 >= duration){ redisService.setCacheObject("ONLINE_" + userid, 0, 15L, TimeUnit.MINUTES); if(1 >= time){ redisService.setCacheObject("ONLINE_" + userid, System.currentTimeMillis(), 1L, TimeUnit.HOURS); AppUser appUser = this.getById(userid); PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); if(null != pointSetting){ @@ -937,8 +937,6 @@ //变更等级 vipUpgrade(appUser.getId()); } }else{ redisService.setCacheObject("ONLINE_" + userid, duration, 15L, TimeUnit.MINUTES); } } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -307,7 +307,8 @@ @ApiOperation(value = "获取小程序分享数据", tags = {"小程序-分享"}) @GetMapping("/auth/getAppletShare") public R<Share> getAppletShare(){ Share one = shareService.getOne(new LambdaQueryWrapper<Share>().eq(Share::getDelFlag, 0).eq(Share::getAppletShare, 1).eq(Share::getAuditStatus, 1).last(" limit 0, 1")); Share one = shareService.getOne(new LambdaQueryWrapper<Share>().eq(Share::getDelFlag, 0).eq(Share::getAppletShare, 1) .eq(Share::getAuditStatus, 1).last(" limit 0, 1")); //添加每日分享积分 String token = SecurityUtils.getToken(ServletUtils.getRequest()); if(StringUtils.isNotEmpty(token)){