luodangjia
2025-01-17 d0b043b8fa5f19d1295cac50fece0c65fceb3920
Merge remote-tracking branch 'origin/master'
4个文件已修改
104 ■■■■■ 已修改文件
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -92,46 +92,48 @@
        byId.setStatus(status);
        byId.setRemark(remark);
        agentApplicationService.updateById(byId);
        AppUser byId1 = appUserService.getById(byId.getAppUserId());
        //插入等级变化数据
        UserChangeLog userChangeLog = new UserChangeLog();
        userChangeLog.setCreateTime(LocalDateTime.now());
        userChangeLog.setAppUserId(byId.getAppUserId());
        userChangeLog.setBeforeVipId(byId1.getVipId());
        userChangeLog.setAfterVipId(byId.getApplicationVipId());
        if (userChangeLog.getBeforeVipId()>userChangeLog.getAfterVipId()) {
            userChangeLog.setChangeType(0);
        }else {
            userChangeLog.setChangeType(1);
        }
        userChangeLogService.save(userChangeLog);
        //变更会员等级
        byId1.setVipId(byId.getApplicationVipId());
        // 当用户为合伙人时,计算合伙人积分和培育积分
        Integer vipId = byId1.getVipId();
        if (vipId == 7){
            R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1);
            BaseSetting data = baseSetting.getData();
            int basePoint = Integer.parseInt(data.getContent());
            // 当前用户计算合伙人积分
            R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId);
            Integer point = getPoint(vipSetting, byId1, basePoint);
            byId1.setPartPoint(point);
            // 上级计算培育积分
            R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(2);
            BaseSetting data2 = baseSetting2.getData();
            int basePoint2 = Integer.parseInt(data2.getContent());
            Long inviteUserId = byId1.getInviteUserId();
            AppUser byId2 = appUserService.getById(inviteUserId);
            if (byId2 != null){
                Integer point1 = getPoint(vipSetting, byId2, basePoint2);
                byId2.setPartGrowPoint(point1);
                appUserService.updateById(byId2);
        if(2 == status){
            AppUser byId1 = appUserService.getById(byId.getAppUserId());
            //插入等级变化数据
            UserChangeLog userChangeLog = new UserChangeLog();
            userChangeLog.setCreateTime(LocalDateTime.now());
            userChangeLog.setAppUserId(byId.getAppUserId());
            userChangeLog.setBeforeVipId(byId1.getVipId());
            userChangeLog.setAfterVipId(byId.getApplicationVipId());
            if (userChangeLog.getBeforeVipId()>userChangeLog.getAfterVipId()) {
                userChangeLog.setChangeType(0);
            }else {
                userChangeLog.setChangeType(1);
            }
            userChangeLogService.save(userChangeLog);
            //变更会员等级
            byId1.setVipId(byId.getApplicationVipId());
            // 当用户为合伙人时,计算合伙人积分和培育积分
            Integer vipId = byId1.getVipId();
            if (vipId == 7){
                R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1);
                BaseSetting data = baseSetting.getData();
                int basePoint = Integer.parseInt(data.getContent());
                // 当前用户计算合伙人积分
                R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId);
                Integer point = getPoint(vipSetting, byId1, basePoint);
                byId1.setPartPoint(point);
                // 上级计算培育积分
                R<BaseSetting> baseSetting2 = baseSettingClient.getBaseSetting(2);
                BaseSetting data2 = baseSetting2.getData();
                int basePoint2 = Integer.parseInt(data2.getContent());
                Long inviteUserId = byId1.getInviteUserId();
                AppUser byId2 = appUserService.getById(inviteUserId);
                if (byId2 != null){
                    Integer point1 = getPoint(vipSetting, byId2, basePoint2);
                    byId2.setPartGrowPoint(point1);
                    appUserService.updateById(byId2);
                }
            }
            appUserService.updateById(byId1);
        }
        appUserService.updateById(byId1);
        return R.ok(byId);
    }
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -898,13 +898,20 @@
        Long userid = tokenService.getLoginUserApplet().getUserid();
        Object cacheObject = redisService.getCacheObject("ONLINE_" + userid);
        if(null == cacheObject){
            redisService.setCacheObject("ONLINE_" + userid, System.currentTimeMillis(), 1L, TimeUnit.HOURS);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("time", System.currentTimeMillis());
            jsonObject.put("online", 0);
            redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS);
        }else{
            Long duration = (Long) cacheObject;
            long time = (System.currentTimeMillis() - duration) / 3600000;
            JSONObject jsonObject = (JSONObject) cacheObject;
            long time = System.currentTimeMillis() - jsonObject.getInteger("time");
            Integer online = jsonObject.getInteger("online");
            online += 10;
            //满足一个小时,开始发放积分,计时归0
            if(1 >= time){
                redisService.setCacheObject("ONLINE_" + userid, System.currentTimeMillis(), 1L, TimeUnit.HOURS);
            if(time >= 3600000L && 60 <= online){
                jsonObject.put("time", System.currentTimeMillis());
                jsonObject.put("online", 0);
                redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS);
                AppUser appUser = this.getById(userid);
                PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
                if(null != pointSetting){
@@ -937,6 +944,9 @@
                    //变更等级
                    vipUpgrade(appUser.getId());
                }
            }else{
                jsonObject.put("online", online);
                redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS);
            }
        }
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/OrderActivityInfoController.java
@@ -138,9 +138,11 @@
                    .between(OrderActivityInfo::getEndTime, orderActivityInfo.getStartTime(), orderActivityInfo.getEndTime())
                    .list();
            // 遍历集合 通过startTime和endTime 判断是否与当前活动时间重叠
            if (!list.isEmpty()){
                for (OrderActivityInfo activityInfo : list) {
                    if(activityInfo.getId().equals(orderActivityInfo.getId())){
                        continue;
                    }
                    List<String> vips = Arrays.asList(activityInfo.getVipIds().split(","));
                    if (!vipIds.isEmpty()){
                        StringBuilder message = new StringBuilder();
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -230,7 +230,7 @@
        LocalDateTime endTime = seckillActivityInfo.getEndTime();
        long count = this.count(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodId).eq(SeckillActivityInfo::getDelFlag, 0)
                .eq(SeckillActivityInfo::getIsShelves, 1).last(" and (" + startTime + " between start_time and end_time or " + endTime + " between start_time and end_time)"));
        if(0 < count){
        if(1 < count){
            throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在");
        }
        this.baseMapper.updateById(seckillActivityInfo);