| | |
| | | @PostMapping("/app/login") |
| | | public R<AppLoginUser> appLogin(@Validated @RequestBody AppLoginBody body) { |
| | | AppLoginUser appLoginUser = sysLoginService.appLogin(body); |
| | | Long appUserId = appLoginUser.getAppUserId(); |
| | | AppUser data = remoteAppUserService.getAppUserById(appUserId + "").getData(); |
| | | if (data.getUserStatus() == 2){ |
| | | return R.fail("您的账号已被冻结"); |
| | | } |
| | | return R.ok(tokenService.createToken4AppLoginUser(appLoginUser)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/app/captchaLogin") |
| | | public R<AppLoginUser> appCaptchaLogin(@Validated @RequestBody AppCaptchaBody body) { |
| | | AppLoginUser appLoginUser = sysLoginService.appCaptchaLogin(body); |
| | | Long appUserId = appLoginUser.getAppUserId(); |
| | | AppUser data = remoteAppUserService.getAppUserById(appUserId + "").getData(); |
| | | if (data.getUserStatus() == 2){ |
| | | return R.fail("您的账号已被冻结"); |
| | | } |
| | | return R.ok(tokenService.createToken4AppLoginUser(appLoginUser)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/app/wxLogin") |
| | | public R<AppLoginUser> thirdLogin(@Validated @RequestBody AppWXLoginBody body) { |
| | | AppLoginUser appLoginUser = sysLoginService.wxLogin(body); |
| | | Long appUserId = appLoginUser.getAppUserId(); |
| | | AppUser data = remoteAppUserService.getAppUserById(appUserId + "").getData(); |
| | | if (data.getUserStatus() == 2){ |
| | | return R.fail("您的账号已被冻结"); |
| | | } |
| | | return R.ok(tokenService.createToken4AppLoginUser(appLoginUser)); |
| | | } |
| | | |
| | |
| | | @RequestParam(value = "device", required = true) String device |
| | | ) { |
| | | AppLoginUser appLoginUser = sysLoginService.appleLogin(appleId,device); |
| | | Long appUserId = appLoginUser.getAppUserId(); |
| | | AppUser data = remoteAppUserService.getAppUserById(appUserId + "").getData(); |
| | | if (data.getUserStatus() == 2){ |
| | | return R.fail("您的账号已被冻结"); |
| | | } |
| | | return R.ok(tokenService.createToken4AppLoginUser(appLoginUser)); |
| | | } |
| | | |
| | |
| | | import com.xinquan.course.domain.CourseLearningRecord; |
| | | import com.xinquan.course.service.CourseChapterService; |
| | | import com.xinquan.course.service.CourseLearningRecordService; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | } |
| | | for (CourseChapter record : page.getRecords()) { |
| | | record.setUid(record.getId()+""); |
| | | int size = courseLearningRecordService.lambdaQuery() |
| | | .eq(CourseLearningRecord::getChapterId, record.getId()).list().size(); |
| | | record.setRealLearnedNum(size); |
| | | int a = 0; |
| | | int b = 0; |
| | | a+= record.getVirtualLearnedNum(); |
| | | Long data1 = remoteAppUserService.getCourseChapterHistoryCount(record.getId()).getData(); |
| | | b+=data1; |
| | | record.setRealLearnedNum(a+b); |
| | | } |
| | | |
| | | return R.ok(PageDTO.of(page, CourseChapter.class)); |
| | |
| | | homeBackgroundMusic.setCreateTime(LocalDateTime.now()); |
| | | return R.ok(courseChapterService.save(homeBackgroundMusic)); |
| | | } |
| | | @Resource |
| | | private RemoteAppUserService remoteAppUserService; |
| | | @GetMapping("/detailCourseChapter") |
| | | @ApiOperation(value = "查看详情章节管理", tags = "管理后台-章节管理") |
| | | public R<CourseChapter> detailCourseChapter(String uid) { |
| | | CourseChapter byId = courseChapterService.getById(uid); |
| | | int size = courseLearningRecordService.lambdaQuery() |
| | | .eq(CourseLearningRecord::getChapterId, byId.getId()).list().size(); |
| | | byId.setRealLearnedNum(size); |
| | | int a = 0; |
| | | int b = 0; |
| | | a+= byId.getVirtualLearnedNum(); |
| | | Long data1 = remoteAppUserService.getCourseChapterHistoryCount(byId.getId()).getData(); |
| | | b+=data1; |
| | | byId.setRealLearnedNum(a+b); |
| | | return R.ok(byId); |
| | | } |
| | | @PostMapping("/updateCourseChapter") |
| | |
| | | courseLambdaQueryWrapper.eq(dto.getChargeType()!=null,Meditation::getChargeType, dto.getChargeType()); |
| | | courseLambdaQueryWrapper.eq(dto.getCateId()!=null,Meditation::getCateId, dto.getCateId()); |
| | | courseLambdaQueryWrapper.like(dto.getMeditationTitle()!=null&& !dto.getMeditationTitle().isEmpty(),Meditation::getMeditationTitle, dto.getMeditationTitle()); |
| | | courseLambdaQueryWrapper.orderByDesc(Meditation::getSortNum); |
| | | courseLambdaQueryWrapper.orderByDesc(Meditation::getCreateTime); |
| | | Page<Meditation> page = meditationService.page(new Page<>(dto.getPageCurr(), dto.getPageSize()), courseLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | |
| | | // 将以前的删掉 |
| | | meditationEverydayService.remove(new LambdaQueryWrapper<MeditationEveryday>() |
| | | .eq(MeditationEveryday::getId,homeBackgroundMusic.getEverydayId())); |
| | | meditationTagService.remove(new LambdaQueryWrapper<>(MeditationTag.class) |
| | | .eq(MeditationTag::getMeditationId,homeBackgroundMusic.getId())); |
| | | }else if (homeBackgroundMusic.getIsEveryday() == 1){ |
| | | meditationEverydayService.remove(new LambdaQueryWrapper<MeditationEveryday>() |
| | | .eq(MeditationEveryday::getId,homeBackgroundMusic.getEverydayId())); |
| | |
| | | |
| | | import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.domain.MeditationEveryday; |
| | | import com.xinquan.meditation.domain.MeditationEveryday; |
| | | import com.xinquan.meditation.domain.MeditationTag; |
| | | import com.xinquan.meditation.service.MeditationEverydayService; |
| | | import com.xinquan.meditation.service.MeditationEverydayService; |
| | | import com.xinquan.meditation.service.MeditationService; |
| | | import com.xinquan.meditation.service.MeditationTagService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private MeditationEverydayService meditationEverydayService; |
| | | @Autowired |
| | | private MeditationService meditationService; |
| | | @Autowired |
| | | private MeditationTagService meditationTagService; |
| | | @PostMapping("/meditationCategoryManagementList") |
| | | @ApiOperation(value = "每日冥想库列表-分页", tags = {"管理后台-每日冥想库管理"}) |
| | | @ApiImplicitParams({ |
| | |
| | | @PostMapping("/deleteMeditationEveryday") |
| | | @ApiOperation(value = "批量删除", tags = "管理后台-每日冥想库管理") |
| | | public R deleteMeditationEveryday(String ids) { |
| | | List<Long> list = Arrays.asList(ids.split(",")).stream().map(Long::valueOf).collect(Collectors.toList()); |
| | | List<MeditationEveryday> list1 = meditationEverydayService.lambdaQuery().in(MeditationEveryday::getId, list).list(); |
| | | for (MeditationEveryday l : list1) { |
| | | Meditation byId = meditationService.getById(l.getMeditationId()); |
| | | if (byId!=null){ |
| | | byId.setIsEveryday(2); |
| | | meditationService.updateById(byId); |
| | | meditationTagService.remove(new LambdaQueryWrapper<>(MeditationTag.class) |
| | | .eq(MeditationTag::getMeditationId,byId.getId())); |
| | | } |
| | | } |
| | | return R.ok(meditationEverydayService.removeBatchByIds(Arrays.asList(ids.split(",")).stream().map(Long::valueOf).collect(Collectors.toList()))); |
| | | } |
| | | } |
| | |
| | | for (SysUserVO record : list.getRecords()) { |
| | | List<Long> collect1 = sysUserRoleService.lambdaQuery().eq(SysUserRole::getUserId, record.getUserId()) |
| | | .list().stream().map(SysUserRole::getRoleId).collect(Collectors.toList()); |
| | | record.setRole(collect1); |
| | | List<Long> longs1 = new ArrayList<>(); |
| | | for (Long l : collect1) { |
| | | SysRole sysDept = roleService.selectRoleById(l); |
| | | if (sysDept!=null){ |
| | | longs1.add(sysDept.getRoleId()); |
| | | } |
| | | } |
| | | record.setRole(longs1); |
| | | List<String> strings1 = new ArrayList<>(); |
| | | if (record.getRole()!=null && (!record.getRole().isEmpty())){ |
| | | for (Long l : collect1) { |
| | |
| | | record.setRoleNames(strings1); |
| | | List<Long> collect2 = sysUserDeptService.lambdaQuery().eq(SysUserDept::getUserId, record.getUserId()) |
| | | .list().stream().map(SysUserDept::getDeptId).collect(Collectors.toList()); |
| | | record.setDeptIds(collect2); |
| | | List<Long> longs2 = new ArrayList<>(); |
| | | for (Long l : collect2) { |
| | | SysDept sysDept = deptService.selectDeptById(l); |
| | | if (sysDept!=null){ |
| | | longs2.add(sysDept.getDeptId()); |
| | | } |
| | | } |
| | | record.setDeptIds(longs2); |
| | | List<String> strings = new ArrayList<>(); |
| | | if (record.getDeptIds()!=null && (!record.getDeptIds().isEmpty())){ |
| | | for (Long deptId : record.getDeptIds()) { |
| | |
| | | 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); |
| | |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("【会员临期通知】"); |
| | | noticeRecord.setContent("尊敬的心泉疗愈会员你好,你的会员即将在" |
| | | noticeRecord.setContent("尊敬的泉疗愈会员你好,你的会员即将在" |
| | | +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费"); |
| | | noticeRecordService.save(noticeRecord); |
| | | } |
| | |
| | | List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery() |
| | | .eq(AppUserViewingHistory::getChapterId, id) |
| | | .eq(AppUserViewingHistory::getViewingType, 2) |
| | | .groupBy(AppUserViewingHistory::getAppUserId) |
| | | .list(); |
| | | return R.ok(Long.valueOf(list.size())); |
| | | } |
| | |
| | | long between = ChronoUnit.DAYS.between(LocalDateTime.now(),localDateTime); |
| | | System.err.println(between); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 7 * * ?") |
| | | public void taskSivenDay() { |
| | | try { |
| | |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("【会员临期通知】"); |
| | | noticeRecord.setContent("尊敬的心泉疗愈会员你好,你的会员即将在" |
| | | noticeRecord.setContent("尊敬的泉疗愈会员你好,你的会员即将在" |
| | | +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费"); |
| | | noticeRecordService.save(noticeRecord); |
| | | } |