无关风月
2024-11-15 353cf91d3679e68d9b8c07652e4f7791d606dbd4
xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserController.java
@@ -123,6 +123,29 @@
    private RemoteUserService remoteUserService;
    @Resource
    private NoticeRecordService noticeRecordService;
    @ApiOperation(value = "会员临期", tags = "会员临期")
    @PostMapping("/testVip")
    public void testVip() {
        LocalDateTime now = LocalDateTime.now();
        List<AppUser> list = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3).list();
        for (AppUser appUser : list) {
            if (appUser.getVipExpireTime()!=null && appUser.getVipExpireTime().isAfter(now)){
                // 计算两个now和time的天数差
                long between = ChronoUnit.DAYS.between(now,appUser.getVipExpireTime());
                if (between<=7 &&between>=0){
                    NoticeRecord noticeRecord = new NoticeRecord();
                    noticeRecord.setAppUserId(appUser.getId());
                    noticeRecord.setReadStatus(1);
                    noticeRecord.setNoticeType(1);
                    noticeRecord.setTitle("【会员临期通知】");
                    noticeRecord.setContent("尊敬的泉疗愈会员你好,你的会员即将在"
                            +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费");
                    noticeRecordService.save(noticeRecord);
                }
            }
        }
    }
    @GetMapping("/deleteBalance/{id}/{amount}")
    public R deleteBalance(@PathVariable("id")String id,@PathVariable("amount")String amount) {
        AppUser byId = appUserService.getById(id);
@@ -149,7 +172,7 @@
                    noticeRecord.setReadStatus(1);
                    noticeRecord.setNoticeType(1);
                    noticeRecord.setTitle("【会员临期通知】");
                    noticeRecord.setContent("尊敬的心泉疗愈会员你好,你的会员即将在"
                    noticeRecord.setContent("尊敬的泉疗愈会员你好,你的会员即将在"
                            +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费");
                    noticeRecordService.save(noticeRecord);
                }
@@ -434,6 +457,7 @@
        SysUser data = remoteUserService.getSysUserById(userid + "").getData();
        byId.setFreezingOperator(data.getNickName()+"("+data.getUserName()+")");
        appUserService.updateById(byId);
        // 将被冻结的用户token清除
        return R.ok();
    }
    @GetMapping("/detail")
@@ -1176,7 +1200,7 @@
        page.sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney()));
        List<AppUser> testing = testing(page.size(), pageCurr, pageSize, page);
        objectPage.setTotal(testing.size());
        objectPage.setTotal(page.size());
        objectPage.setRecords(testing);
        return R.ok(PageDTO.of(objectPage, InviteRankListVO.class));
    }
@@ -1573,7 +1597,7 @@
                .ne(AppUser::getUserStatus,3).one();
        if (one!=null){
            if (one.getId().equals(loginUser.getUserid())){
                return R.fail("不可赠送给自己");
                return R.giveError("不能赠送给自己");
            }
            AppUserDetailVO appUserDetailVO = new AppUserDetailVO();
            appUserDetailVO.setId(one.getId());