1 文件已重命名
73个文件已修改
1个文件已添加
| | |
| | | @ApiModelProperty(value = "选择标签的ids 逗号拼接 ") |
| | | @TableField(exist = false) |
| | | private String tagIds; |
| | | @ApiModelProperty(value = "是否购买 1是2否") |
| | | @TableField(exist = false) |
| | | private Integer isBuy; |
| | | @ApiModelProperty(value = "背景音频 多个逗号拼接") |
| | | @TableField(exist = false) |
| | | private String musicUrls; |
| | |
| | | @ApiModelProperty(value = "查看详情回显使用 所选的标签ids") |
| | | @TableField(exist = false) |
| | | private List<Long> tagList; |
| | | @ApiModelProperty(value = "查看详情回显使用 所选的标签名称集合") |
| | | @TableField(exist = false) |
| | | private List<String> tagNameList; |
| | | |
| | | @ApiModelProperty(value = "冥想标题") |
| | | @TableField("meditation_title") |
File was renamed from xinquan-api/xinquan-api-system/src/main/java/com/xinquan/system/api/domain/MeditationQuestion.java |
| | |
| | | package com.xinquan.system.api.domain; |
| | | package com.xinquan.meditation.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | |
| | | @ApiModelProperty(value = "是否收藏 1=是 2=否") |
| | | @TableField("favorite") |
| | | private Integer favorite; |
| | | @ApiModelProperty(value = "1回复 2编辑") |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "提问内容") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "uid") |
| | | @TableField(exist = false) |
| | | private String uid; |
| | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | @TableField(exist = false) |
| | | private String cellPhone; |
| | | @ApiModelProperty(value = "提问内容") |
| | | @TableField("content") |
| | | private String content; |
| | | @ApiModelProperty(value = "回复内容") |
| | | @TableField("reply_content") |
| | | private String replyContent; |
| | | @ApiModelProperty(value = "疗愈封面图") |
| | | @TableField(exist = false) |
| | | private String coverUrl; |
| | | @ApiModelProperty(value = "疗愈名称") |
| | | @TableField(exist = false) |
| | | private String meditationName; |
| | |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "回复内容") |
| | | @TableField("reply_content") |
| | | private String replyContent; |
| | | |
| | | |
| | | @ApiModelProperty(value = "回复时间") |
| | | @TableField("reply_time") |
| | |
| | | @ApiModelProperty(value = "用户名称/举报用户名称") |
| | | private String userName; |
| | | @ApiModelProperty(value = "疗愈名称") |
| | | private String name; |
| | | private String meditationName; |
| | | @ApiModelProperty(value = "提问内容") |
| | | private String content; |
| | | @ApiModelProperty(value = "选中的提问ids") |
| | |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.vo.NoticeDetailVO; |
| | | import com.xinquan.meditation.api.feign.RemoteMeditationService; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public RemoteMeditationService create(Throwable cause) { |
| | | return new RemoteMeditationService() { |
| | | @Override |
| | | public R<MeditationQuestion> getMeditationQuestion(String id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getQuestionCount() { |
| | | return R.fail("远程调用 查询待回复内容数量"); |
| | | } |
| | |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.vo.NoticeDetailVO; |
| | | import com.xinquan.meditation.api.factory.RemoteMeditationFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | |
| | | */ |
| | | @FeignClient(contextId = "remoteMeditationService", value = ServiceNameConstants.MEDITATION_SERVICE, fallbackFactory = RemoteMeditationFallbackFactory.class) |
| | | public interface RemoteMeditationService { |
| | | @GetMapping("/client/meditation/meditation-question/getMeditationQuestion/{id}") |
| | | public R<MeditationQuestion> getMeditationQuestion(@PathVariable("id") String id); |
| | | /** |
| | | * 远程调用 查询待回复内容数量 |
| | | * @return |
| | |
| | | * 远程调用 通过疗愈名字查询疗愈ids |
| | | * @return |
| | | */ |
| | | @PostMapping("/getMeditationIdsByName/{name}") |
| | | @PostMapping("/client/meditation/meditation/getMeditationIdsByName/{name}") |
| | | public R<List<Long>> getMeditationIdsByName(@PathVariable("name") String name); |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "备注 前端忽略") |
| | | @TableField(exist = false) |
| | | private String remark; |
| | | @ApiModelProperty(value = "余额支付金额 前端忽略") |
| | | @TableField(exist = false) |
| | | private BigDecimal balance; |
| | | @ApiModelProperty(value = "用户名称") |
| | | @TableField(exist = false) |
| | | private String userName; |
| | |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | | import com.xinquan.common.core.constant.ServiceNameConstants; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.web.domain.AjaxResult; |
| | | import com.xinquan.system.api.domain.SysUser; |
| | | import com.xinquan.system.api.factory.RemoteUserFallbackFactory; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | |
| | | @FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class) |
| | | public interface RemoteUserService |
| | | { |
| | | @PostMapping("/user/removeByAppUserId/{id}") |
| | | public AjaxResult removeByAppUserId(@PathVariable("id") Long id); |
| | | |
| | | /** |
| | | * 远程调用 根据系统用户id查询用户信息 |
| | |
| | | package com.xinquan.system.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @TableField("gender") |
| | | private Integer gender; |
| | | @ApiModelProperty(value = "会员类型 1月度2季度3年度 ") |
| | | @TableField("vip_level") |
| | | @TableField(value = "vip_level",updateStrategy = FieldStrategy.IGNORED) |
| | | private Integer vipLevel; |
| | | |
| | | @ApiModelProperty(value = "生日") |
| | |
| | | private String email; |
| | | |
| | | @ApiModelProperty(value = "会员到期时间") |
| | | @TableField("vip_expire_time") |
| | | @TableField(value = "vip_expire_time",updateStrategy = FieldStrategy.IGNORED) |
| | | private LocalDateTime vipExpireTime; |
| | | |
| | | @ApiModelProperty(value = "用户状态 1=正常 2=冻结 3=注销") |
| | |
| | | @ApiModelProperty(value = "疗愈等级图标") |
| | | @TableField(exist = false) |
| | | private String levelIcon; |
| | | @ApiModelProperty(value = "累计练习天数") |
| | | @TableField(exist = false) |
| | | private Integer cumulative; |
| | | @ApiModelProperty(value = "今日练习时长 单位分钟") |
| | | @TableField(exist = false) |
| | | private Integer today; |
| | | @ApiModelProperty(value = "连续练习天数") |
| | | @TableField(exist = false) |
| | | private Integer continuity; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiModelProperty(value = "树苗等级类型 1=种子 2=发芽 3=幼苗 4=小树苗 5=中等树苗 6=小树 7=中树 8=大树 9=成熟的大树 10=参天大树") |
| | | @TableField("tree_level_type") |
| | | private Integer treeLevelType; |
| | | @ApiModelProperty(value = "当前树苗总成长值") |
| | | @TableField("total") |
| | | private Integer total; |
| | | @ApiModelProperty(value = "浇灌树苗时间 用于区分是否枯萎 扣除成长值") |
| | | @TableField("time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime time; |
| | | |
| | | @ApiModelProperty(value = "当前树苗成长值") |
| | | @TableField("growth_value") |
| | |
| | | @ApiModelProperty(value = "是否枯萎 1=是 2=否") |
| | | @TableField("status") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "扣除成长值时间") |
| | | @TableField("delTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime delTime; |
| | | @ApiModelProperty(value = "每日疗愈30分钟是否完成 1是2否") |
| | | @TableField(exist = false) |
| | | @TableField("taskOne") |
| | | private Integer taskOne; |
| | | @ApiModelProperty(value = "当前剩余能量值") |
| | | @TableField(exist = false) |
| | | private Integer energyValue; |
| | | @ApiModelProperty(value = "每日疗愈60分钟是否完成 1是2否") |
| | | @TableField(exist = false) |
| | | @TableField("taskTwo") |
| | | private Integer taskTwo; |
| | | @ApiModelProperty(value = "是否完成签到 1是 2否") |
| | | @TableField(exist = false) |
| | |
| | | @TableField(exist = false) |
| | | private Integer chargeType; |
| | | |
| | | @ApiModelProperty(value = "回复内容") |
| | | @TableField(exist = false) |
| | | private String replyContent; |
| | | @ApiModelProperty(value = "疗愈封面图") |
| | | @TableField(exist = false) |
| | | private String coverUrl; |
| | | |
| | | @ApiModelProperty(value = "举报原因") |
| | | @TableField("report_content") |
| | | private String reportContent; |
| | |
| | | @ApiModelProperty(value = "冥想提问id 类型为回复通知时使用") |
| | | @TableField("meditation_question_id") |
| | | private Long meditationQuestionId; |
| | | @ApiModelProperty(value = "冥想id") |
| | | @TableField("meditation_id") |
| | | private Long meditationId; |
| | | |
| | | @ApiModelProperty(value = "查看状态 1:未读 2:已读 ") |
| | | @TableField("read_status") |
| | |
| | | package com.xinquan.system.api.domain; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.validation.constraints.Email; |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | |
| | | private String reason; |
| | | @ApiModelProperty("操作人") |
| | | private String handleName; |
| | | @ApiModelProperty("禁用时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime disableTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "部门名称") |
| | |
| | | public void setHandleName(String handleName) { |
| | | this.handleName = handleName; |
| | | } |
| | | |
| | | |
| | | public LocalDateTime getDisableTime() { |
| | | return disableTime; |
| | | } |
| | | |
| | | public void setDisableTime(LocalDateTime disableTime) { |
| | | this.disableTime = disableTime; |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "是否升级") |
| | | private Boolean isNext; |
| | | @ApiModelProperty(value = "树苗等级类型 1=种子 2=发芽 3=幼苗 4=小树苗 5=中等树苗 6=小树 7=中树 8=大树 9=成熟的大树 10=参天大树") |
| | | private Integer treeLevelType; |
| | | @ApiModelProperty(value = "浇水后的成长值") |
| | | private Integer growthValue; |
| | | @ApiModelProperty(value = "是否枯萎 1是2否(暂时不用)") |
| | |
| | | package com.xinquan.system.api.factory; |
| | | |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.web.domain.AjaxResult; |
| | | import com.xinquan.system.api.RemoteUserService; |
| | | import com.xinquan.system.api.domain.SysUser; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | |
| | | return new RemoteUserService() |
| | | { |
| | | @Override |
| | | public AjaxResult removeByAppUserId(Long id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<SysUser> getSysUserById(String id) { |
| | | return R.fail("根据系统用户id 查询用户信息:" + throwable.getMessage()); |
| | | } |
| | |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | @ApiModelProperty(value = "用户性别") |
| | | @ApiModelProperty(value = "用户性别 1男2女3保密") |
| | | private Integer sex; |
| | | |
| | | } |
| | |
| | | package com.xinquan.user.api.domain.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | private String avatar; |
| | | |
| | | @ApiModelProperty(value = "绑定邀请人时间") |
| | | private LocalDateTime inviteUserTime; |
| | | @ApiModelProperty(value = "昵称") |
| | | private String nickname; |
| | | |
| | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String cellPhone; |
| | | @ApiModelProperty(value = "性别 1男2女") |
| | | private String gender; |
| | | private Integer gender; |
| | | @ApiModelProperty(value = "会员类型 1非会员2月度3季度4年度 多个逗号拼接") |
| | | private String vipType; |
| | | @ApiModelProperty(value = "会员到期时间 2020-11-11 - 2022-11-11") |
| | |
| | | @ApiModel(value = "管理后台用户能量值明细DTO") |
| | | public class UserEnergyDTO extends BasePage { |
| | | @ApiModelProperty(value = "操作内容") |
| | | private String content; |
| | | private String reason; |
| | | @ApiModelProperty(value = "类型 1=增加 2=减少 全部不传") |
| | | private Integer state; |
| | | private Integer changeType; |
| | | @ApiModelProperty(value = "操作时间 2020-11-11 - 2021-11-11") |
| | | private String time; |
| | | @ApiModelProperty(value = "用户uid") |
| | |
| | | public RemoteAppUserService create(Throwable cause) { |
| | | return new RemoteAppUserService() { |
| | | @Override |
| | | public R<Long> getMeditationHistoryCount(Long id) { |
| | | return R.fail("后台远程调用 根据冥想id 获取实际观看人数"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCourseHistoryCount(Long id) { |
| | | return R.fail("后台远程调用 根据课程id 获取实际观看人数"); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCourseChapterHistoryCount(Long id) { |
| | | return R.fail("后台远程调用 根据课程章节id 获取实际观看人数"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<String>> queryTagList(String ids) { |
| | | return R.fail("后台远程调用 根据标签ids 获取标签名称"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Long>> getCourseHistoryByUserId(Long id) { |
| | | return R.fail("后台远程调用 获取用户课程观看历史失败"); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<AppUser>> getAllUserList() { |
| | | return R.fail("后台远程调用 获取所有用户"); |
| | | } |
| | | |
| | | @Override |
| | | public R addBalance(Long id, BigDecimal money) { |
| | | return null; |
| | | } |
| | |
| | | */ |
| | | @FeignClient(contextId = "remoteAppUserService", value = ServiceNameConstants.APP_USER_SERVICE, fallbackFactory = RemoteAppUserFallbackFactory.class) |
| | | public interface RemoteAppUserService { |
| | | @PostMapping("/user/app-user-viewing-history/getMeditationHistoryCount/{id}") |
| | | public R<Long> getMeditationHistoryCount(@PathVariable("id") Long id); |
| | | @PostMapping("/user/app-user-viewing-history/getCourseHistoryCount/{id}") |
| | | public R<Long> getCourseHistoryCount(@PathVariable("id") Long id); |
| | | @PostMapping("/user/app-user-viewing-history/getCourseChapterHistoryCount/{id}") |
| | | public R<Long> getCourseChapterHistoryCount(@PathVariable("id") Long id); |
| | | |
| | | @PostMapping("/client/tag/queryTagList/{ids}") |
| | | public R<List<String>> queryTagList(@PathVariable("ids") String ids); |
| | | @PostMapping("/user/app-user-viewing-history/getCourseHistoryByUserId/{id}") |
| | | public R<List<Long>> getCourseHistoryByUserId(@PathVariable("id") Long id); |
| | | @GetMapping("/client/app-user/getAllUserList") |
| | | public R<List<AppUser>> getAllUserList(); |
| | | @GetMapping("/client/app-user/addBalance/{id}/{money}") |
| | | public R addBalance(@PathVariable("id")Long id,@PathVariable("money") BigDecimal money); |
| | | @GetMapping("/client/app-user/addVipExpireTime/{id}/{type}") |
| | |
| | | */ |
| | | @PostMapping("/client/app-user/getAppUserByName/{name}") |
| | | public R<List<Long>> getAppUserByName(@PathVariable("name")String name); |
| | | @PostMapping("/getAppUserByNameOrPhone/{name}") |
| | | @PostMapping("/client/app-user/getAppUserByNameOrPhone/{name}") |
| | | public R<List<Long>> getAppUserByNameOrPhone(@PathVariable("name")String name); |
| | | @PostMapping("/client/tag/queryTag/{name}") |
| | | public R<List<Tag>> queryTag(@PathVariable("name") String name); |
| | |
| | | @ApiOperation(value = "微信苹果登录-验证手机号", tags = {"APP端"}) |
| | | @PostMapping("/app/verifyCellPhone") |
| | | public R<?> verifyCellPhone(@Validated @RequestBody AppVerifyCellPhoneBody body) { |
| | | AppLoginUser appLoginUser = sysLoginService.verifyCellPhone(body); |
| | | |
| | | return R.ok(tokenService.createToken4AppLoginUser( |
| | | sysLoginService.verifyCellPhone(body))); |
| | | appLoginUser)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.xinquan.auth.form.AppLoginBody; |
| | | import com.xinquan.auth.form.AppRegisterBody; |
| | | import com.xinquan.auth.form.VerifyResultVO; |
| | | import com.xinquan.auth.util.HuaWeiSMSUtil; |
| | | import com.xinquan.common.core.constant.CacheConstants; |
| | | import com.xinquan.common.core.constant.Constants; |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | |
| | | sysUser.setUserName(cellPhone); |
| | | sysUser.setUserType("01"); |
| | | sysUser.setNickName(nickname); |
| | | sysUser.setPassword(password); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
| | | R<SysUser> registerResult = remoteUserService.registerAppUserInfo(sysUser, SecurityConstants.INNER); |
| | | |
| | | if (R.FAIL == registerResult.getCode()) |
| | |
| | | recordLogService.recordLogininfor(cellPhone, Constants.REGISTER, "注册成功"); |
| | | //TODO 默认头像待完善 |
| | | AppUserDTO appUserDTO = AppUserDTO.builder().userId(sysUser.getUserId()).cellPhone(cellPhone) |
| | | .avatar("qwer").nickname( |
| | | nickname).userStatus(1).sanskritFlag(2).balance(BigDecimal.ZERO) |
| | | .avatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg").nickname( |
| | | nickname).userStatus(1).sanskritFlag(2).balance(BigDecimal.ZERO).inviteUserId(appRegisterBody.getInviteUserId()) |
| | | .income(BigDecimal.ZERO).totalEnergyValue(0).registerTime( |
| | | LocalDateTime.now()).levelSettingId(1).build(); |
| | | if (appRegisterBody.getInviteUserId()!=null){ |
| | | appUserDTO.setInviteUserTime(LocalDateTime.now()); |
| | | } |
| | | R<AppUser> result = remoteAppUserService.registerAppUser(appUserDTO, |
| | | SecurityConstants.INNER); |
| | | if (R.FAIL == result.getCode()) { |
| | |
| | | TimeUnit.MINUTES); |
| | | log.info("发送验证码成功,手机号:{} 验证码:{}", cellPhone, code); |
| | | // TODO 修改sender参数及templateId |
| | | // HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8823121426646", |
| | | // "cf1707ec44694627b1b483b0277e12fd"); |
| | | HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8823121426646", |
| | | "767ad27dce184a32a4b4863517fbd301\n"); |
| | | } catch (Exception e) { |
| | | log.error("发送短信失败", e); |
| | | throw new ServiceException("验证码发送失败"); |
| | |
| | | "登录用户不存在"); |
| | | throw new ServiceException("登录用户:" + body.getCellPhone() + " 不存在"); |
| | | } |
| | | if (!sysUser.getPassword().equals(body.getPassword())){ |
| | | throw new ServiceException("密码错误"); |
| | | } |
| | | passwordService.validate(sysUser, body.getPassword()); |
| | | // if (!sysUser.getPassword().equals(body.getPassword())){ |
| | | // throw new ServiceException("密码错误"); |
| | | // } |
| | | AppLoginUser appLoginUser = new AppLoginUser(); |
| | | appLoginUser.setAppUserId(appUser.getId()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | |
| | | throws Exception { |
| | | // TODO 必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1"; // APP接入地址+接口访问URI |
| | | String appKey = "tTMBH29Tm6tKKHf882JXob82P1rb"; // APP_Key |
| | | String appSecret = "Ob02q15WAgDZRwW9kDlVPklBSdfR"; // APP_Secret |
| | | String appKey = "dFbKS778KG0jvQrQ672b9RaOktfV"; // APP_Key |
| | | String appSecret = "3QsteXCIY3KRfgXf5zXyi6f3cHBj"; // APP_Secret |
| | | |
| | | // 条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | // 国际/港澳台短信不用关注该参数 |
| | |
| | | /** |
| | | * 默认密码 |
| | | */ |
| | | public static final String DEFAULT_PASSWORD = "123456"; |
| | | public static final String DEFAULT_PASSWORD = "a12345678"; |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | |
| | | } |
| | | return R.ok(PageDTO.of(page, CourseCategory.class)); |
| | | } |
| | | @PostMapping("/courseCategoryManagementList1") |
| | | @ApiOperation(value = "分类列表-分页", tags = {"管理后台-分类管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pageCurr", value = "分页参数,当前页码", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "分页参数,每页数量", dataType = "Integer", required = true) |
| | | }) |
| | | public R<PageDTO<CourseCategory>> courseCategoryManagementList1(@RequestParam(value = "pageCurr")Integer pageCurr, |
| | | @RequestParam(value = "pageSize")Integer pageSize) { |
| | | LambdaQueryWrapper<CourseCategory> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | courseLambdaQueryWrapper.ne(CourseCategory::getName,"线下课程"); |
| | | courseLambdaQueryWrapper.orderByDesc(CourseCategory::getSortNum); |
| | | Page<CourseCategory> page = courseCategoryService.page(new Page<>(pageCurr, pageSize), courseLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | | return R.ok(PageDTO.empty(page)); |
| | | } |
| | | for (CourseCategory record : page.getRecords()) { |
| | | record.setUid(record.getId()+""); |
| | | } |
| | | return R.ok(PageDTO.of(page, CourseCategory.class)); |
| | | } |
| | | @PostMapping("/addCourseCategory") |
| | | @ApiOperation(value = "新增分类管理", tags = "管理后台-分类管理") |
| | | public R addCourseCategory(@RequestBody CourseCategory homeBackgroundMusic) { |
| | |
| | | @PathVariable("pageSize") Integer pageSize, |
| | | @PathVariable("ids")String ids) |
| | | { |
| | | |
| | | List<Long> collect = courseChapterService.lambdaQuery().in(CourseChapter::getId, Arrays.asList(ids.split(","))) |
| | | .list().stream().map(CourseChapter::getCourseId).collect(Collectors.toList()); |
| | | if(collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | Page<Course> page = courseService |
| | | .lambdaQuery() |
| | | .in(Course::getId,Arrays.asList(ids.split(","))) |
| | | .in(Course::getId,collect) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(page); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "课程id", name = "id", required = true, dataType = "String"), |
| | | }) |
| | | public R<ClientCourseVO> getPayCourseInfoById(@RequestParam(value = "id")Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | AppUserVO data1 = remoteAppUserService.getCurrentUser().getData(); |
| | | |
| | | Course byId = courseService.getById(id); |
| | | ClientCourseVO clientCourseVO = new ClientCourseVO(); |
| | | BeanUtils.copyProperties(byId, clientCourseVO); |
| | | if (data1.getVipExpireTime()!=null && data1.getVipExpireTime().isAfter(LocalDateTime.now())){ |
| | | clientCourseVO.setIsVip(1); |
| | | List<AppUser> data = remoteAppUserService.getUserByCourseId(id).getData(); |
| | | if (byId.getChargeType()==1 && tokenService.getLoginUser()==null){ |
| | | if (data!=null){ |
| | | clientCourseVO.setCount(data.size()); |
| | | if (data.size()>=5){ |
| | | clientCourseVO.setHeaders(data.stream().limit(5).map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | }else{ |
| | | clientCourseVO.setHeaders(data.stream().map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | }else{ |
| | | clientCourseVO.setIsVip(0); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | AppUser data1 = remoteAppUserService.getAppUserById(userId + "").getData(); |
| | | if (data1.getVipExpireTime()!=null && data1.getVipExpireTime().isAfter(LocalDateTime.now())){ |
| | | clientCourseVO.setIsVip(1); |
| | | }else{ |
| | | clientCourseVO.setIsVip(0); |
| | | } |
| | | // 查询学习人数和头像列表 |
| | | if (data!=null){ |
| | | clientCourseVO.setCount(data.size()); |
| | | if (data.size()>=5){ |
| | | clientCourseVO.setHeaders(data.stream().limit(5).map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | }else{ |
| | | clientCourseVO.setHeaders(data.stream().map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | } |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()){ |
| | | if (collect.contains(userId)){ |
| | | clientCourseVO.setIsBuy(1); |
| | | } |
| | | } |
| | | } |
| | | // 查询是否已收藏课程 |
| | | clientCourseVO.setIsCollect(courseUserFavoriteService.lambdaQuery() |
| | | .eq(CourseUserFavorite::getAppUserId, userId) |
| | | .eq(CourseUserFavorite::getCourseId, id).one() == null ? 2 : 1); |
| | | } |
| | | |
| | | |
| | | // 查询用户是否已购买该课程 |
| | | // 查询章节 |
| | | List<CourseChapter> page = courseChapterService.lambdaQuery() |
| | |
| | | } |
| | | clientCourseVO.setList(page); |
| | | clientCourseVO.setIsBuy(0); |
| | | // 查询学习人数和头像列表 |
| | | List<AppUser> data = remoteAppUserService.getUserByCourseId(id).getData(); |
| | | if (data!=null){ |
| | | clientCourseVO.setCount(data.size()); |
| | | if (data.size()>=5){ |
| | | clientCourseVO.setHeaders(data.stream().limit(5).map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | }else{ |
| | | clientCourseVO.setHeaders(data.stream().map(AppUser::getAvatar).collect(Collectors.toList())); |
| | | } |
| | | List<Long> collect = data.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (!collect.isEmpty()){ |
| | | if (collect.contains(userId)){ |
| | | clientCourseVO.setIsBuy(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 查询推荐课程 |
| | | List<Course> list = courseService.lambdaQuery().eq(Course::getCateId, byId.getCateId()) |
| | |
| | | cours.setCount(data3.size()); |
| | | } |
| | | clientCourseVO.setList2(courses); |
| | | // 查询是否已收藏课程 |
| | | clientCourseVO.setIsCollect(courseUserFavoriteService.lambdaQuery() |
| | | .eq(CourseUserFavorite::getAppUserId, userId) |
| | | .eq(CourseUserFavorite::getCourseId, id).one() == null ? 2 : 1); |
| | | |
| | | return R.ok(clientCourseVO); |
| | | } |
| | | /** |
| | |
| | | @ApiOperation(value = "课程学习页面") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "章节id", name = "chapterId", required = true, dataType = "Long"), |
| | | |
| | | }) |
| | | public R<List<CourseChapter>> studyPageByChapterId(@RequestParam(value = "chapterId")Long chapterId) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userid = loginUser.getUserid(); |
| | | |
| | | CourseChapter byId1 = courseChapterService.getById(chapterId); |
| | | Course byId = courseService.getById(byId1.getCourseId()); |
| | | // 新增学习记录 |
| | | CourseLearningRecord one = courseLearningRecordService.lambdaQuery().eq(CourseLearningRecord::getAppUserId, userid) |
| | | .eq(CourseLearningRecord::getChapterId, chapterId).one(); |
| | | if (one==null){ |
| | | CourseLearningRecord courseLearningRecord = new CourseLearningRecord(); |
| | | courseLearningRecord.setAppUserId(userid); |
| | | if (byId!=null){ |
| | | courseLearningRecord.setCourseId(byId.getId()); |
| | | } |
| | | courseLearningRecord.setChapterId(chapterId); |
| | | courseLearningRecordService.save(courseLearningRecord); |
| | | } |
| | | Long id = byId1.getCourseId(); |
| | | // 查询章节 |
| | | List<CourseChapter> page = courseChapterService.lambdaQuery() |
| | |
| | | .orderByDesc(CourseChapter::getSortNum) |
| | | .list(); |
| | | |
| | | for (CourseChapter courseChapter : page) { |
| | | AppUserViewingHistory data = remoteAppUserService.getCourseStudyHistory(courseChapter.getId()).getData(); |
| | | if (data!=null){ |
| | | courseChapter.setMinuteLook(data.getMinuteLook()); |
| | | courseChapter.setSecondLook(data.getSecondLook()); |
| | | courseChapter.setIsOver(data.getIsOver()); |
| | | } |
| | | int size = courseLearningRecordService |
| | | .lambdaQuery().eq(CourseLearningRecord::getChapterId, courseChapter.getId()) |
| | | .list().size(); |
| | | courseChapter.setRealLearnedNum(size+courseChapter.getVirtualLearnedNum()); |
| | | for (CourseChapter courseChapter : page) { |
| | | AppUserViewingHistory data = remoteAppUserService.getCourseStudyHistory(courseChapter.getId()).getData(); |
| | | if (data!=null){ |
| | | courseChapter.setMinuteLook(data.getMinuteLook()); |
| | | courseChapter.setSecondLook(data.getSecondLook()); |
| | | courseChapter.setIsOver(data.getIsOver()); |
| | | } |
| | | return R.ok(page); |
| | | int size = courseLearningRecordService |
| | | .lambdaQuery().eq(CourseLearningRecord::getChapterId, courseChapter.getId()) |
| | | .list().size(); |
| | | courseChapter.setRealLearnedNum(size+courseChapter.getVirtualLearnedNum()); |
| | | } |
| | | if (byId.getChargeType() == 1&&tokenService.getLoginUser()==null){ |
| | | return R.ok(page); |
| | | }else{ |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userid = loginUser.getUserid(); |
| | | // 新增学习记录 |
| | | CourseLearningRecord one = courseLearningRecordService.lambdaQuery().eq(CourseLearningRecord::getAppUserId, userid) |
| | | .eq(CourseLearningRecord::getChapterId, chapterId).one(); |
| | | if (one==null){ |
| | | CourseLearningRecord courseLearningRecord = new CourseLearningRecord(); |
| | | courseLearningRecord.setAppUserId(userid); |
| | | if (byId!=null){ |
| | | courseLearningRecord.setCourseId(byId.getId()); |
| | | } |
| | | courseLearningRecord.setChapterId(chapterId); |
| | | courseLearningRecordService.save(courseLearningRecord); |
| | | } |
| | | |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | } |
| | | @PostMapping("/confirmOrder") |
| | | @ApiOperation(value = "确认订单页面") |
| | |
| | | Long userId = loginUser.getUserid(); |
| | | Course byId = courseService.getById(courseId); |
| | | List<Course> list = courseService.lambdaQuery().eq(Course::getCateId, byId.getCateId()) |
| | | .ne(Course::getId,courseId) |
| | | .eq(Course::getCourseType, 1).list(); |
| | | for (Course course : list) { |
| | | List<AppUser> data = remoteAppUserService.getUserByCourseId(courseId).getData(); |
| | | course.setCount(data.size()); |
| | | course.setCount(data.size()+course.getVirtualLearnedNum()); |
| | | course.setRealLearnedNum(data.size()+course.getVirtualLearnedNum()); |
| | | } |
| | | List<Course> courses = new ArrayList<>(); |
| | | |
| | |
| | | .eq(Course::getCourseType, 1) |
| | | .eq(Course::getChargeType, 1) |
| | | .list(); |
| | | // 随机获取两个 |
| | | if (CollUtils.isNotEmpty(freeCourseList) && freeCourseList.size() > 2) { |
| | | int size = freeCourseList.size(); |
| | | int index = (int) (Math.random() * size); |
| | | List<Course> courses = new ArrayList<>(); |
| | | for (int i = 0; i < 2; i++) { |
| | | courses.add(freeCourseList.get(index)); |
| | | // 远程查询用户观看历史 |
| | | List<Long> data1 = remoteAppUserService.getCourseHistoryByUserId(userId).getData(); |
| | | if (!data1.isEmpty()){ |
| | | // 随机获取两个 |
| | | if (CollUtils.isNotEmpty(freeCourseList) && freeCourseList.size() > 2) { |
| | | int size = freeCourseList.size(); |
| | | int index = (int) (Math.random() * size); |
| | | List<Course> courses = new ArrayList<>(); |
| | | for (int i = 0; i < 2; i++) { |
| | | courses.add(freeCourseList.get(index)); |
| | | } |
| | | studyPageVO.setFreeCourseList(courses); |
| | | }else{ |
| | | studyPageVO.setFreeCourseList(freeCourseList); |
| | | } |
| | | studyPageVO.setFreeCourseList(courses); |
| | | return R.ok(studyPageVO); |
| | | }else{ |
| | | studyPageVO.setFreeCourseList(freeCourseList); |
| | | List<Course> list1 = courseService.lambdaQuery() |
| | | .eq(Course::getChargeType, 1) |
| | | .eq(Course::getListingStatus, 1) |
| | | .list(); |
| | | if (list1.size()>=2){ |
| | | List<Course> courses = new ArrayList<>(); |
| | | courses.add(list1.get(0)); |
| | | courses.add(list1.get(1)); |
| | | studyPageVO.setFreeCourseList(courses); |
| | | }else if (list1.size()==1){ |
| | | List<Course> courses = new ArrayList<>(); |
| | | courses.add(list1.get(0)); |
| | | for (Course course : freeCourseList) { |
| | | if (!course.getId().equals(list1.get(0).getId())){ |
| | | courses.add(course); |
| | | break; |
| | | } |
| | | } |
| | | studyPageVO.setFreeCourseList(courses); |
| | | } |
| | | return R.ok(studyPageVO); |
| | | } |
| | | return R.ok(studyPageVO); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | package com.xinquan.course.controller.client; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.BeanUtils; |
| | |
| | | TutorSpecialColumn one = tutorSpecialColumnService.lambdaQuery().one(); |
| | | List<TutorCourseVO> clientCourseVOS = new ArrayList<>(); |
| | | if (one!=null){ |
| | | TutorSpecialColumnCourse one1 = tutorSpecialColumnCourseService.lambdaQuery().eq(TutorSpecialColumnCourse::getTutorSpecialColumnId, one.getId()).one(); |
| | | BeanUtils.copyProperties(one, tutorVo); |
| | | List<Course> page = courseService.lambdaQuery() |
| | | .in(Course::getId, Arrays.asList(one1.getCourseId().split(","))) |
| | | .orderByDesc(Course::getSortNum).list().stream().limit(2).collect(Collectors.toList()); |
| | | for (Course course : page) { |
| | | TutorCourseVO tutorCourseVO = new TutorCourseVO(); |
| | | BeanUtils.copyProperties(course, tutorCourseVO); |
| | | clientCourseVOS.add(tutorCourseVO); |
| | | TutorSpecialColumnCourse one1 = tutorSpecialColumnCourseService.lambdaQuery().eq(TutorSpecialColumnCourse::getTutorSpecialColumnId, one.getId()).one(); |
| | | if (one1!=null){ |
| | | LambdaQueryWrapper<Course> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (StringUtils.hasLength(one1.getCourseId())){ |
| | | courseLambdaQueryWrapper.in(Course::getId, Arrays.asList(one1.getCourseId().split(","))); |
| | | } |
| | | courseLambdaQueryWrapper.orderByDesc(Course::getSortNum); |
| | | List<Course> page = courseService.list(courseLambdaQueryWrapper); |
| | | for (Course course : page) { |
| | | TutorCourseVO tutorCourseVO = new TutorCourseVO(); |
| | | BeanUtils.copyProperties(course, tutorCourseVO); |
| | | clientCourseVOS.add(tutorCourseVO); |
| | | } |
| | | tutorVo.setList(clientCourseVOS); |
| | | return R.ok(tutorVo); |
| | | }else{ |
| | | return R.ok(tutorVo); |
| | | } |
| | | tutorVo.setList(clientCourseVOS); |
| | | return R.ok(tutorVo); |
| | | }else{ |
| | | tutorVo.setList(clientCourseVOS); |
| | | return R.ok(tutorVo); |
| | |
| | | .list().stream().map(TutorSpecialColumnCourse::getId) |
| | | .collect(Collectors.toList()); |
| | | tutorSpecialColumnCourseService.removeBatchByIds(collect); |
| | | List<TutorSpecialColumnCourse> tutorSpecialColumnCourses = new ArrayList<>(); |
| | | TutorSpecialColumnCourse tutorSpecialColumnCourse = new TutorSpecialColumnCourse(); |
| | | tutorSpecialColumnCourse.setCourseId(homeBackgroundMusic.getCourseIds()); |
| | | tutorSpecialColumnCourse.setTutorSpecialColumnId(homeBackgroundMusic.getId()); |
| | | tutorSpecialColumnCourses.add(tutorSpecialColumnCourse); |
| | | tutorSpecialColumnCourseService.saveBatch(tutorSpecialColumnCourses); |
| | | if (StringUtils.hasLength(homeBackgroundMusic.getCourseIds())){ |
| | | List<TutorSpecialColumnCourse> tutorSpecialColumnCourses = new ArrayList<>(); |
| | | TutorSpecialColumnCourse tutorSpecialColumnCourse = new TutorSpecialColumnCourse(); |
| | | tutorSpecialColumnCourse.setCourseId(homeBackgroundMusic.getCourseIds()); |
| | | tutorSpecialColumnCourse.setTutorSpecialColumnId(homeBackgroundMusic.getId()); |
| | | tutorSpecialColumnCourses.add(tutorSpecialColumnCourse); |
| | | tutorSpecialColumnCourseService.saveBatch(tutorSpecialColumnCourses); |
| | | } |
| | | return R.ok(tutorSpecialColumnService.updateById(homeBackgroundMusic)); |
| | | } |
| | | |
| | |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.security.annotation.InnerAuth; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.course.api.domain.CourseCategory; |
| | | import com.xinquan.course.api.domain.CourseChapter; |
| | | import com.xinquan.course.service.CourseCategoryService; |
| | | import com.xinquan.course.service.CourseChapterService; |
| | | import com.xinquan.course.service.CourseService; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class InnerCourseController { |
| | | |
| | | private final CourseService courseService; |
| | | @Resource |
| | | private CourseCategoryService courseCategoryService; |
| | | @Resource |
| | | private CourseChapterService courseChapterService; |
| | | |
| | | /** |
| | | * 根据课程id获取课程信息 |
| | |
| | | */ |
| | | @GetMapping("/getCourseById/{targetId}") |
| | | public R<Course> getCourseById(@PathVariable("targetId") Long targetId) { |
| | | return R.ok(courseService.getById(targetId)); |
| | | Course byId = courseService.getById(targetId); |
| | | CourseCategory byId1 = courseCategoryService.getById(byId.getCateId()); |
| | | byId.setCategoryName(byId1.getName()); |
| | | int size = courseChapterService.lambdaQuery().eq(CourseChapter::getCourseId, targetId) |
| | | .list().size(); |
| | | byId.setCourseChapterCount(Long.valueOf(size)); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | |
| | | package com.xinquan.course.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | |
| | | @Override |
| | | public PageDTO<ClientCourseVO> getCoursePageList(String courseTitle, Long cateId, |
| | | Integer pageCurr, Integer pageSize) { |
| | | Page<Course> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(courseTitle), Course::getCourseTitle, courseTitle) |
| | | .eq(Objects.nonNull(cateId), Course::getCateId, cateId) |
| | | .orderByDesc(Course::getSortNum) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | LambdaQueryWrapper<Course> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (org.springframework.util.StringUtils.hasLength(courseTitle)){ |
| | | courseLambdaQueryWrapper.like(Course::getCourseTitle, courseTitle); |
| | | } |
| | | if (cateId!=null && cateId.equals(1853706016887824386L)){ |
| | | courseLambdaQueryWrapper.eq(Course::getCourseType,2); |
| | | }else if (cateId!=null){ |
| | | courseLambdaQueryWrapper.eq(Course::getCateId, cateId); |
| | | } |
| | | courseLambdaQueryWrapper.eq(Course::getListingStatus,1); |
| | | courseLambdaQueryWrapper.orderByDesc(Course::getSortNum); |
| | | Page<Course> page = this.page(new Page<>(pageCurr, pageSize),courseLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | | } |
| | |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.domain.HomeBackgroundMusic; |
| | | import com.xinquan.meditation.domain.MeditationHall; |
| | | import com.xinquan.meditation.domain.vo.ClientHomeBackgroundMusicVO; |
| | | import com.xinquan.meditation.domain.vo.ClientMeditationAndCateVO; |
| | | import com.xinquan.meditation.domain.vo.ClientMeditationCategoryVO; |
| | |
| | | import com.xinquan.meditation.service.MeditationQuestionService; |
| | | import com.xinquan.meditation.service.MeditationService; |
| | | import com.xinquan.system.api.RemoteHotWordsService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | @GetMapping("/getPersonalityPlan") |
| | | @ApiOperation("获取私人订制") |
| | | public R<List<ClientMeditationVO>> getPersonalityPlan() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | return R.ok(meditationService.getPersonalityPlan()); |
| | | } |
| | | |
| | |
| | | @ApiOperation("获取冥想音频详情") |
| | | @ApiImplicitParam(name = "id", value = "冥想音频id", dataType = "Long", required = true) |
| | | public R<ClientMeditationDetailsVO> getMeditationDetails(@RequestParam("id") Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | return R.ok(meditationService.getMeditationDetails(id)); |
| | | |
| | | return meditationService.getMeditationDetails(id); |
| | | } |
| | | @GetMapping("/getMeditationDetailsShare") |
| | | @ApiOperation(value = "获取冥想音频详情",tags = "H5分享") |
| | |
| | | meditationQuestion.setContent(content); |
| | | meditationQuestion.setPublishTime(LocalDateTime.now()); |
| | | meditationQuestion.setAppUserId(userId); |
| | | meditationQuestion.setShowFlag(1); |
| | | meditationQuestion.setShowFlag(2); |
| | | meditationQuestion.setReportStatus(1); |
| | | meditationQuestionService.save(meditationQuestion); |
| | | return R.ok(); |
| | |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.dto.MeditationDTO; |
| | | import com.xinquan.meditation.api.domain.dto.UserAnswerDTO; |
| | |
| | | import com.xinquan.meditation.domain.export.MeditationExport; |
| | | import com.xinquan.meditation.service.*; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.system.api.domain.Tag; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import com.xinquan.user.api.domain.dto.OrderListDTO; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | List<Long> collect = meditationUserFavoriteService |
| | | .lambdaQuery() |
| | | .eq(MeditationUserFavorite::getAppUserId, id).list().stream() |
| | | .map(MeditationUserFavorite::getId).collect(Collectors.toList()); |
| | | .map(MeditationUserFavorite::getMeditationId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())collect.add(-1L); |
| | | Page<Meditation> page = meditationService |
| | | .lambdaQuery() |
| | |
| | | courseLambdaQueryWrapper.in(StringUtils.hasLength(dto.getTagName()),Meditation::getId, collect); |
| | | courseLambdaQueryWrapper.eq(dto.getChargeType()!=null,Meditation::getChargeType, dto.getChargeType()); |
| | | courseLambdaQueryWrapper.eq(dto.getCateId()!=null,Meditation::getCateId, dto.getCateId()); |
| | | courseLambdaQueryWrapper.eq(dto.getMeditationTitle()!=null&& !dto.getMeditationTitle().isEmpty(),Meditation::getMeditationTitle, dto.getMeditationTitle()); |
| | | 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())) { |
| | | return R.ok(PageDTO.empty(page)); |
| | |
| | | @ApiOperation(value = "查看详情冥想音频管理", tags = "管理后台-冥想音频管理") |
| | | public R<Meditation> detailMeditation(String uid) { |
| | | Meditation byId = meditationService.getById(uid); |
| | | List<Long> collect = meditationTagService.list(new LambdaQueryWrapper<MeditationTag>() |
| | | .eq(MeditationTag::getMeditationId, uid)) |
| | | List<MeditationTag> list1 = meditationTagService.list(new LambdaQueryWrapper<MeditationTag>() |
| | | .eq(MeditationTag::getMeditationId, uid)); |
| | | |
| | | List<Long> collect = list1 |
| | | .stream().map(MeditationTag::getTagId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<String> collect1 = meditationMusicService.list(new LambdaQueryWrapper<MeditationMusic>() |
| | | .eq(MeditationMusic::getMeditationId, uid)) |
| | | .stream().map(MeditationMusic::getName) |
| | | .collect(Collectors.toList()); |
| | | if (!list1.isEmpty()){ |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (Long s : collect) { |
| | | stringBuilder.append(s).append(","); |
| | | } |
| | | // 去除最后一位 |
| | | StringBuilder stringBuilder1 = stringBuilder.deleteCharAt(stringBuilder.length() - 1); |
| | | List<String> data = remoteAppUserService.queryTagList(stringBuilder1 + "").getData(); |
| | | byId.setTagNameList(data); |
| | | |
| | | }else{ |
| | | byId.setTagNameList(new ArrayList<String>()); |
| | | } |
| | | byId.setMusicList(collect1); |
| | | byId.setTagList(collect); |
| | | if (byId.getIsEveryday() == 1){ |
| | | MeditationEveryday byId1 = meditationEverydayService.getById(byId.getEverydayId()); |
| | | byId.setStartPlayTime(byId1.getStartPlayTime()); |
| | | byId.setEndPlayTime(byId1.getEndPlayTime()); |
| | | byId.setImageUrl(byId1.getImageUrl()); |
| | | if (byId1 != null){ |
| | | byId.setStartPlayTime(byId1.getStartPlayTime()); |
| | | byId.setEndPlayTime(byId1.getEndPlayTime()); |
| | | byId.setImageUrl(byId1.getImageUrl()); |
| | | } |
| | | } |
| | | MeditationCategory byId1 = meditationCategoryService.getById(byId.getCateId()); |
| | | if (byId1!=null){ |
| | |
| | | package com.xinquan.meditation.controller.client; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.dto.MeditationQuestionDTO; |
| | | import com.xinquan.meditation.api.domain.vo.NoticeDetailVO; |
| | | import com.xinquan.meditation.domain.MeditationCategory; |
| | | import com.xinquan.meditation.service.MeditationCategoryService; |
| | | import com.xinquan.meditation.service.MeditationQuestionService; |
| | | import com.xinquan.meditation.service.MeditationService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.StringUtils; |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import com.xinquan.meditation.domain.export.QuestionExport; |
| | | import com.xinquan.meditation.service.MeditationCategoryService; |
| | | import com.xinquan.meditation.service.MeditationQuestionService; |
| | | import com.xinquan.meditation.service.MeditationQuestionService; |
| | | import com.xinquan.meditation.service.MeditationService; |
| | | import com.xinquan.system.api.RemoteUserService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.vo.NoticeDetailVO; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import com.xinquan.user.api.domain.dto.OrderListDTO; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @GetMapping("/getMeditationQuestion/{id}") |
| | | public R<MeditationQuestion> getMeditationQuestion(@PathVariable("id") String id){ |
| | | MeditationQuestion byId = meditationQuestionService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | /** |
| | | * 远程调用 查询待回复内容数量 |
| | | * @return |
| | |
| | | } |
| | | meditationLambdaQueryWrapper.in(MeditationQuestion::getAppUserId,data); |
| | | } |
| | | if (StringUtils.hasLength(dto.getName())){ |
| | | if (StringUtils.hasLength(dto.getMeditationName())){ |
| | | List<Long> collect = meditationService.lambdaQuery() |
| | | .like(Meditation::getMeditationTitle, dto.getName()) |
| | | .like(Meditation::getMeditationTitle, dto.getMeditationName()) |
| | | .list().stream().map(Meditation::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1L); |
| | |
| | | meditationLambdaQueryWrapper.eq(dto.getShowFlag()!=null,MeditationQuestion::getShowFlag, dto.getShowFlag()); |
| | | if (dto.getIsReplay()!=null){ |
| | | if (dto.getIsReplay() == 1){ |
| | | meditationLambdaQueryWrapper.isNotNull(MeditationQuestion::getReplyTime); |
| | | meditationLambdaQueryWrapper.isNotNull(MeditationQuestion::getReplyContent); |
| | | }else{ |
| | | meditationLambdaQueryWrapper.isNull(MeditationQuestion::getReplyTime); |
| | | meditationLambdaQueryWrapper.isNull(MeditationQuestion::getReplyContent); |
| | | } |
| | | } |
| | | if (StringUtils.hasLength(dto.getUserName())){ |
| | |
| | | } |
| | | meditationLambdaQueryWrapper.in(MeditationQuestion::getAppUserId,data); |
| | | } |
| | | if (StringUtils.hasLength(dto.getName())){ |
| | | if (StringUtils.hasLength(dto.getMeditationName())){ |
| | | List<Long> collect = meditationService.lambdaQuery() |
| | | .like(Meditation::getMeditationTitle, dto.getName()) |
| | | .like(Meditation::getMeditationTitle, dto.getMeditationName()) |
| | | .list().stream().map(Meditation::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | meditationLambdaQueryWrapper.in(MeditationQuestion::getMeditationId,collect); |
| | | } |
| | | meditationLambdaQueryWrapper.orderBy(true, true, MeditationQuestion::getReplyContent); // "reply_content IS NULL" 确保 null 排前面 |
| | | |
| | | meditationLambdaQueryWrapper.orderByDesc(MeditationQuestion::getCreateTime); |
| | | Page<MeditationQuestion> page = meditationQuestionService.page(new Page<>(dto.getPageCurr(), dto.getPageSize()), meditationLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | |
| | | record.setCellPhone(data.getCellPhone()); |
| | | } |
| | | Meditation byId = meditationService.getById(record.getMeditationId()); |
| | | |
| | | if (byId!=null){ |
| | | record.setChargeType(byId.getChargeType()); |
| | | MeditationCategory byId1 = meditationCategoryService.getById(byId.getCateId()); |
| | | if (byId1!=null){ |
| | | record.setMeditationCategoryName(byId1.getCategoryName()); |
| | | } |
| | | record.setMeditationName(byId.getMeditationTitle()); |
| | | if (byId.getChargeType()!=null &&byId.getChargeType() == 3){ |
| | | record.setMoney(byId.getGeneralPrice()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | // List<MeditationQuestion> records = page.getRecords(); |
| | | // page.setRecords(records); |
| | | return R.ok(PageDTO.of(page, MeditationQuestion.class)); |
| | | } |
| | | @PostMapping("/addMeditationQuestion") |
| | |
| | | if (byId1!=null){ |
| | | byId.setMeditationName(byId1.getMeditationTitle()); |
| | | byId.setChargeType(byId1.getChargeType()); |
| | | byId.setCoverUrl(byId1.getCoverUrl().split(",")[0]); |
| | | } |
| | | MeditationCategory byId2 = meditationCategoryService.getById(byId1.getCateId()); |
| | | if (byId2!=null){ |
| | | byId.setMeditationCategoryName(byId2.getCategoryName()); |
| | | |
| | | } |
| | | return R.ok(); |
| | | return R.ok(byId); |
| | | } |
| | | @PostMapping("/updateMeditationQuestion") |
| | | @ApiOperation(value = "修改提问管理", tags = "管理后台-提问管理") |
| | | public R updateMeditationQuestion(@RequestBody MeditationQuestion homeBackgroundMusic) { |
| | | Long id = homeBackgroundMusic.getId(); |
| | | MeditationQuestion byId = meditationQuestionService.getById(id); |
| | | homeBackgroundMusic.setUpdateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setUpdateTime(LocalDateTime.now()); |
| | | if (homeBackgroundMusic.getType() == 1){ |
| | | homeBackgroundMusic.setReplyTime(LocalDateTime.now()); |
| | | // 给用户添加一条系统消息 |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(byId.getAppUserId()); |
| | | noticeRecord.setMeditationQuestionId(homeBackgroundMusic.getId()); |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(2); |
| | | noticeRecord.setMeditationId(byId.getMeditationId()); |
| | | noticeRecord.setTitle("平台回复通知"); |
| | | noticeRecord.setContent(homeBackgroundMusic.getReplyContent()); |
| | | remoteAppUserService.addNoticeReplay(noticeRecord); |
| | | } |
| | | return R.ok(meditationQuestionService.updateById(homeBackgroundMusic)); |
| | | } |
| | | @PostMapping("/deleteMeditationQuestion") |
| | |
| | | package com.xinquan.meditation.controller.client; |
| | | |
| | | |
| | | import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.dto.MeditationQuestionDTO; |
| | | import com.xinquan.meditation.domain.MeditationCategory; |
| | |
| | | import com.xinquan.meditation.service.MeditationReportService; |
| | | import com.xinquan.meditation.service.MeditationService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.MeditationReport; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.MeditationReport; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | } |
| | | meditationLambdaQueryWrapper.in(MeditationReport::getReportUserId,data); |
| | | } |
| | | if (StringUtils.hasLength(dto.getName())){ |
| | | if (StringUtils.hasLength(dto.getMeditationName())){ |
| | | List<Long> collect = meditationService.lambdaQuery() |
| | | .like(Meditation::getMeditationTitle, dto.getName()) |
| | | .like(Meditation::getMeditationTitle, dto.getMeditationName()) |
| | | .list().stream().map(Meditation::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1L); |
| | |
| | | Meditation byId = meditationService.getById(record.getMeditationId()); |
| | | if (byId!=null){ |
| | | record.setMeditationName(byId.getMeditationTitle()); |
| | | record.setChargeType(byId.getChargeType()); |
| | | MeditationCategory byId2 = meditationCategoryService.getById(byId.getCateId()); |
| | | if (byId2!=null){ |
| | | record.setMeditationCategoryName(byId2.getCategoryName()); |
| | | } |
| | | record.setCoverUrl(byId.getCoverUrl().split(",")[0]); |
| | | record.setMeditationName(byId.getMeditationTitle()); |
| | | |
| | | } |
| | | } |
| | | return R.ok(PageDTO.of(page, MeditationReport.class)); |
| | |
| | | byId.setAvatar(data.getAvatar()); |
| | | byId.setCellPhone(data.getCellPhone()); |
| | | } |
| | | byId.setReplyContent(byId3.getReplyContent()); |
| | | if (data1!=null){ |
| | | byId.setUserNameReport(data1.getNickname()); |
| | | byId.setAvatarReport(data1.getAvatar()); |
| | |
| | | Meditation byId1 = meditationService.getById(byId.getMeditationId()); |
| | | if (byId1!=null){ |
| | | byId.setMeditationName(byId1.getMeditationTitle()); |
| | | byId.setCoverUrl(byId1.getCoverUrl().split(",")[0]); |
| | | byId.setChargeType(byId1.getChargeType()); |
| | | } |
| | | MeditationCategory byId2 = meditationCategoryService.getById(byId1.getCateId()); |
| | | if (byId2!=null){ |
| | | byId.setMeditationCategoryName(byId2.getCategoryName()); |
| | | |
| | | } |
| | | return R.ok(); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @PostMapping("/deleteMeditationReportQuestion") |
| | |
| | | @ApiModel(value = "冥想音频管理-导出") |
| | | public class MeditationExport implements Serializable { |
| | | |
| | | @Excel(name = "关联疗愈",width = 30) |
| | | private String name; |
| | | |
| | | @Excel(name = "所属分类",width = 30) |
| | | private String categoryName; |
| | | @Excel(name = "疗愈标题",width = 30) |
| | | private String name; |
| | | @Excel(name = "描述文案",width = 30) |
| | | private String detailDescription; |
| | | @Excel(name = "价格",width = 30) |
| | |
| | | |
| | | private static final long serialVersionUID = -2959289858083878221L; |
| | | |
| | | @ApiModelProperty(value = "冥想背景音频列表") |
| | | @ApiModelProperty(value = "冥想背景音频列表-文件链接") |
| | | private List<String> meditationMusicList; |
| | | @ApiModelProperty(value = "冥想背景音频列表-文件时长 单位秒") |
| | | private List<Integer> meditationSecondList; |
| | | |
| | | @ApiModelProperty(value = "是否收藏 1:是 2:否") |
| | | private Integer favorite; |
| | |
| | | private Integer chargeType; |
| | | |
| | | @ApiModelProperty(value = "是否已付费 1:是 2:否") |
| | | private Integer paidStatus = 2; |
| | | private Integer isBuy ; |
| | | |
| | | @ApiModelProperty(value = "通用价格", notes = "价格设定为单独收费") |
| | | private BigDecimal generalPrice; |
| | |
| | | package com.xinquan.meditation.mapper; |
| | | |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | |
| | | package com.xinquan.meditation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.MeditationReport; |
| | | |
| | | /** |
| | |
| | | package com.xinquan.meditation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | package com.xinquan.meditation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.MeditationReport; |
| | | |
| | | /** |
| | |
| | | package com.xinquan.meditation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.domain.MeditationHall; |
| | |
| | | * @param id 冥想音频id |
| | | * @return 客户端冥想详情视图对象 |
| | | */ |
| | | ClientMeditationDetailsVO getMeditationDetails(Long id); |
| | | R<ClientMeditationDetailsVO> getMeditationDetails(Long id); |
| | | ClientMeditationDetailsVO getMeditationDetails1(Long id); |
| | | |
| | | /** |
| | |
| | | package com.xinquan.meditation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.enums.ReportStatusEnum; |
| | | import com.xinquan.common.core.exception.ServiceException; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.mapper.MeditationReportMapper; |
| | | import com.xinquan.meditation.service.MeditationReportService; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.domain.MeditationQuestionLike; |
| | | import com.xinquan.meditation.mapper.MeditationQuestionMapper; |
| | | import com.xinquan.meditation.service.MeditationQuestionLikeService; |
| | |
| | | package com.xinquan.meditation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xinquan.common.core.enums.ReportStatusEnum; |
| | | import com.xinquan.common.core.exception.ServiceException; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.domain.MeditationQuestionLike; |
| | | import com.xinquan.meditation.mapper.MeditationQuestionMapper; |
| | | import com.xinquan.meditation.mapper.MeditationReportMapper; |
| | | import com.xinquan.meditation.service.MeditationQuestionLikeService; |
| | | import com.xinquan.meditation.service.MeditationQuestionService; |
| | | import com.xinquan.meditation.service.MeditationReportService; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.MeditationReport; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.domain.*; |
| | | import com.xinquan.meditation.domain.vo.ClientMeditationAndCateVO; |
| | |
| | | import com.xinquan.order.api.domain.Order; |
| | | import com.xinquan.order.api.feign.RemoteOrderService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.vo.AppUserVO; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import com.xinquan.user.api.domain.dto.AppUserDTO; |
| | |
| | | Integer sanskritFlag = appUser.getSanskritFlag(); |
| | | if (StringUtils.hasLength(appUser.getTagId())) { |
| | | String tagId = appUser.getTagId(); |
| | | Set<Long> tagIdSet = Arrays.stream(tagId.split(",")).map(Long::parseLong) |
| | | .collect(Collectors.toSet()); |
| | | // 查询冥想列表 |
| | | voList = baseMapper.getMeditationListByTagId(tagIdSet, sanskritFlag); |
| | | if (StringUtils.hasLength(tagId)){ |
| | | Set<Long> tagIdSet = Arrays.stream(tagId.split(",")).map(Long::parseLong) |
| | | .collect(Collectors.toSet()); |
| | | // 查询冥想列表 |
| | | voList = baseMapper.getMeditationListByTagId(tagIdSet, sanskritFlag); |
| | | } |
| | | }else{ |
| | | Set<Long> longs = new HashSet<>(); |
| | | voList = baseMapper.getMeditationListByTagId(longs, sanskritFlag); |
| | |
| | | if (CollUtils.isNotEmpty(meditationIdList)) { |
| | | voList = voList.stream() |
| | | .filter(meditationVO -> meditationIdList.contains(meditationVO.getId())) |
| | | .peek(meditationVO -> meditationVO.setPaidStatus(1)) |
| | | .peek(meditationVO -> meditationVO.setIsBuy(1)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | return voList; |
| | |
| | | LambdaQueryWrapper<Meditation> meditationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | meditationLambdaQueryWrapper.eq(Meditation::getCateId, cateId); |
| | | if (appUser!=null){ |
| | | meditationLambdaQueryWrapper.eq(Meditation::getSanskrit, appUser.getSanskritFlag()); |
| | | if (appUser.getSanskritFlag() == 2){ |
| | | meditationLambdaQueryWrapper.eq(Meditation::getSanskrit, 2); |
| | | } |
| | | meditationLambdaQueryWrapper.orderByDesc(Meditation::getSortNum).last("limit 8"); |
| | | } |
| | | List<Meditation> list =this.list(meditationLambdaQueryWrapper); |
| | |
| | | */ |
| | | @Override |
| | | public List<ClientMeditationAndCateVO> getMeditationAndCateList() { |
| | | |
| | | // 获取当前登录用户 |
| | | List<ClientMeditationAndCateVO> voList = CollUtils.newArrayList(); |
| | | // 查询分类列表 |
| | |
| | | ClientMeditationAndCateVO vo = new ClientMeditationAndCateVO(); |
| | | vo.setClientMeditationCategoryVO( |
| | | BeanUtils.copyBean(cate, ClientMeditationCategoryVO.class)); |
| | | vo.setClientMeditationVOList(getMeditationListByCateId(cate.getId())); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | List<ClientMeditationVO> meditationListByCateId = getMeditationListByCateId(cate.getId()); |
| | | if (loginUser!=null){ |
| | | for (ClientMeditationVO clientMeditationVO : meditationListByCateId) { |
| | | Integer data = remoteOrderService.getMeditationIsBuy(loginUser.getUserid(),clientMeditationVO.getId() ).getData(); |
| | | clientMeditationVO.setIsBuy(data); |
| | | } |
| | | }else{ |
| | | for (ClientMeditationVO clientMeditationVO : meditationListByCateId) { |
| | | clientMeditationVO.setIsBuy(2); |
| | | } |
| | | }for (ClientMeditationVO record : meditationListByCateId) { |
| | | Long data = remoteAppUserService.getMeditationHistoryCount(record.getId()).getData(); |
| | | record.setRealLearnedNum(Integer.valueOf(data+"")); |
| | | record.setRealLearnedNum(record.getVirtualLearnedNum()+record.getRealLearnedNum()); |
| | | if (tokenService.getLoginUser()!=null){ |
| | | Integer data2 = remoteOrderService.getMeditationIsBuy(tokenService.getLoginUser().getUserid() |
| | | ,record.getId() ).getData(); |
| | | record.setIsBuy(data2); |
| | | }else{ |
| | | record.setIsBuy(2); |
| | | } |
| | | Meditation byId = this.getById(record.getId()); |
| | | byId.setRealLearnedNum(Integer.valueOf(data+"")); |
| | | this.updateById(byId); |
| | | } |
| | | vo.setClientMeditationVOList(meditationListByCateId); |
| | | voList.add(vo); |
| | | } |
| | | return voList; |
| | |
| | | LambdaQueryWrapper<Meditation> meditationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | meditationLambdaQueryWrapper.eq(Meditation::getCateId, cateId); |
| | | if (appUser!=null){ |
| | | meditationLambdaQueryWrapper.eq(Meditation::getSanskrit, appUser.getSanskritFlag()); |
| | | if (appUser.getSanskritFlag() == 2){ |
| | | meditationLambdaQueryWrapper.eq(Meditation::getSanskrit, 2); |
| | | } |
| | | } |
| | | meditationLambdaQueryWrapper.orderByDesc(Meditation::getSortNum); |
| | | Page<Meditation> page = this.page(new Page<>(pageCurr, pageSize), meditationLambdaQueryWrapper); |
| | | // 如果没有查到数据直接返回 |
| | | if (page.getRecords().isEmpty()) { |
| | | return pageDTO; |
| | | } |
| | | for (Meditation record : page.getRecords()) { |
| | | Long data = remoteAppUserService.getMeditationHistoryCount(record.getId()).getData(); |
| | | record.setRealLearnedNum(Integer.valueOf(data+"")); |
| | | record.setRealLearnedNum(record.getVirtualLearnedNum()+record.getRealLearnedNum()); |
| | | if (tokenService.getLoginUser()!=null){ |
| | | Integer data2 = remoteOrderService.getMeditationIsBuy(tokenService.getLoginUser().getUserid() |
| | | ,record.getId() ).getData(); |
| | | record.setIsBuy(data2); |
| | | }else{ |
| | | record.setIsBuy(2); |
| | | } |
| | | this.updateById(record); |
| | | } |
| | | // 将实体类转换为VO |
| | | pageDTO = PageDTO.of(page, ClientMeditationVO.class); |
| | |
| | | * @return 客户端冥想详情视图对象 |
| | | */ |
| | | @Override |
| | | public ClientMeditationDetailsVO getMeditationDetails(Long id) { |
| | | AppUserVO data1 = remoteAppUserService.getCurrentUser().getData(); |
| | | |
| | | |
| | | public R<ClientMeditationDetailsVO> getMeditationDetails(Long id) { |
| | | // 查询冥想音频 |
| | | Meditation meditation = this.getById(id); |
| | | ClientMeditationDetailsVO vo = BeanUtils.copyBean(meditation, |
| | | ClientMeditationDetailsVO.class); |
| | | if (data1.getVipExpireTime()!=null && data1.getVipExpireTime().isAfter(LocalDateTime.now())){ |
| | | vo.setIsVip(1); |
| | | }else{ |
| | | vo.setIsVip(0); |
| | | if (meditation.getChargeType() != 1){ |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userid = loginUser.getUserid(); |
| | | AppUser data1 = remoteAppUserService.getAppUserById(userid + "").getData(); |
| | | |
| | | if (data1.getVipExpireTime()!=null && data1.getVipExpireTime().isAfter(LocalDateTime.now())){ |
| | | vo.setIsVip(1); |
| | | }else{ |
| | | vo.setIsVip(0); |
| | | } |
| | | Integer data = remoteOrderService.getMeditationIsBuy(data1.getId(), id).getData(); |
| | | vo.setIsBuy(data); |
| | | List<MeditationUserFavorite> list = meditationUserFavoriteService.lambdaQuery() |
| | | .eq(MeditationUserFavorite::getMeditationId, id) |
| | | .eq(MeditationUserFavorite::getAppUserId, userid).list(); |
| | | |
| | | if (list.isEmpty()){ |
| | | vo.setFavorite(2); |
| | | }else{ |
| | | vo.setFavorite(1); |
| | | } |
| | | } |
| | | Integer data = remoteOrderService.getMeditationIsBuy(data1.getId(), id).getData(); |
| | | vo.setIsBuy(data); |
| | | // 查询冥想音频 |
| | | List<MeditationMusic> meditationMusics = meditationMusicMapper.selectList( |
| | | Wrappers.lambdaQuery(MeditationMusic.class) |
| | |
| | | // 获取音频链接 |
| | | List<String> musicUrlList = meditationMusics.stream() |
| | | .map(MeditationMusic::getMusicUrl).collect(Collectors.toList()); |
| | | // 获取音频链接 |
| | | List<Integer> musicSencodList = meditationMusics.stream() |
| | | .map(MeditationMusic::getMusicSecond).collect(Collectors.toList()); |
| | | vo.setMeditationMusicList(musicUrlList); |
| | | vo.setMeditationSecondList(musicSencodList); |
| | | } |
| | | // 获取提问数 |
| | | vo.setQuestionCount(meditationQuestionMapper.selectCount( |
| | | Wrappers.lambdaQuery(MeditationQuestion.class) |
| | | .eq(MeditationQuestion::getMeditationId, id))); |
| | | return vo; |
| | | .eq(MeditationQuestion::getMeditationId, id) |
| | | .eq(MeditationQuestion::getShowFlag,1))); |
| | | if (tokenService.getLoginUser()!=null){ |
| | | Integer data2 = remoteOrderService.getMeditationIsBuy(tokenService.getLoginUser().getUserid(), id).getData(); |
| | | vo.setIsBuy(data2); |
| | | } |
| | | |
| | | return R.ok(vo); |
| | | } |
| | | @Override |
| | | public ClientMeditationDetailsVO getMeditationDetails1(Long id) { |
| | |
| | | // 获取提问数 |
| | | vo.setQuestionCount(meditationQuestionMapper.selectCount( |
| | | Wrappers.lambdaQuery(MeditationQuestion.class) |
| | | .eq(MeditationQuestion::getMeditationId, id))); |
| | | .eq(MeditationQuestion::getMeditationId, id) |
| | | .eq(MeditationQuestion::getShowFlag,1))); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | and m.del_flag = 0 |
| | | </where> |
| | | group by mt.meditation_id |
| | | ORDER BY sort_num DESC |
| | |
| | | t1.longitude as longitude, |
| | | t1.latitude as latitude, |
| | | t1.cover_url as coverUrl, |
| | | t1.sort_num as sortNum, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | |
| | | <if test="name!=null and name!=''"> |
| | | and t1.hall_name like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | |
| | | |
| | | order by distance asc, t1.sort_num desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <mapper namespace="com.xinquan.meditation.mapper.MeditationQuestionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.xinquan.system.api.domain.MeditationQuestion"> |
| | | <resultMap id="BaseResultMap" type="com.xinquan.meditation.api.domain.MeditationQuestion"> |
| | | <id column="id" property="id" /> |
| | | <result column="meditation_id" property="meditationId"/> |
| | | <result column="del_flag" property="delFlag" /> |
| | |
| | | @GetMapping("/getMeditationIsBuy/{id}/{meditationId}") |
| | | public R<Integer> getMeditationIsBuy(@PathVariable("id")Long id,@PathVariable("meditationId")Long meditationId) { |
| | | List<Order> list = orderService.lambdaQuery().eq(Order::getBusinessId, meditationId) |
| | | .eq(Order::getAppUserId, id) |
| | | .eq(Order::getOrderFrom, 1) |
| | | .eq(Order::getPaymentStatus, 2) |
| | | .ne(Order::getRefundStatus, 3).list(); |
| | |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Page<Order> page = orderService.lambdaQuery() |
| | | .eq(Order::getAppUserId, userId) |
| | | List<OrderCourseVO> res = new ArrayList<>(); |
| | | List<Order> page = orderService.lambdaQuery() |
| | | .eq(Order::getOrderFrom, state) |
| | | .ne(Order::getPaymentStatus, 3) |
| | | .orderByDesc(BaseModel::getCreateTime).page(new Page<>(pageCurr, pageSize)); |
| | | |
| | | PageDTO<OrderCourseVO> res = PageDTO.of(page, OrderCourseVO.class); |
| | | List<OrderCourseVO> list = res.getList(); |
| | | ArrayList<OrderCourseVO> orderCourseVOS = new ArrayList<>(); |
| | | for (OrderCourseVO orderCourseVO : res.getList()) { |
| | | .orderByDesc(BaseModel::getCreateTime).list(); |
| | | List<Order> list = orderService.lambdaQuery().eq(Order::getGiveUserId, userId).list(); |
| | | for (Order order : page) { |
| | | if (order.getAppUserId().equals(userId) && order.getGiveUserId() == null){ |
| | | OrderCourseVO orderCourseVO = new OrderCourseVO(); |
| | | BeanUtils.copyProperties(order, orderCourseVO); |
| | | res.add(orderCourseVO); |
| | | } |
| | | if (order.getGiveUserId()!=null&&order.getGiveUserId().equals(userId)){ |
| | | OrderCourseVO orderCourseVO = new OrderCourseVO(); |
| | | BeanUtils.copyProperties(order, orderCourseVO); |
| | | res.add(orderCourseVO); |
| | | } |
| | | } |
| | | for (OrderCourseVO orderCourseVO : res) { |
| | | switch (orderCourseVO.getOrderFrom()){ |
| | | case 1: |
| | | Meditation data1 = remoteMeditationService.getMeditationById(orderCourseVO.getBusinessId()).getData(); |
| | |
| | | orderCourseVO.setCount(data3+temp); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | return R.ok(res.getList()); |
| | | List<OrderCourseVO> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | return R.ok(testing); |
| | | } |
| | | public static List<OrderCourseVO> testing(long total, long current, long size, List<OrderCourseVO> str){ |
| | | List<OrderCourseVO> result = new ArrayList<>(); |
| | | //获取初始化分页结构 |
| | | Page<OrderCourseVO> page = new Page<>(current - 1, size, total); |
| | | //获取集合下标初始值 |
| | | long startIndex = (current - 1) * size; |
| | | //获取集合下标结束值 |
| | | long endInddex = 0; |
| | | if(startIndex + page.getCurrent() >= total || size > total){ |
| | | endInddex = total; |
| | | }else { |
| | | endInddex = Math.min(startIndex + page.getSize(), total); |
| | | } |
| | | //如果输入的开始查询下标大于集合大小,则查询为空值 |
| | | if(startIndex > total){ |
| | | result = Collections.emptyList(); |
| | | }else{ |
| | | result = str.subList((int)startIndex,(int)endInddex); |
| | | } |
| | | return result; |
| | | } |
| | | /** |
| | | * 根据邀请用户ids 查询对应佣金 |
| | |
| | | AppUser data = remoteAppUserService.getAppUserById(order.getAppUserId() + "").getData(); |
| | | BigDecimal realPayAmount = order.getRealPayAmount(); |
| | | if (data.getInviteUserId()!=null) { |
| | | if (order.getOrderFrom() == 1 || order.getOrderFrom() == 2) { |
| | | // 分佣给上级 先远程查询分佣比例 |
| | | CommissionRule data1 = sysUserClient.getCommission().getData(); |
| | | if (data1 != null) { |
| | | if (data1.getProportion() != null) { |
| | | BigDecimal bigDecimal = realPayAmount.multiply(data1.getProportion()) |
| | | .setScale(2, BigDecimal.ROUND_HALF_DOWN); |
| | | // 上级获取的分佣金额 |
| | | AppUser appUserById = remoteAppUserService.getAppUserById(data.getInviteUserId() + "").getData(); |
| | | // 更新用户余额 |
| | | remoteAppUserService.updateAppUser( |
| | | AppUserDTO.builder().balance( |
| | | appUserById.getBalance().add(bigDecimal)) |
| | | .build(), SecurityConstants.INNER); |
| | | // 新增分佣流水明细 |
| | | AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord(); |
| | | appUserWalletRecord.setAppUserId(data.getInviteUserId()); |
| | | appUserWalletRecord.setChangeType(1); |
| | | appUserWalletRecord.setReason("分佣收益"); |
| | | appUserWalletRecord.setAmount(bigDecimal); |
| | | appUserWalletRecord.setChildAppUserId(order.getAppUserId()); |
| | | appUserWalletRecord.setOrderId(order.getId()); |
| | | remoteAppUserService.addBalanceRecord(appUserWalletRecord); |
| | | order.setCommissionAmount(bigDecimal); |
| | | order.setCommissionId(data.getInviteUserId()); |
| | | orderService.updateById(order); |
| | | } |
| | | } |
| | | if (order.getOrderFrom() == 1 || order.getOrderFrom() == 2 || order.getOrderFrom() == 3) { |
| | | // // 查询实际支付价格 不包含余额抵扣价格 |
| | | // OrderPaymentRecord one1 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, order.getId()) |
| | | // .one(); |
| | | // // 分佣给上级 先远程查询分佣比例 |
| | | // CommissionRule data1 = sysUserClient.getCommission().getData(); |
| | | // if (data1 != null) { |
| | | // if (data1.getProportion() != null) { |
| | | // |
| | | // BigDecimal bigDecimal = one1.getPayAmount().multiply(data1.getProportion()).divide(new BigDecimal("100")) |
| | | // .setScale(2, BigDecimal.ROUND_HALF_DOWN); |
| | | // // 上级获取的分佣金额 |
| | | // AppUser appUserById = remoteAppUserService.getAppUserById(data.getInviteUserId() + "").getData(); |
| | | // // 更新用户余额 |
| | | // remoteAppUserService.updateAppUser( |
| | | // AppUserDTO.builder().balance( |
| | | // appUserById.getBalance().add(bigDecimal)) |
| | | // .build(), SecurityConstants.INNER); |
| | | // // 新增分佣流水明细 |
| | | // AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord(); |
| | | // appUserWalletRecord.setAppUserId(data.getInviteUserId()); |
| | | // appUserWalletRecord.setChangeType(1); |
| | | // appUserWalletRecord.setReason("分佣收益"); |
| | | // appUserWalletRecord.setAmount(bigDecimal); |
| | | // appUserWalletRecord.setChildAppUserId(order.getAppUserId()); |
| | | // appUserWalletRecord.setOrderId(order.getId()); |
| | | // remoteAppUserService.addBalanceRecord(appUserWalletRecord); |
| | | // order.setCommissionAmount(bigDecimal); |
| | | // order.setCommissionId(data.getInviteUserId()); |
| | | // orderService.updateById(order); |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | return R.ok(); |
| | |
| | | // 支付金额 |
| | | String string3 = jsonObject1.getString("pay_fee"); |
| | | Order one = orderService.lambdaQuery().eq(Order::getBizOrderNo, string).one(); |
| | | if (one.getPaymentStatus()==2){ |
| | | return; |
| | | } |
| | | one.setPaymentStatus(2); |
| | | one.setPaymentTime(LocalDateTime.now()); |
| | | OrderPaymentRecord one2 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId()) |
| | |
| | | // 判断订单所属用户是否有上级 是否需要做分佣处理 |
| | | AppUser data = remoteAppUserService.getAppUserById(one.getAppUserId() + "").getData(); |
| | | if (data.getInviteUserId()!=null) { |
| | | if (one.getOrderFrom() == 1 || one.getOrderFrom() == 2) { |
| | | // 分佣给上级 先远程查询分佣比例 |
| | | if (one.getOrderFrom() == 1 || one.getOrderFrom() == 2 || one.getOrderFrom() == 3) { |
| | | // 查询实际支付价格 不包含余额抵扣价格 |
| | | OrderPaymentRecord one1 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId()) |
| | | .ne(OrderPaymentRecord::getPaymentType, 4).one(); |
| | | // 分佣给上级 先远程查询分佣比例 |
| | | CommissionRule data1 = sysUserClient.getCommission().getData(); |
| | | if (data1 != null) { |
| | | if (data1.getProportion() != null) { |
| | | BigDecimal bigDecimal = realPayAmount.multiply(data1.getProportion()) |
| | | |
| | | BigDecimal bigDecimal = one1.getPayAmount().multiply(data1.getProportion()).divide(new BigDecimal("100")) |
| | | .setScale(2, BigDecimal.ROUND_HALF_DOWN); |
| | | // 上级获取的分佣金额 |
| | | AppUser appUserById = remoteAppUserService.getAppUserById(data.getInviteUserId() + "").getData(); |
| | | // 更新用户余额 |
| | | remoteAppUserService.updateAppUser( |
| | | AppUserDTO.builder().balance( |
| | | appUserById.getBalance().add(bigDecimal)) |
| | | .build(), SecurityConstants.INNER); |
| | | // remoteAppUserService.updateAppUser( |
| | | // AppUserDTO.builder().balance( |
| | | // appUserById.getBalance().add(bigDecimal)) |
| | | // .build(), SecurityConstants.INNER); |
| | | // 新增分佣流水明细 |
| | | AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord(); |
| | | appUserWalletRecord.setAppUserId(data.getInviteUserId()); |
| | |
| | | if (data4!=null){ |
| | | if (data4.getProportion()!=null){ |
| | | BigDecimal bigDecimal = realPayAmount.multiply(data4.getProportion()) |
| | | .setScale(2, BigDecimal.ROUND_HALF_DOWN); |
| | | .divide(new BigDecimal(100),2, BigDecimal.ROUND_DOWN); |
| | | // 上级获取的分佣金额 |
| | | AppUser appUserById = remoteAppUserService.getAppUserById(data3.getInviteUserId() + "").getData(); |
| | | // 更新用户余额 |
| | |
| | | .eq(OrderPaymentRecord::getPaymentStatus, 2).one(); |
| | | if (two==null){ |
| | | one.setRemark("余额支付"); |
| | | one.setBalance(one.getTotalAmount()); |
| | | }else{ |
| | | switch (two.getPaymentType()){ |
| | | case 1: |
| | |
| | | } |
| | | if (!time.equals("1")){ |
| | | String[] split = time.split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | } |
| | | if (startTime!=null){ |
| | | orderLambdaQueryWrapper.between(Order::getCreateTime,startTime,endTime); |
| | |
| | | if (data!=null){ |
| | | record.setCategoryMeditationName(data.getCategoryName()); |
| | | record.setMeditationTitle(data.getMeditationTitle()); |
| | | record.setIconUrl(data.getIconUrl()); |
| | | record.setIconUrl(data.getCoverUrl()); |
| | | record.setDetailDescription(data.getDetailDescription()); |
| | | record.setGeneralPriceMeditation(data.getGeneralPrice()); |
| | | record.setListingStatusMeditation(data.getListingStatus()); |
| | |
| | | String endTime = null; |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getTime())){ |
| | | String[] split = courseDTO.getTime().split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | } |
| | | List<Integer> payType1 = new ArrayList<>(); |
| | | payType1.add(1); |
| | |
| | | payType3.add(3); |
| | | payType3.add(7); |
| | | List<Integer> payType4 = new ArrayList<>(); |
| | | payType3.add(4); |
| | | payType3.add(5); |
| | | payType3.add(6); |
| | | payType3.add(7); |
| | | payType4.add(4); |
| | | payType4.add(5); |
| | | payType4.add(6); |
| | | payType4.add(7); |
| | | LambdaQueryWrapper<Order> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (startTime!=null){ |
| | | courseLambdaQueryWrapper.between(Order::getCreateTime, startTime, endTime); |
| | |
| | | courseLambdaQueryWrapper.eq(courseDTO.getUid()!=null&&(!courseDTO.getUid().isEmpty()),Order::getAppUserId, courseDTO.getUid()); |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getBuyContent())){ |
| | | // 查询购买内容 |
| | | List<Long> collect1 = orderService.lambdaQuery().like(Order::getVipType, courseDTO.getBuyContent()).list().stream() |
| | | List<Long> collect1 = orderService.lambdaQuery().like(Order::getBuyContent, courseDTO.getBuyContent()).list().stream() |
| | | .map(Order::getId).collect(Collectors.toList()); |
| | | List<Long> collect2 = orderService.lambdaQuery().like(Order::getBizOrderNo, courseDTO.getBuyContent()).list().stream() |
| | | .map(Order::getId).collect(Collectors.toList()); |
| | |
| | | if (data!=null){ |
| | | record.setCategoryMeditationName(data.getCategoryName()); |
| | | record.setMeditationTitle(data.getMeditationTitle()); |
| | | record.setIconUrl(data.getIconUrl()); |
| | | record.setIconUrl(StringUtils.hasLength(data.getCoverUrl())?data.getCoverUrl().split(",")[0]:""); |
| | | record.setDetailDescription(data.getDetailDescription()); |
| | | record.setGeneralPriceMeditation(data.getGeneralPrice()); |
| | | record.setGeneralPriceMeditation(record.getRealPayAmount()); |
| | | record.setListingStatusMeditation(data.getListingStatus()); |
| | | record.setMeditationUid(data.getId()+""); |
| | | } |
| | |
| | | record.setCoverUrl(data1.getCoverUrl()); |
| | | record.setTutor(data1.getTutor()); |
| | | record.setCourseChapterCount(data1.getCourseChapterCount()); |
| | | record.setGeneralPriceCourse(data1.getGeneralPrice()); |
| | | record.setGeneralPriceCourse(record.getRealPayAmount()); |
| | | record.setListingStatusCourse(data1.getListingStatus()); |
| | | record.setCourseUid(data1.getId()+""); |
| | | } |
| | | break; |
| | | case 3: |
| | | record.setBuyContent(record.getVipType()); |
| | | record.setBuyContent(record.getBuyContent()); |
| | | record.setGeneralPriceVip(record.getRealPayAmount()); |
| | | break; |
| | | } |
| | |
| | | String endTime = null; |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getTime())){ |
| | | String[] split = courseDTO.getTime().split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | } |
| | | List<Integer> payType1 = new ArrayList<>(); |
| | | payType1.add(1); |
| | |
| | | payType3.add(3); |
| | | payType3.add(7); |
| | | List<Integer> payType4 = new ArrayList<>(); |
| | | payType3.add(4); |
| | | payType3.add(5); |
| | | payType3.add(6); |
| | | payType3.add(7); |
| | | payType4.add(4); |
| | | payType4.add(5); |
| | | payType4.add(6); |
| | | payType4.add(7); |
| | | LambdaQueryWrapper<Order> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | courseLambdaQueryWrapper.between(Order::getCreateTime, startTime, endTime); |
| | | if (startTime!=null){ |
| | | courseLambdaQueryWrapper.between(Order::getCreateTime, startTime, endTime); |
| | | } |
| | | if (courseDTO.getPayType()!=null){ |
| | | switch (courseDTO.getPayType()){ |
| | | case 1: |
| | |
| | | courseLambdaQueryWrapper.eq(courseDTO.getOrderFrom()!=null,Order::getOrderFrom, courseDTO.getOrderFrom()); |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getBuyContent())){ |
| | | // 查询购买内容 |
| | | List<Long> collect1 = orderService.lambdaQuery().like(Order::getVipType, courseDTO.getBuyContent()).list().stream() |
| | | List<Long> collect1 = orderService.lambdaQuery().like(Order::getBuyContent, courseDTO.getBuyContent()).list().stream() |
| | | .map(Order::getId).collect(Collectors.toList()); |
| | | List<Long> collect2 = orderService.lambdaQuery().like(Order::getBizOrderNo, courseDTO.getBuyContent()).list().stream() |
| | | .map(Order::getId).collect(Collectors.toList()); |
| | |
| | | record.setCourseUid(data1.getId()+""); |
| | | record.setType(data1.getCourseType()+""); |
| | | record.setUuid(data1.getId()+""); |
| | | record.setCourseChapterCount(data1.getCourseChapterCount()); |
| | | } |
| | | break; |
| | | case 3: |
| | | record.setBuyContent(record.getVipType()); |
| | | record.setBuyContent(record.getBuyContent()); |
| | | record.setGeneralPriceVip(record.getRealPayAmount()); |
| | | break; |
| | | } |
| | |
| | | AppUser appUser = getAppUserById(userId); |
| | | ClientPlaceOrderVO clientPlaceOrderVO = new ClientPlaceOrderVO(); |
| | | Order order = new Order(); |
| | | order.setPayType(payType); |
| | | // 购买冥想音频 |
| | | if (orderFrom == 1) { |
| | | Meditation meditation = remoteMeditationService.getMeditationById(targetId, |
| | |
| | | order.setBizOrderNo(orderNo); |
| | | order.setBusinessId(meditation.getId()); |
| | | order.setAppUserId(userId); |
| | | |
| | | order.setRealPayAmount(meditation.getGeneralPrice()); |
| | | order.setPayType(payType); |
| | | order.setTotalAmount(meditation.getGeneralPrice()); |
| | | order.setGiveUserId(receiverId); |
| | | this.save(order); |
| | | Long orderId = order.getId(); |
| | | clientPlaceOrderVO.setOrderNo(orderNo); |
| | |
| | | order.setGiveUserId(receiverId); |
| | | order.setBusinessId(course.getId()); |
| | | order.setAppUserId(userId); |
| | | order.setRealPayAmount(course.getGeneralPrice()); |
| | | order.setTotalAmount(course.getGeneralPrice()); |
| | | this.save(order); |
| | | Long orderId = order.getId(); |
| | |
| | | * @return AppUser |
| | | */ |
| | | private AppUser getAppUserById(Long userId) { |
| | | return remoteAppUserService.getUserByCondition( |
| | | AppUserDTO.builder().id(userId).build(), |
| | | SecurityConstants.INNER).getData(); |
| | | return remoteAppUserService.getAppUserById(userId+"").getData(); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 调用第三方支付获取支付信息 |
| | | JSONObject payInfo = JuHeFuUtil.createPayment1(orderNo, payType, |
| | | needPayAmount.toString(), goodsTitle, goodsDesc, |
| | | IpUtils.getIpAddr(), wxOpenId, "https://v7ro848ar5jx.ngrok.xiaomiqiu123.top/order/client/order/order/base/callback"); |
| | | IpUtils.getIpAddr(), wxOpenId, "https://xq.xqzhihui.com/api/order/client/order/order/base/callback"); |
| | | // 第三方支付记录 |
| | | OrderPaymentRecord paymentRecord = new OrderPaymentRecord(); |
| | | paymentRecord.setOrderId(orderId); |
| | |
| | | // 调用第三方支付获取支付信息 |
| | | JSONObject payInfo = JuHeFuUtil.createPayment(orderNo, payType, |
| | | needPayAmount.toString(), goodsTitle, goodsDesc, |
| | | IpUtils.getIpAddr(), wxOpenId, "https://v7ro848ar5jx.ngrok.xiaomiqiu123.top/order/client/order/order/base/callback"); |
| | | IpUtils.getIpAddr(), wxOpenId, "https://xq.xqzhihui.com/api/order/client/order/order/base/callback"); |
| | | // 第三方支付记录 |
| | | OrderPaymentRecord paymentRecord = new OrderPaymentRecord(); |
| | | paymentRecord.setOrderId(orderId); |
| | |
| | | createPaymentCode("CZ19281833123", 1, "0.01", |
| | | "充值", "充值", |
| | | "127.0.0.1", "openId", |
| | | "https://v7ro848ar5jx.ngrok.xiaomiqiu123.top/order/client/order/order/base/callback"); |
| | | "https://xq.xqzhihui.com/api/order/client/order/order/base/callback"); |
| | | // String orderNo = OrderUtil.getOrderNoForPrefix("User"); |
| | | // createUser("usera12937812893718297391"); |
| | | //// balancePay("12345678912", "0.01", "http://www.baidu.com"); |
| | |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | Page<CommonQuestion> page = commonQuestionService.lambdaQuery() |
| | | .eq(CommonQuestion::getType,1) |
| | | .orderByDesc(CommonQuestion::getSortNum) |
| | | |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(PageDTO.empty(page)); |
| | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.DateUtils; |
| | | import com.xinquan.common.core.utils.WebUtils; |
| | | import com.xinquan.common.core.utils.page.BeanUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private RemoteMeditationService remoteMeditationService; |
| | | @Resource |
| | | private RemoteOrderService remoteOrderService; |
| | | |
| | | @PostMapping("/homeStatistics") |
| | | @ApiOperation(value = "首页统计",tags = "管理后台-首页统计") |
| | | public R<HomeVO> bannerList(@RequestBody HomeDto homeDto) { |
| | |
| | | if (!StringUtils.hasLength(homeDto.getTime())){ |
| | | homeDto.setTime("1"); |
| | | } |
| | | if(homeDto.getTimeType() == null){ |
| | | homeDto.setTimeType(1); |
| | | } |
| | | |
| | | List<Order> data6 = remoteOrderService.getOrderList(homeDto.getStatus(), homeDto.getTimeType(), homeDto.getTime()).getData(); |
| | | homeVO.setOrderCount(data6.size()+""); |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | |
| | | } |
| | | break; |
| | | } |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | List<LocalDate> localDates = generateDateList(homeDto.getTime()); |
| | | for (LocalDate localDate : localDates) { |
| | | x.put(localDate+"",0); |
| | | x1.put(localDate+"",0); |
| | | x2.put(localDate+"",0); |
| | | } |
| | | |
| | | } |
| | | for (Order order : data6) { |
| | | int value = order.getCreateTime().getMonth().getValue(); |
| | | int value1 = order.getCreateTime().getDayOfMonth(); |
| | | LocalDateTime createTime = order.getCreateTime(); |
| | | LocalDate localDate = createTime.toLocalDate(); |
| | | switch (order.getOrderFrom()){ |
| | | case 1: |
| | | switch (homeDto.getTimeType()){ |
| | | case 1: |
| | | // 获取订单月份 |
| | | x.put(value+"",(int)x.get(value+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x.put(localDate+"",(int)x.get(value+"")+1); |
| | | }else{ |
| | | x.put(value+"",(int)x.get(value+"")+1); |
| | | } |
| | | break; |
| | | case 2: |
| | | Date date = new Date(); |
| | | String format = simpleDateFormat.format(date); |
| | | x.put(format,(int)x.get(format)+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x.put(localDate+"",(int)x.get(value+"")+1); |
| | | }else{ |
| | | x.put(format,(int)x.get(format)+1); |
| | | } |
| | | break; |
| | | case 3: |
| | | x.put(value1+"",(int)x.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x.put(localDate+"",(int)x.get(value+"")+1); |
| | | }else{ |
| | | x.put(value1+"",(int)x.get(value1+"")+1); |
| | | } |
| | | break; |
| | | case 4: |
| | | x.put(value1+"",(int)x.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x.put(localDate+"",(int)x.get(value+"")+1); |
| | | }else{ |
| | | x.put(value1+"",(int)x.get(value1+"")+1); |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | |
| | | switch (homeDto.getTimeType()){ |
| | | case 1: |
| | | // 获取订单月份 |
| | | x1.put(value+"",(int)x1.get(value+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x1.put(localDate+"",(int)x1.get(value+"")+1); |
| | | }else{ |
| | | x1.put(value+"",(int)x1.get(value+"")+1); |
| | | } |
| | | break; |
| | | case 2: |
| | | Date date = new Date(); |
| | | String format = simpleDateFormat.format(date); |
| | | x1.put(format,(int)x1.get(format)+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x1.put(localDate+"",(int)x1.get(value+"")+1); |
| | | }else{ |
| | | x1.put(format,(int)x1.get(format)+1); |
| | | } |
| | | break; |
| | | case 3: |
| | | x1.put(value1+"",(int)x1.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x1.put(localDate+"",(int)x1.get(value+"")+1); |
| | | }else{ |
| | | x1.put(value+"",(int)x1.get(value+"")+1); |
| | | } |
| | | break; |
| | | case 4: |
| | | x1.put(value1+"",(int)x1.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x1.put(localDate+"",(int)x1.get(value+"")+1); |
| | | }else{ |
| | | x1.put(value+"",(int)x1.get(value+"")+1); |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | |
| | | switch (homeDto.getTimeType()){ |
| | | case 1: |
| | | // 获取订单月份 |
| | | x2.put(value+"",(int)x2.get(value+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x2.put(localDate+"",(int)x2.get(value+"")+1); |
| | | }else{ |
| | | x2.put(value+"",(int)x2.get(value+"")+1); |
| | | } |
| | | break; |
| | | case 2: |
| | | Date date = new Date(); |
| | | String format = simpleDateFormat.format(date); |
| | | x2.put(format,(int)x2.get(format)+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x2.put(localDate+"",(int)x2.get(value+"")+1); |
| | | }else{ |
| | | x2.put(format,(int)x2.get(format)+1); |
| | | } |
| | | break; |
| | | case 3: |
| | | x2.put(value1+"",(int)x2.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x2.put(localDate+"",(int)x2.get(value+"")+1); |
| | | }else{ |
| | | x2.put(value+"",(int)x2.get(value+"")+1); |
| | | } |
| | | break; |
| | | case 4: |
| | | x2.put(value1+"",(int)x2.get(value1+"")+1); |
| | | if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ |
| | | x2.put(localDate+"",(int)x2.get(value+"")+1); |
| | | }else{ |
| | | x2.put(value+"",(int)x2.get(value+"")+1); |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | switch (homeDto.getTimeType()){ |
| | | case 1: |
| | | break; |
| | | case 2: |
| | | break; |
| | | case 3: |
| | | break; |
| | | case 4: |
| | | break; |
| | | } |
| | | |
| | | // 对x的key值进行从小到大排序 |
| | | Map<String, Object> sortedMap = new TreeMap<>(Comparator.reverseOrder()); |
| | | sortedMap.putAll(x); |
| | |
| | | homeVO.setOrderVipList(sortedMap2); |
| | | return R.ok(homeVO); |
| | | } |
| | | public static List<LocalDate> generateDateList(String dateRange) { |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | // 解析日期范围字符串 |
| | | String[] dates = dateRange.split(" - "); |
| | | LocalDate startDate = LocalDate.parse(dates[0], formatter); |
| | | LocalDate endDate = LocalDate.parse(dates[1], formatter); |
| | | |
| | | // 创建日期列表 |
| | | List<LocalDate> dateList = new ArrayList<>(); |
| | | for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { |
| | | dateList.add(date); |
| | | } |
| | | |
| | | return dateList; |
| | | } |
| | | @PutMapping("/homeStatisticsExport") |
| | | @ApiOperation(value = "首页统计-导出",tags = "管理后台-首页统计") |
| | | public void homeStatisticsExport() { |
| | |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "热词管理-添加热词", tags = {"管理后台-运营中心"}) |
| | | public R add(@RequestBody HotWords hotWords) { |
| | | int size = hotWordsService.lambdaQuery().list().size(); |
| | | if (size>=20){ |
| | | return R.fail("热词数量已达上限"); |
| | | } |
| | | hotWordsService.save(hotWords); |
| | | return R.ok(); |
| | | } |
| | |
| | | if(one == null){ |
| | | Page page = new Page(); |
| | | page.setImg(img); |
| | | page.setType(1); |
| | | pageService.save(page); |
| | | }else{ |
| | | one.setType(1); |
| | | one.setImg(img); |
| | | pageService.updateById(one); |
| | | } |
| | |
| | | user.setDeptId(dto.getDeptId()); |
| | | user.setStatus(String.valueOf(dto.getStatus())); |
| | | user.setReason(dto.getReason()); |
| | | user.setDisableTime(LocalDateTime.now()); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = userService.selectUserById(userid); |
| | | user.setUpdateBy(sysUser.getNickName()+"("+sysUser.getUserName()+")"); |
| | |
| | | private ISysPermissionService permissionService; |
| | | @Resource |
| | | private ISysUserDeptService sysUserDeptService; |
| | | |
| | | |
| | | @PostMapping("/removeByAppUserId/{id}") |
| | | public AjaxResult removeByAppUserId(@PathVariable("id") Long id) |
| | | { |
| | | SysUser byId = userService.getById(id); |
| | | userService.removeById(byId); |
| | | return AjaxResult.success(); |
| | | } |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | |
| | | user.setUpdateTime(LocalDateTime.now()); |
| | | if (user.getPassword()!=null){ |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | |
| | | return AjaxResult.success(userService.resetPwd(user)); |
| | | } |
| | | |
| | | return AjaxResult.success(userService.updateUser(user)); |
| | |
| | | user.setUserId(dto.getUserId()); |
| | | user.setStatus(String.valueOf(dto.getStatus())); |
| | | user.setReason(dto.getReason()); |
| | | user.setDisableTime(LocalDateTime.now()); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = userService.selectUserById(userid); |
| | | user.setUpdateBy(sysUser.getNickName()+"("+sysUser.getUserName()+")"); |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions("system:user:edit") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.resetPwd(user)); |
| | |
| | | @PostMapping("/getTreeGroup") |
| | | @ApiOperation(value = "获取树苗音频等级列表",tags = "管理后台-树苗音频设置") |
| | | public R<List<TreeLevelSetting>> getTreeGroup() { |
| | | List<TreeLevelSetting> list = treeLevelSettingService.lambdaQuery().list(); |
| | | List<TreeLevelSetting> list = treeLevelSettingService.lambdaQuery(). |
| | | orderByAsc(TreeLevelSetting::getTreeLevelType).list(); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.system.domain.Version; |
| | | import com.xinquan.system.service.VersionService; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private VersionService versionService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private RemoteAppUserService remoteAppUserService; |
| | | @GetMapping("/versionList") |
| | | @ApiOperation(value = "版本管理列表-分页", tags = {"管理后台-版本管理"}) |
| | | @ApiImplicitParams({ |
| | |
| | | public R addVersion(@RequestBody Version homeBackgroundMusic) { |
| | | homeBackgroundMusic.setCreateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setCreateTime(LocalDateTime.now()); |
| | | List<AppUser> data = remoteAppUserService.getAllUserList().getData(); |
| | | for (AppUser datum : data) { |
| | | // 给用户添加一条系统消息 |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(datum.getId()); |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("APP版本升级通知"); |
| | | noticeRecord.setContent("APP已更新至【"+homeBackgroundMusic.getVersionNo()+"】版本,请及时更新!"); |
| | | remoteAppUserService.addNoticeReplay(noticeRecord); |
| | | } |
| | | return R.ok(versionService.save(homeBackgroundMusic)); |
| | | } |
| | | @GetMapping("/detailVersion") |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int updateUser(SysUser user); |
| | | public int updatePwd(SysUser user); |
| | | public int updateDept(SysDept user); |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public int resetPwd(SysUser user) |
| | | { |
| | | return userMapper.updateUser(user); |
| | | return userMapper.updatePwd(user); |
| | | } |
| | | |
| | | /** |
| | |
| | | d.del_flag, d.create_by, d.create_time AS createTime,d.remark, |
| | | d.update_by as updateBy, |
| | | d.handleName as handleName, |
| | | d.disable_time as disableTime, |
| | | d.reason, |
| | | d.dept_code as deptCode |
| | | from |
| | | sys_dept d |
| | | where 1 = 1 |
| | | <if test="null != deptName and deptName!=''"> |
| | | and (d.dept_code LIKE CONCAT('%',#{deptName},'%') or d.dept_id LIKE CONCAT('%',#{deptName},'%')) |
| | | and (d.dept_code LIKE CONCAT('%',#{deptName},'%') or d.dept_name LIKE CONCAT('%',#{deptName},'%')) |
| | | </if> |
| | | and d.del_flag = '0' |
| | | |
| | |
| | | |
| | | <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.user_name = #{userName} and u.del_flag = '0' |
| | | where u.user_name = #{userName} and u.del_flag = '0' and u.user_type = '00' |
| | | </select> |
| | | |
| | | <select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> |
| | |
| | | <if test="userType != null and userType != ''">user_type = #{userType},</if> |
| | | <if test="reason != null and reason != ''">reason = #{reason},</if> |
| | | <if test="handleName != null and handleName != ''">handleName = #{handleName},</if> |
| | | <if test="disableTime != null and disableTime != ''">disable_time = #{disableTime},</if> |
| | | |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |
| | | </update> |
| | | <update id="updatePwd" parameterType="com.xinquan.system.api.domain.SysUser"> |
| | | update sys_user |
| | | <set> |
| | | <if test="password != null and password != ''">password = #{password},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where user_id = #{userId} |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="reason != null">reason = #{reason},</if> |
| | | <if test="handleName != null">handleName = #{handleName},</if> |
| | | <if test="disableTime != null">disable_time = #{disableTime},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where dept_id = #{deptId} |
| | |
| | | u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp, |
| | | u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark,u.disableRemark AS disableRemark, |
| | | r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS roleSort, r.data_scope AS dataScope, r.status as role_status, |
| | | u.reason AS reason |
| | | u.reason AS reason,u.handleName as handleName,u.disable_time as disableTime |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role r on ur.role_id = r.role_id |
| | |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.course.api.domain.CourseCategory; |
| | | import com.xinquan.course.api.domain.CourseDTO; |
| | | import com.xinquan.course.api.domain.OrderCourseVO; |
| | | import com.xinquan.order.api.feign.RemoteOrderService; |
| | | import com.xinquan.system.api.RemoteBannerService; |
| | | import com.xinquan.system.api.RemoteUserService; |
| | |
| | | private RemoteOrderService remoteOrderService; |
| | | @Resource |
| | | private RemoteUserService remoteUserService; |
| | | |
| | | @GetMapping("/getAllUserList") |
| | | public R<List<AppUser>> getAllUserList() { |
| | | List<AppUser> list = appUserService.list(); |
| | | return R.ok(list); |
| | | } |
| | | public static void main(String[] args) { |
| | | // 获取当前年份 |
| | | int currentYear = LocalDate.now().getYear(); |
| | |
| | | appUserQuestions.add(appUserQuestion); |
| | | } |
| | | List<Tag> list1 = tagService.lambdaQuery().eq(Tag::getTagType,2).list(); |
| | | String[] split = tagId.split(","); |
| | | List<String> list2 = Arrays.asList(split); |
| | | if (!list2.isEmpty()){ |
| | | for (Tag tag : list1) { |
| | | if (list2.contains(tag.getId().toString())){ |
| | | tag.setIsCheck(1); |
| | | if (org.springframework.util.StringUtils.hasLength(tagId)){ |
| | | String[] split = tagId.split(","); |
| | | List<String> list2 = Arrays.asList(split); |
| | | if (!list2.isEmpty()){ |
| | | for (Tag tag : list1) { |
| | | if (list2.contains(tag.getId().toString())){ |
| | | tag.setIsCheck(1); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | for (Tag tag : list1) { |
| | | tag.setIsCheck(2); |
| | | tag.setIsCheck(2); |
| | | } |
| | | } |
| | | viewReport.setQuestions(appUserQuestions); |
| | |
| | | } |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户详情", tags = "管理后台-用户管理") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uid", value = "uid", dataType = "String", required = true), |
| | | }) |
| | | public R<AppUser> detail(String uid) { |
| | | AppUser byId = appUserService.getById(uid); |
| | | List<AppUserTree> list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, byId.getId()) |
| | |
| | | if (data!=null){ |
| | | byId.setLevelName(data.getLevelName()); |
| | | byId.setLevelIcon(data.getLevelIcon()); |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(byId.getTagId())){ |
| | | List<String> list = Arrays.asList(byId.getTagId().split(",")); |
| | | List<String> collect = tagService.lambdaQuery().in(Tag::getId, list).list().stream() |
| | | .map(Tag::getTagName).collect(Collectors.toList()); |
| | | byId.setTags(collect); |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | |
| | | }) |
| | | public R setTotalEnergyValue(String uid,Integer energyValue,String reason) { |
| | | AppUser byId = appUserService.getById(uid); |
| | | if (energyValue<0){ |
| | | if (byId.getTotalEnergyValue()<Math.abs(energyValue)){ |
| | | return R.fail("扣除能量值应小于当前能量值"); |
| | | } |
| | | } |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+energyValue); |
| | | byId.setEnergyValue(byId.getEnergyValue()+energyValue); |
| | | appUserService.updateById(byId); |
| | |
| | | AppUser byId = appUserService.getById(uid); |
| | | switch (vipType){ |
| | | case 1: |
| | | appUserLambdaUpdateWrapper.set(AppUser::getVipExpireTime,null); |
| | | appUserLambdaUpdateWrapper.set(AppUser::getVipLevel,null); |
| | | appUserLambdaUpdateWrapper.eq(AppUser::getId,byId.getUserId()); |
| | | appUserService.update(appUserLambdaUpdateWrapper); |
| | | byId.setVipExpireTime(null); |
| | | byId.setVipLevel(null); |
| | | appUserService.updateById(byId); |
| | | break; |
| | | case 2: |
| | | if (byId.getVipExpireTime() == null){ |
| | |
| | | .orderByDesc(AppUser::getRegisterTime); |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getVipType())){ |
| | | String[] split = courseDTO.getVipType().split(","); |
| | | List<String> list1 = Arrays.asList(split); |
| | | List<Integer> objects = new ArrayList<>(); |
| | | for (String s : split) { |
| | | objects.add(Integer.parseInt(s)-1); |
| | | } |
| | | List<AppUser> appUsers = new ArrayList<>(); |
| | | List<AppUser> list = appUserService.lambdaQuery().gt(AppUser::getVipExpireTime, LocalDateTime.now()).list(); |
| | | List<AppUser> list = appUserService.lambdaQuery().list(); |
| | | for (AppUser appUser : list) { |
| | | if(appUser.getVipLevel()!=null){ |
| | | if (list1.contains(appUser.getVipLevel().toString())){ |
| | | if (objects.contains(0)){ |
| | | if (appUser.getVipExpireTime()==null){ |
| | | appUsers.add(appUser); |
| | | }else if (appUser.getVipExpireTime().isBefore(LocalDateTime.now())){ |
| | | appUsers.add(appUser); |
| | | } |
| | | } |
| | | if (objects.contains(1)){ |
| | | if (appUser.getVipExpireTime()!=null&&appUser.getVipExpireTime().isAfter(LocalDateTime.now())&&appUser.getVipLevel()==1){ |
| | | appUsers.add(appUser); |
| | | } |
| | | } |
| | | if (objects.contains(2)){ |
| | | if (appUser.getVipExpireTime()!=null&&appUser.getVipExpireTime().isAfter(LocalDateTime.now())&&appUser.getVipLevel()==2){ |
| | | appUsers.add(appUser); |
| | | } |
| | | } |
| | | if (objects.contains(3)){ |
| | | if (appUser.getVipExpireTime()!=null&&appUser.getVipExpireTime().isAfter(LocalDateTime.now())&&appUser.getVipLevel()==3){ |
| | | appUsers.add(appUser); |
| | | } |
| | | } |
| | | } |
| | | List<Long> collect = appUsers.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | List<Long> collect = appUsers.stream().distinct().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | courseLambdaQueryWrapper.in(AppUser::getId, longs); |
| | | courseLambdaQueryWrapper.in(AppUser::getId, collect); |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(courseDTO.getLevel())){ |
| | | List<String> list2 = Arrays.asList(courseDTO.getLevel().split(",")); |
| | | List<AppUser> list = appUserService.lambdaQuery().list(); |
| | | List<AppUser> appUsers = new ArrayList<>(); |
| | | for (AppUser appUser : list) { |
| | | List<AppUserTree> list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, appUser.getId()) |
| | | .list(); |
| | | // 查询用户等级最高的那颗树苗 |
| | | AppUserTree tree = list1.stream().max((o1, o2) -> { |
| | | if (o1.getTreeLevelType() > o2.getTreeLevelType()) { |
| | | return 1; |
| | | } else if (o1.getTreeLevelType() < o2.getTreeLevelType()) { |
| | | return -1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | }).orElse(null); |
| | | AppUserTree list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, appUser.getId()) |
| | | .eq(AppUserTree::getSowAgain,2) |
| | | .one(); |
| | | // 查询疗愈等级 名称 图标 |
| | | int level = 1; |
| | | if (tree != null){ |
| | | level = tree.getTreeLevelType(); |
| | | if (list1 != null){ |
| | | level = list1.getTreeLevelType(); |
| | | } |
| | | if (list2.contains(level+"")){ |
| | | appUsers.add(appUser); |
| | |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | |
| | | AppUser byId = appUserService.getById(userId); |
| | | byId.setUserStatus(3); |
| | | byId.setLogoutTime(LocalDateTime.now()); |
| | | appUserService.updateById(byId); |
| | | appUserService.removeById(byId); |
| | | remoteUserService.removeByAppUserId(byId.getUserId()); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/wallet") |
| | |
| | | WalletVO walletVO = new WalletVO(); |
| | | walletVO.setId(userId); |
| | | walletVO.setBalance(byId.getBalance()); |
| | | walletVO.setIncome(byId.getIncome()); |
| | | |
| | | List<AppUser> page = appUserService.lambdaQuery() |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .list(); |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | BigDecimal bigDecimal1 = new BigDecimal("0"); |
| | | |
| | | for (AppUser record : page) { |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | BigDecimal reduce = list.stream().map(AppUserWalletRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | bigDecimal1 = bigDecimal1.add(reduce); |
| | | record.setMoney(reduce); |
| | | } |
| | | walletVO.setIncome(bigDecimal1); |
| | | // 查询用户充值 |
| | | String data = remoteOrderService.queryChargeByUserId(userId).getData(); |
| | | BigDecimal bigDecimal = new BigDecimal(data); |
| | |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | Page<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(PageDTO.empty(page)); |
| | | } |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.getRecords().stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())return R.ok(PageDTO.empty(page)); |
| | | for (int i = 0; i < page.getRecords().size(); i++) { |
| | | AppUser appUser = page.getRecords().get(i); |
| | | // 查询该给用户带来收益 |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .eq(AppUserWalletRecord::getChildAppUserId,appUser.getUserId()).list(); |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | for (AppUserWalletRecord appUserWalletRecord : list) { |
| | | if (appUserWalletRecord.getAmount()!=null && appUserWalletRecord.getChangeType() == 1){ |
| | | bigDecimal = bigDecimal.add(appUserWalletRecord.getAmount()); |
| | | } |
| | | } |
| | | appUser.setMoney(bigDecimal); |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | |
| | | Long userId = loginUser.getUserid(); |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .list(); |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | for (AppUser record : page) { |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | BigDecimal reduce = list.stream().map(AppUserWalletRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | record.setMoney(reduce); |
| | | } |
| | | // 根据佣金金额 从大到小排序 |
| | | page.getRecords().sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney())); |
| | | return R.ok(PageDTO.of(page, InviteRankListVO.class)); |
| | | page.sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney())); |
| | | |
| | | List<AppUser> testing = testing(page.size(), pageCurr, pageSize, page); |
| | | objectPage.setTotal(testing.size()); |
| | | objectPage.setRecords(testing); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)); |
| | | } |
| | | @PostMapping("/myInviteRankListShare") |
| | | @ApiOperation(value = "我的助力-分页", tags = {"H5分享"}) |
| | |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, |
| | | @RequestParam(value = "userId") String userId) { |
| | | Page<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, userId) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(PageDTO.empty(page)); |
| | | } |
| | | .list(); |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.getRecords().stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty())return R.ok(PageDTO.empty(page)); |
| | | for (int i = 0; i < page.getRecords().size(); i++) { |
| | | AppUser appUser = page.getRecords().get(i); |
| | | // 查询该给用户带来收益 |
| | | List<Long> collect = page.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | for (AppUser record : page) { |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .eq(AppUserWalletRecord::getChildAppUserId,appUser.getUserId()).list(); |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | for (AppUserWalletRecord appUserWalletRecord : list) { |
| | | if (appUserWalletRecord.getAmount()!=null && appUserWalletRecord.getChangeType() == 1){ |
| | | bigDecimal = bigDecimal.add(appUserWalletRecord.getAmount()); |
| | | } |
| | | } |
| | | appUser.setMoney(bigDecimal); |
| | | |
| | | .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | BigDecimal reduce = list.stream().map(AppUserWalletRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | record.setMoney(reduce); |
| | | } |
| | | // 根据佣金金额 从大到小排序 |
| | | page.getRecords().sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney())); |
| | | return R.ok(PageDTO.of(page, InviteRankListVO.class)); |
| | | page.sort((o1, o2) -> o2.getMoney().compareTo(o1.getMoney())); |
| | | |
| | | List<AppUser> testing = testing(page.size(), pageCurr, pageSize, page); |
| | | objectPage.setTotal(testing.size()); |
| | | objectPage.setRecords(testing); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)); |
| | | } |
| | | @Resource |
| | | private AppUserWalletRecordService appUserWalletRecordService; |
| | |
| | | public R<PageDTO<InviteRankListVO>> inviteRankList( |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | for (AppUser appUser : page.getRecords()) { |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .list(); |
| | | List<AppUser> res = new ArrayList<>(); |
| | | for (AppUser appUser : page) { |
| | | int size = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .list().size(); |
| | | appUser.setCount(size); |
| | | if (size>0){ |
| | | res.add(appUser); |
| | | } |
| | | } |
| | | // 根据帮助人数 从大到小排序 |
| | | page.getRecords().sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | return R.ok(PageDTO.of(page, InviteRankListVO.class)) ; |
| | | res.sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | List<AppUser> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | objectPage.setRecords(testing); |
| | | objectPage.setTotal(res.size()); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)) ; |
| | | } |
| | | public static List<AppUser> testing(long total, long current, long size, List<AppUser> str){ |
| | | List<AppUser> result = new ArrayList<>(); |
| | | //获取初始化分页结构 |
| | | Page<AppUser> page = new Page<>(current - 1, size, total); |
| | | //获取集合下标初始值 |
| | | long startIndex = (current - 1) * size; |
| | | //获取集合下标结束值 |
| | | long endInddex = 0; |
| | | if(startIndex + page.getCurrent() >= total || size > total){ |
| | | endInddex = total; |
| | | }else { |
| | | endInddex = Math.min(startIndex + page.getSize(), total); |
| | | } |
| | | //如果输入的开始查询下标大于集合大小,则查询为空值 |
| | | if(startIndex > total){ |
| | | result = Collections.emptyList(); |
| | | }else{ |
| | | result = str.subList((int)startIndex,(int)endInddex); |
| | | } |
| | | return result; |
| | | } |
| | | @PostMapping("/inviteRankListShare") |
| | | @ApiOperation(value = "爱心助力榜单-分页", tags = {"H5分享"}) |
| | |
| | | public R<PageDTO<InviteRankListVO>> inviteRankListShare( |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | for (AppUser appUser : page.getRecords()) { |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .list(); |
| | | List<AppUser> res = new ArrayList<>(); |
| | | for (AppUser appUser : page) { |
| | | int size = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .list().size(); |
| | | appUser.setCount(size); |
| | | if (size>0){ |
| | | res.add(appUser); |
| | | } |
| | | } |
| | | // 根据帮助人数 从大到小排序 |
| | | page.getRecords().sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | return R.ok(PageDTO.of(page, InviteRankListVO.class)) ; |
| | | res.sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | List<AppUser> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | objectPage.setRecords(testing); |
| | | objectPage.setTotal(res.size()); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)) ; |
| | | } |
| | | @PostMapping("/getUserInfo") |
| | | @ApiOperation(value = "获取用户信息", tags = {"个人中心"}) |
| | |
| | | }else{ |
| | | appUser.setIsVip(2); |
| | | } |
| | | AppUserTree list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, userId) |
| | | .eq(AppUserTree::getSowAgain,2) |
| | | .one(); |
| | | // 查询疗愈等级 名称 图标 |
| | | int level = list1.getTreeLevelType(); |
| | | appUser.setLevel(level); |
| | | // 查询用户累计学习天数 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | List<AppUserViewingHistory> com = appUserViewingHistoryService.cumulative(userId); |
| | | appUser.setCumulative(com.size()); |
| | | // 查询用户今日学习多少分钟 |
| | | Integer temp = appUserViewingHistoryService.today(userId); |
| | | if (temp == null){ |
| | | temp =0; |
| | | } |
| | | if (temp == 0){ |
| | | appUser.setToday(0); |
| | | }else if (temp<60){ |
| | | // 不足一分钟按一分钟计算 |
| | | appUser.setToday(1); |
| | | }else{ |
| | | appUser.setToday(temp/60); |
| | | } |
| | | // 查询用户连续观看天数 |
| | | List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery().eq(AppUserViewingHistory::getAppUserId, userId) |
| | | .eq(AppUserViewingHistory::getViewingType, 1) |
| | | .orderByDesc(BaseModel::getCreateTime).list(); |
| | | Set<LocalDate> viewingDates = list.stream() |
| | | .map(record -> LocalDate.parse(record.getCreateTime().toLocalDate().toString(), formatter)) |
| | | .collect(Collectors.toCollection(HashSet::new)); |
| | | // 获取今天的日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算连续观看天数 |
| | | int consecutiveDays = 0; |
| | | LocalDate currentDate = today; |
| | | // 如果今天没有观看 也进入循环判断 |
| | | while (viewingDates.contains(currentDate)||LocalDate.parse(currentDate.toString(), formatter).equals(today)) { |
| | | if (!viewingDates.contains(currentDate)){ |
| | | // 如果今天没有观看 |
| | | currentDate = currentDate.minusDays(1); |
| | | continue; |
| | | } |
| | | consecutiveDays++; |
| | | currentDate = currentDate.minusDays(1); |
| | | } |
| | | appUser.setToday(consecutiveDays); |
| | | // 根据等级查询疗愈名称和图标 |
| | | UserLevelSetting data = remoteBannerService.getIconNameByLevel(level).getData(); |
| | | appUser.setLevelName(data.getLevelName()); |
| | | appUser.setLevelIcon(data.getLevelIcon()); |
| | | return R.ok(appUser); |
| | | } |
| | | @PostMapping("/healingLevel") |
| | |
| | | updateWrapper.set(AppUser::getOccupation, dto.getOccupation()); |
| | | updateWrapper.set(AppUser::getLocation, dto.getLocation()); |
| | | updateWrapper.set(AppUser::getHometown, dto.getHometown()); |
| | | updateWrapper.set(AppUser::getEmail, dto.getEducation()); |
| | | updateWrapper.set(AppUser::getEmail, dto.getEmail()); |
| | | updateWrapper.eq(AppUser::getId,userId); |
| | | appUserService.update(byId, updateWrapper); |
| | | return R.ok(byId); |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @PostMapping("/testDelete") |
| | | @ApiOperation(value = "手动扣除成长值",tags = "手动扣除成长值") |
| | | public R testDelete() { |
| | | try { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | List<AppUserTree> list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getSowAgain, 2) |
| | | .list(); |
| | | for (AppUserTree appUserTree : list1) { |
| | | LocalDateTime time = appUserTree.getTime(); |
| | | // 计算两个now和time的天数差 |
| | | long between = ChronoUnit.DAYS.between(time, now); |
| | | if (between>7){ |
| | | double v = appUserTree.getTotal() * 0.02; |
| | | long roundedValue = Math.round(v); |
| | | if ((appUserTree.getTotal() - (int) roundedValue)>0){ |
| | | appUserTree.setTotal(appUserTree.getTotal() - (int) roundedValue); |
| | | }else{ |
| | | appUserTree.setTotal(0); |
| | | } |
| | | appUserTree.setStatus(1); |
| | | }else if (between>=1){ |
| | | // 计算两个now和time的小时差 |
| | | long betweenHours = ChronoUnit.HOURS.between(time, now); |
| | | if (betweenHours>=24){ |
| | | double v = appUserTree.getTotal() * 0.01; |
| | | long roundedValue = Math.round(v); |
| | | if ((appUserTree.getTotal() - (int) roundedValue)>0){ |
| | | if (appUserTree.getId().equals(1854054871051481089L)){ |
| | | System.err.println(appUserTree.getTotal() - (int) roundedValue); |
| | | } |
| | | appUserTree.setTotal(appUserTree.getTotal() - (int) roundedValue); |
| | | }else{ |
| | | appUserTree.setTotal(0); |
| | | } |
| | | } |
| | | } |
| | | appUserTreeService.updateById(appUserTree); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/getUserTree") |
| | | @ApiOperation(value = "获取用户树苗",tags = "树苗打卡站") |
| | | public R<AppUserTree> getUserTree() { |
| | |
| | | .eq(AppUserTree::getSowAgain,2).one(); |
| | | if (one == null){ |
| | | AppUserTree appUserTree = new AppUserTree(); |
| | | appUserTree.setTime(LocalDateTime.now()); |
| | | appUserTree.setAppUserId(userId); |
| | | appUserTree.setTreeLevelType(1); |
| | | appUserTree.setGrowthValue(0); |
| | |
| | | }else{ |
| | | appUserTree.setIsSign(2); |
| | | } |
| | | if (temp>=60){ |
| | | if (temp>=120){ |
| | | if (appUserTree.getTaskOne()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(10); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈30分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | } |
| | | if (appUserTree.getTaskTwo()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(20); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈60分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+20); |
| | | |
| | | } |
| | | appUserTree.setTaskOne(1); |
| | | appUserTree.setTaskTwo(1); |
| | | } |
| | | else if (temp>=30){ |
| | | else if (temp>=60){ |
| | | if (appUserTree.getTaskOne()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(10); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈30分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | } |
| | | appUserTree.setTaskOne(1); |
| | | appUserTree.setTaskTwo(2); |
| | | }else{ |
| | |
| | | appUserTreeService.save(appUserTree); |
| | | return R.ok(appUserTree); |
| | | }else{ |
| | | if (temp>=60){ |
| | | if (temp>=120){ |
| | | if (one.getTaskOne()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(10); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈30分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | } |
| | | if (one.getTaskTwo()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(20); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈60分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+20); |
| | | |
| | | } |
| | | one.setTaskOne(1); |
| | | one.setTaskTwo(1); |
| | | } |
| | | else if (temp>=30){ |
| | | else if (temp>=60){ |
| | | if (one.getTaskOne()==2){ |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(10); |
| | | appUserEnergyRecord.setReason("完成【每日疗愈30分钟】任务"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | } |
| | | one.setTaskOne(1); |
| | | one.setTaskTwo(2); |
| | | }else{ |
| | |
| | | }else{ |
| | | one.setIsSign(2); |
| | | } |
| | | switch (one.getTreeLevelType()){ |
| | | case 1: |
| | | one.setNextLevel(1000); |
| | | List<TreeLevelSetting> data = sysUserClient.getTreeGroup().getData(); |
| | | |
| | | Integer total1 = one.getTotal(); |
| | | // 根据总能量值 确定他在哪一等级 |
| | | int x = 1; |
| | | int tem = 0; |
| | | for (TreeLevelSetting datum : data) { |
| | | if (total1 == 0){ |
| | | Integer growthValue = data.get(1).getGrowthValue(); |
| | | tem = growthValue; |
| | | break; |
| | | case 2: |
| | | one.setNextLevel(1000); |
| | | break; |
| | | case 3: |
| | | one.setNextLevel(1000); |
| | | break; |
| | | case 4: |
| | | one.setNextLevel(1000); |
| | | break; |
| | | case 5: |
| | | one.setNextLevel(2000); |
| | | break; |
| | | case 6: |
| | | one.setNextLevel(2000); |
| | | break; |
| | | case 7: |
| | | one.setNextLevel(2000); |
| | | break; |
| | | case 8: |
| | | one.setNextLevel(2000); |
| | | break; |
| | | case 9: |
| | | one.setNextLevel(2400); |
| | | break; |
| | | case 10: |
| | | one.setNextLevel(2400); |
| | | break; |
| | | }else if (total1>=datum.getGrowthValue()){ |
| | | x = datum.getTreeLevelType(); |
| | | } |
| | | } |
| | | if (x == 10){ |
| | | // 如果等级为10那么成长阈值是10级减去9级 |
| | | int ten=0; |
| | | int nine = 0; |
| | | for (TreeLevelSetting datum : data) { |
| | | if (datum.getTreeLevelType()==10){ |
| | | ten = datum.getGrowthValue(); |
| | | } |
| | | if (datum.getTreeLevelType()==9){ |
| | | nine = datum.getGrowthValue(); |
| | | } |
| | | } |
| | | tem = ten-nine; |
| | | total1 = tem; |
| | | }else{ |
| | | // 根据当前所在等级查询成长值 |
| | | int a = data.get(x).getGrowthValue()-data.get(x-1).getGrowthValue(); |
| | | tem = a; |
| | | total1 = Math.abs(total1-data.get(x-1).getGrowthValue()); |
| | | } |
| | | one.setNextLevel(tem); |
| | | one.setTreeLevelType(x); |
| | | // 将当前成长值更新 |
| | | one.setGrowthValue(total1); |
| | | one.setEnergyValue(byId.getEnergyValue()); |
| | | appUserTreeService.updateById(one); |
| | | return R.ok(one); |
| | | } |
| | | } |
| | |
| | | @PostMapping("/watering") |
| | | @ApiOperation(value = "浇水 返回值true证明升级了 false没升级",tags = "树苗打卡站") |
| | | public R<WateringVO> watering() { |
| | | WateringVO wateringVO = new WateringVO(); |
| | | |
| | | |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | |
| | | return R.energyValueError("能量值不足"); |
| | | |
| | | } |
| | | WateringVO wateringVO = new WateringVO(); |
| | | |
| | | AppUserTree one = appUserTreeService.lambdaQuery().eq(AppUserTree::getAppUserId, userId) |
| | | .eq(AppUserTree::getSowAgain,2).one(); |
| | | Integer currentEnergyValue = byId.getEnergyValue(); |
| | | one.setStatus(2); |
| | | one.setTotal(one.getTotal()+byId.getEnergyValue()); |
| | | one.setTime(LocalDateTime.now()); |
| | | appUserTreeService.updateById(one); |
| | | byId.setEnergyValue(0); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+currentEnergyValue); |
| | | appUserService.updateById(byId); |
| | | List<TreeLevelSetting> data = sysUserClient.getTreeGroup().getData(); |
| | | // 判断能否升级 |
| | | int temp = 0; |
| | | int y = one.getTreeLevelType(); |
| | | Integer total1 = one.getTotal(); |
| | | // 根据总能量值 确定他在哪一等级 |
| | | int x = 1; |
| | | int tem = 0; |
| | | for (TreeLevelSetting datum : data) { |
| | | switch (datum.getTreeLevelType()){ |
| | | case 1: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 2: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 3: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 4: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 5: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 6: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 7: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 8: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 9: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | case 10: |
| | | temp=datum.getGrowthValue(); |
| | | break; |
| | | if (total1 == 0){ |
| | | Integer growthValue = data.get(1).getGrowthValue(); |
| | | tem = growthValue; |
| | | break; |
| | | }else if (total1>=datum.getGrowthValue()){ |
| | | x = datum.getTreeLevelType(); |
| | | } |
| | | } |
| | | |
| | | wateringVO.setNextLevel(temp); |
| | | // 升级阈值 |
| | | if (one.getGrowthValue()+currentEnergyValue>=temp){ |
| | | // 升级咯 如果当前等级已经为10级 |
| | | if (one.getTreeLevelType()==10){ |
| | | one.setGrowthValue(one.getGrowthValue()+currentEnergyValue); |
| | | wateringVO.setIsNext(false); |
| | | int a= 0; |
| | | for (TreeLevelSetting datum : data) { |
| | | if (datum.getTreeLevelType()==10){ |
| | | a = datum.getGrowthValue(); |
| | | } |
| | | if (x == 10){ |
| | | // 如果等级为10那么成长阈值是10级减去9级 |
| | | int ten=0; |
| | | int nine = 0; |
| | | for (TreeLevelSetting datum : data) { |
| | | if (datum.getTreeLevelType()==10){ |
| | | ten = datum.getGrowthValue(); |
| | | } |
| | | wateringVO.setNextLevel(a); |
| | | }else{ |
| | | |
| | | // 将当前成长值更新 |
| | | one.setGrowthValue(one.getGrowthValue()+currentEnergyValue-temp); |
| | | // 升级 |
| | | one.setTreeLevelType(one.getTreeLevelType()+1); |
| | | switch (one.getTreeLevelType()+1){ |
| | | case 2: |
| | | temp=1000; |
| | | break; |
| | | case 3: |
| | | temp=1000; |
| | | break; |
| | | case 4: |
| | | temp=1000; |
| | | break; |
| | | case 5: |
| | | temp=2000; |
| | | break; |
| | | case 6: |
| | | temp=2000; |
| | | break; |
| | | case 7: |
| | | temp=2000; |
| | | break; |
| | | case 8: |
| | | temp=2000; |
| | | break; |
| | | case 9: |
| | | temp=2400; |
| | | break; |
| | | case 10: |
| | | temp=2400; |
| | | break; |
| | | if (datum.getTreeLevelType()==9){ |
| | | nine = datum.getGrowthValue(); |
| | | } |
| | | wateringVO.setNextLevel(temp); |
| | | wateringVO.setIsNext(true); |
| | | // 升级了 使用浇水后的能量值减去升级阈值 |
| | | wateringVO.setGrowthValue(one.getGrowthValue()); |
| | | } |
| | | tem = ten-nine; |
| | | total1 = tem; |
| | | }else{ |
| | | wateringVO.setIsNext(false); |
| | | wateringVO.setGrowthValue(one.getGrowthValue()+currentEnergyValue); |
| | | // 不能升级 |
| | | one.setGrowthValue(one.getGrowthValue()+currentEnergyValue); |
| | | appUserTreeService.updateById(one); |
| | | // 根据当前所在等级查询成长值 |
| | | int a = data.get(x).getGrowthValue()-data.get(x-1).getGrowthValue(); |
| | | tem = a; |
| | | total1 = Math.abs(total1-data.get(x-1).getGrowthValue()); |
| | | } |
| | | one.setNextLevel(tem); |
| | | one.setTreeLevelType(x); |
| | | // 将当前成长值更新 |
| | | one.setGrowthValue(total1); |
| | | one.setEnergyValue(byId.getEnergyValue()); |
| | | appUserTreeService.updateById(one); |
| | | wateringVO.setNextLevel(tem); |
| | | wateringVO.setTreeLevelType(x); |
| | | wateringVO.setGrowthValue(total1); |
| | | if (x>y){ |
| | | wateringVO.setIsNext(true); |
| | | } |
| | | return R.ok(wateringVO); |
| | | } |
| | | @PostMapping("/sign") |
| | |
| | | Long userId = loginUser.getUserid(); |
| | | // 给用户加10能量 |
| | | AppUser byId = appUserService.getById(userId); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | byId.setEnergyValue(byId.getEnergyValue()+10); |
| | | byId.setSignTime(LocalDateTime.now()); |
| | | byId.setTotalEnergyValue(byId.getTotalEnergyValue()+10); |
| | | appUserService.updateById(byId); |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | |
| | | appUserEnergyRecord.setChangeType(1); |
| | | appUserEnergyRecord.setEnergyValue(10); |
| | | appUserEnergyRecord.setReason("签到"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | @PostMapping("/userEnergyDetail") |
| | | @ApiOperation(value = "用户详情-能量值明细 ",tags = "管理后台-用户管理") |
| | | @ApiOperation(tags = "管理后台-用户管理",value = "用户详情-能量值明细 ") |
| | | public R<PageDTO<AppUserEnergyRecordVO>> userEnergyDetail(@RequestBody UserEnergyDTO dto) { |
| | | String startTime = null; |
| | | String endTime = null; |
| | | if (org.springframework.util.StringUtils.hasLength(dto.getTime())){ |
| | | String[] split = dto.getTime().split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | } |
| | | String userId = dto.getUid(); |
| | | EnergyVO energyVO = new EnergyVO(); |
| | | energyVO.setEnergyTotal(appUserService.getById(userId).getTotalEnergyValue()); |
| | | LambdaQueryWrapper<AppUserEnergyRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (dto.getState()!=null){ |
| | | switch (dto.getState()){ |
| | | if (dto.getChangeType()!=null){ |
| | | switch (dto.getChangeType()){ |
| | | case 1: |
| | | lambdaQueryWrapper.eq(AppUserEnergyRecord::getChangeType, 1); |
| | | break; |
| | |
| | | break; |
| | | } |
| | | } |
| | | lambdaQueryWrapper.like(StringUtils.hasLength(dto.getContent()),AppUserEnergyRecord::getReason,dto.getContent()); |
| | | lambdaQueryWrapper.like(StringUtils.hasLength(dto.getReason()),AppUserEnergyRecord::getReason,dto.getReason()); |
| | | lambdaQueryWrapper.between(startTime!=null,BaseModel::getCreateTime,startTime,endTime); |
| | | lambdaQueryWrapper.eq(AppUserEnergyRecord::getAppUserId, userId).orderByDesc(BaseModel::getCreateTime); |
| | | Page<AppUserEnergyRecord> page = appUserEnergyRecordService.page(new Page<>(dto.getPageCurr(), dto.getPageSize()), lambdaQueryWrapper); |
| | |
| | | PageDTO<ExchangeRecordVO> res = PageDTO.of(page, ExchangeRecordVO.class); |
| | | for (ExchangeRecordVO record : res.getList()) { |
| | | Prize temp = prizeService.lambdaQuery() |
| | | .eq(Prize::getId, record.getId()).one(); |
| | | .eq(Prize::getId, record.getPrizeId()).one(); |
| | | if (temp != null){ |
| | | record.setName(temp.getName()); |
| | | record.setCoverUrl(temp.getCoverUrl()); |
| | |
| | | Long userId = loginUser.getUserid(); |
| | | AppUser byId1 = appUserService.getById(userId); |
| | | Prize byId = prizeService.getById(prizeId); |
| | | if (byId1.getTotalEnergyValue()<=byId.getEnergyValue()){ |
| | | if (byId1.getTotalEnergyValue()<byId.getEnergyValue()){ |
| | | return R.fail("能量值不足"); |
| | | } |
| | | PrizeRedemptionRecord one = prizeRedemptionRecordService.lambdaQuery() |
| | |
| | | if (one!=null){ |
| | | return R.fail("奖品已兑换"); |
| | | } |
| | | // 扣去能量值 |
| | | Integer totalEnergyValue = byId1.getTotalEnergyValue(); |
| | | byId1.setTotalEnergyValue(totalEnergyValue-byId.getEnergyValue()); |
| | | appUserService.updateById(byId1); |
| | | // 增加记录 |
| | | AppUserEnergyRecord appUserEnergyRecord = new AppUserEnergyRecord(); |
| | | appUserEnergyRecord.setAppUserId(userId); |
| | | appUserEnergyRecord.setChangeType(2); |
| | | appUserEnergyRecord.setEnergyValue(byId.getEnergyValue()); |
| | | appUserEnergyRecord.setReason("兑换礼品"); |
| | | appUserEnergyRecordService.save(appUserEnergyRecord); |
| | | |
| | | PrizeRedemptionRecord prizeRedemptionRecord = new PrizeRedemptionRecord(); |
| | | prizeRedemptionRecord.setStatus(1); |
| | | prizeRedemptionRecord.setEnergyValue(byId.getEnergyValue()); |
| | |
| | | prizeRedemptionRecord.setCode(code); |
| | | prizeRedemptionRecordService.save(prizeRedemptionRecord); |
| | | // 随机生成6位纯数字验证码 |
| | | |
| | | return R.ok(code); |
| | | } |
| | | @PostMapping("/exchangeRecordList") |
| | |
| | | @Resource |
| | | private RemoteCourseService remoteCourseService; |
| | | private final RemoteAppUserService remoteAppUserService; |
| | | |
| | | /** |
| | | * 远程调用查询用户观看了哪些课程 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCourseHistoryByUserId/{id}") |
| | | public R<List<Long>> getCourseHistoryByUserId(@PathVariable("id") Long id) { |
| | | List<Long> one = appUserViewingHistoryService.lambdaQuery() |
| | | .eq(AppUserViewingHistory::getAppUserId, id) |
| | | .eq(AppUserViewingHistory::getViewingType, 2) |
| | | .list().stream().map(AppUserViewingHistory::getBizId) |
| | | .collect(Collectors.toList()); |
| | | return R.ok(one); |
| | | } |
| | | @PostMapping("/getMeditationHistoryCount/{id}") |
| | | public R<Long> getMeditationHistoryCount(@PathVariable("id") Long id) { |
| | | List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery() |
| | | .eq(AppUserViewingHistory::getBizId, id) |
| | | .eq(AppUserViewingHistory::getViewingType, 1) |
| | | .list(); |
| | | return R.ok(Long.valueOf(list.size())); |
| | | } |
| | | @PostMapping("/getCourseHistoryCount/{id}") |
| | | public R<Long> getCourseHistoryCount(@PathVariable("id") Long id) { |
| | | List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery() |
| | | .eq(AppUserViewingHistory::getBizId, id) |
| | | .eq(AppUserViewingHistory::getViewingType, 2) |
| | | .list(); |
| | | return R.ok(Long.valueOf(list.size())); |
| | | } |
| | | @PostMapping("/getCourseChapterHistoryCount/{id}") |
| | | public R<Long> getCourseChapterHistoryCount(@PathVariable("id") Long id) { |
| | | List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery() |
| | | .eq(AppUserViewingHistory::getChapterId, id) |
| | | .eq(AppUserViewingHistory::getViewingType, 2) |
| | | .list(); |
| | | return R.ok(Long.valueOf(list.size())); |
| | | } |
| | | @PostMapping("/lookHistory") |
| | | @ApiOperation(value = "观看历史") |
| | | @ApiImplicitParams({ |
| | |
| | | // 如果已经看完了 那么不更新状态 只更新观看时间 |
| | | one.setMinuteLook(minuteLook); |
| | | one.setSecondLook(secondLook); |
| | | one.setTimeLook(secondLook); |
| | | }else{ |
| | | one.setIsOver(isOver); |
| | | } |
| | |
| | | appUserViewingHistory.setSecondLook(secondLook); |
| | | appUserViewingHistory.setChapterId(chapterId); |
| | | appUserViewingHistory.setIsOver(isOver); |
| | | appUserViewingHistory.setTimeLook(secondLook); |
| | | |
| | | appUserViewingHistoryService.save(appUserViewingHistory); |
| | | } |
| | | return R.ok(); |
| | |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.course.api.feign.RemoteCourseService; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.feign.RemoteMeditationService; |
| | | import com.xinquan.order.api.domain.Order; |
| | | import com.xinquan.order.api.feign.RemoteOrderService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | |
| | | private RemoteOrderService remoteOrderService; |
| | | @Resource |
| | | private RemoteCourseService remoteCourseService; |
| | | @Resource |
| | | private RemoteMeditationService remoteMeditationService; |
| | | // 用户获得分佣收益 新增一条余额明细记录 |
| | | @PostMapping("/addBalanceRecord") |
| | | public R addBalanceRecord(@RequestBody AppUserWalletRecord appUserWalletRecord) { |
| | | appUserWalletRecordService.save(appUserWalletRecord); |
| | | if(appUserWalletRecord.getReason().contains("分佣")){ |
| | | AppUser byId = appUserService.getById(appUserWalletRecord.getAppUserId()); |
| | | byId.setBalance(byId.getBalance().add(appUserWalletRecord.getAmount())); |
| | | appUserService.updateById(byId); |
| | | } |
| | | if (appUserWalletRecord.getChangeType() == 2){ |
| | | AppUser byId = appUserService.getById(appUserWalletRecord.getAppUserId()); |
| | | byId.setBalance(byId.getBalance().subtract(appUserWalletRecord.getAmount())); |
| | | appUserService.updateById(byId); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | appUserWalletRecordLambdaQueryWrapper.eq(AppUser::getInviteUserId, userId); |
| | | appUserWalletRecordLambdaQueryWrapper.like(StringUtils.hasLength(dto.getCellPhone()),AppUser::getCellPhone,dto.getCellPhone()); |
| | | appUserWalletRecordLambdaQueryWrapper.like(StringUtils.hasLength(dto.getNickName()),AppUser::getNickname,dto.getNickName()); |
| | | appUserWalletRecordLambdaQueryWrapper.eq(StringUtils.hasLength(dto.getUserStatus()),AppUser::getUserStatus,dto.getUserStatus()); |
| | | appUserWalletRecordLambdaQueryWrapper.orderByDesc(BaseModel::getCreateTime); |
| | | Page<AppUser> page = appUserService |
| | | .page(new Page<>(dto.getPageCurr(), dto.getPageSize()),appUserWalletRecordLambdaQueryWrapper); |
| | |
| | | } |
| | | for (AppUser record : page.getRecords()) { |
| | | // 查询该用户带来收益 |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, record.getId()) |
| | | .eq(AppUserWalletRecord::getChildAppUserId, record.getUserId()).list(); |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery() |
| | | .eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | record.setMoney(new BigDecimal("0")); |
| | | for (AppUserWalletRecord appUserWalletRecord : list) { |
| | | if (appUserWalletRecord.getAmount()!=null && appUserWalletRecord.getChangeType() == 1){ |
| | | bigDecimal = bigDecimal.add(appUserWalletRecord.getAmount()); |
| | |
| | | String endTime = null; |
| | | if (org.springframework.util.StringUtils.hasLength(dto.getTime())){ |
| | | String[] split = dto.getTime().split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | } |
| | | String userId = dto.getUid(); |
| | | LambdaQueryWrapper<AppUserWalletRecord> appUserWalletRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | if (CollUtils.isEmpty(page.getRecords())){ |
| | | PageDTO<OrderListVO> empty = PageDTO.empty(page); |
| | | return R.ok(empty); |
| | | } |
| | | for (AppUserWalletRecord record : page.getRecords()) { |
| | | record.setId(record.getOrderId()); |
| | | } |
| | | return R.ok(PageDTO.of(page, OrderListVO.class)); |
| | | } |
| | |
| | | OrderDetailVO orderDetailVO = new OrderDetailVO(); |
| | | AppUserWalletRecord byId = walletRecordService.getById(id); |
| | | if (byId.getOrderId()!=null){ |
| | | if (byId.getReason().equals("提现")){ |
| | | if (byId.getReason().contains("提现")){ |
| | | AppUserWithdraw byId1 = appUserWithdrawService.getById(byId.getOrderId()); |
| | | orderDetailVO.setType("提现"); |
| | | orderDetailVO.setPayOrderNo(byId1.getSerialNo()); |
| | |
| | | Course data1 = remoteCourseService.getCourseById(data.getBusinessId()).getData(); |
| | | orderDetailVO.setType("课程购买"); |
| | | orderDetailVO.setPayOrderNo(data.getPayOrderNo()); |
| | | orderDetailVO.setAmount(data.getRealPayAmount()); |
| | | orderDetailVO.setAmount(data.getBalance()); |
| | | orderDetailVO.setChangeType(byId.getChangeType()); |
| | | orderDetailVO.setPaymentTime(data.getPaymentTime()); |
| | | } |
| | | } else if (byId.getReason().contains("疗愈")) { |
| | | Order data = remoteOrderService.getOrderById(byId.getOrderId()).getData(); |
| | | if (data!=null){ |
| | | Meditation data1 = remoteMeditationService.getMeditationById(data.getBusinessId()).getData(); |
| | | orderDetailVO.setType("疗愈购买"); |
| | | orderDetailVO.setPayOrderNo(data.getPayOrderNo()); |
| | | orderDetailVO.setAmount(data.getBalance()); |
| | | orderDetailVO.setChangeType(2); |
| | | orderDetailVO.setPaymentTime(data.getPaymentTime()); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(orderDetailVO); |
| | |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.order.api.domain.Order; |
| | | import com.xinquan.system.api.domain.AppUserWalletRecord; |
| | | import com.xinquan.user.api.domain.dto.OrderListDTO; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.AppUserBank; |
| | |
| | | import com.xinquan.user.domain.export.WithdrawExport; |
| | | import com.xinquan.user.service.AppUserBankService; |
| | | import com.xinquan.user.service.AppUserService; |
| | | import com.xinquan.user.service.AppUserWalletRecordService; |
| | | import com.xinquan.user.service.AppUserWithdrawService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | private AppUserBankService appUserBankService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserWalletRecordService appUserWalletRecordService; |
| | | |
| | | @PostMapping("/withdrawList") |
| | | @ApiOperation(value = "提现列表-分页", tags = {"管理后台=提现管理"}) |
| | | @ApiOperation(value = "提现列表-分页", tags = {"管理后台-提现管理"}) |
| | | public R<PageDTO<AppUserWithdraw>> withdrawList(@RequestBody OrderListDTO courseDTO) { |
| | | LambdaQueryWrapper<AppUserWithdraw> wrapper = new LambdaQueryWrapper<>(); |
| | | if (StringUtils.hasLength(courseDTO.getBuyContent())){ |
| | |
| | | List<Long> collect = appUserService.lambdaQuery().like(AppUser::getCellPhone, courseDTO.getUserNameOrPhone()) |
| | | .list().stream().map(AppUser::getId) |
| | | .collect(Collectors.toList()); |
| | | List<Long> collect1 = appUserService.lambdaQuery().like(AppUser::getNickname, courseDTO.getUserNameOrPhone()) |
| | | .list().stream().map(AppUser::getId) |
| | | .collect(Collectors.toList()); |
| | | collect.addAll(collect1); |
| | | if (collect.isEmpty())collect.add(-1L); |
| | | wrapper.in(AppUserWithdraw::getAppUserId,collect); |
| | | } |
| | |
| | | String startTime =null; |
| | | String endTime =null; |
| | | String[] split = courseDTO.getTime().split(" - "); |
| | | startTime = split[0]+"00:00:00"; |
| | | endTime = split[1]+"23:59:59"; |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1]+" 23:59:59"; |
| | | wrapper.between(AppUserWithdraw::getWithdrawTime,startTime,endTime); |
| | | } |
| | | Page<AppUserWithdraw> list = withdrawService.page(new Page<>(courseDTO.getPageCurr(), courseDTO.getPageSize()), wrapper); |
| | |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | AppUser byId = appUserService.getById(userId); |
| | | if (byId.getBalance().compareTo(new BigDecimal(money))<0){ |
| | | return R.fail("提现金额不能超过钱包余额"); |
| | | } |
| | | byId.setBalance(byId.getBalance().subtract(new BigDecimal(money))); |
| | | appUserService.updateById(byId); |
| | | BigDecimal bigDecimal = new BigDecimal(money); |
| | | AppUserWithdraw appUserWithdraw = new AppUserWithdraw(); |
| | | appUserWithdraw.setAppUserId(userId); |
| | |
| | | appUserWithdraw.setWithdrawTime(LocalDateTime.now()); |
| | | appUserWithdraw.setCreateTime(LocalDateTime.now()); |
| | | withdrawService.save(appUserWithdraw); |
| | | // 先扣去余额 |
| | | AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord(); |
| | | appUserWalletRecord.setAppUserId(userId); |
| | | appUserWalletRecord.setChangeType(2); |
| | | appUserWalletRecord.setReason("提现"); |
| | | appUserWalletRecord.setOrderId(appUserWithdraw.getId()); |
| | | appUserWalletRecord.setAmount(new BigDecimal(money)); |
| | | appUserWalletRecordService.save(appUserWalletRecord); |
| | | |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/addBank") |
| | |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.meditation.api.feign.RemoteMeditationService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | |
| | | if (noticeRecord!=null && noticeRecord.getMeditationQuestionId()!=null){ |
| | | // 远程调用 根据冥想提问id 查询数据 |
| | | noticeDetailVO.setMeditationQuestionId(noticeRecord.getMeditationQuestionId()); |
| | | // NoticeDetailVO data = remoteMeditationService.noticeDetail(noticeDetailVO).getData(); |
| | | Meditation data = remoteMeditationService.getMeditationById(noticeRecord.getMeditationId()).getData(); |
| | | MeditationQuestion data1 = remoteMeditationService.getMeditationQuestion(noticeRecord.getMeditationQuestionId() + "").getData(); |
| | | if (data!=null){ |
| | | noticeDetailVO.setMeditationTitle(data.getMeditationTitle()); |
| | | noticeDetailVO.setReplyContent(noticeRecord.getContent()); |
| | | noticeDetailVO.setCoverDescription(data.getDetailDescription()); |
| | | noticeDetailVO.setIconUrl(data.getCoverUrl()); |
| | | } |
| | | if (data1!=null){ |
| | | noticeDetailVO.setNoticeType(noticeRecord.getNoticeType()); |
| | | noticeDetailVO.setContent(data1.getContent()); |
| | | noticeDetailVO.setReplyContent(data1.getReplyContent()); |
| | | noticeDetailVO.setPublishTime(data1.getCreateTime()); |
| | | } |
| | | AppUser byId = appUserService.getById(userId); |
| | | noticeDetailVO.setNickname(byId.getNickname()); |
| | | noticeDetailVO.setAvatar(byId.getAvatar()); |
| | |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.domain.Meditation; |
| | | import com.xinquan.system.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.Prize; |
| | | import com.xinquan.system.api.domain.PrizeRedemptionRecord; |
| | | import com.xinquan.user.service.PrizeRedemptionRecordService; |
| | | import com.xinquan.user.service.PrizeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | record.setName(byId.getName()); |
| | | record.setWorth(byId.getWorth()); |
| | | record.setEnergyValue(byId.getEnergyValue()); |
| | | record.setCoverUrl(byId.getCoverUrl()); |
| | | } |
| | | record.setUid(record.getId().toString()); |
| | | AppUser byId1 = appUserService.getById(record.getAppUserId()); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/client/tag") |
| | | public class ClientTagController { |
| | | @PostMapping("/queryTagList/{ids}") |
| | | public R<List<String>> queryTagList(@PathVariable("ids") String ids) { |
| | | List<Tag> list = tagService.lambdaQuery().in(Tag::getId, Arrays.asList(ids.split(","))).list(); |
| | | return R.ok(list.stream().map(Tag::getTagName).collect(Collectors.toList())); |
| | | } |
| | | @Resource |
| | | private TagService tagService; |
| | | @PostMapping("/saveUserAnswers") |
| | |
| | | |
| | | @ApiModelProperty(value = "问题二 多个tagId使用英文逗号拼接字符串", required = true) |
| | | private String tagIds; |
| | | @ApiModelProperty(value = "设备码", required = true) |
| | | private String device; |
| | | } |
| | |
| | | throw new ServiceException("账号已被冻结"); |
| | | } |
| | | sysUser = sysUserClient.getSysUser(appUser.getUserId()).getData(); |
| | | appUser.setAvatar(body.getHeadImgUrl()); |
| | | appUser.setNickname(body.getNickname()); |
| | | if (appUser.getCellPhone()!=null){ |
| | | appLoginUser.setBindStatus(DisabledEnum.NO.getCode()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | } |
| | | } else { |
| | | // 不存在账户,创建账户 |
| | | // 注册用户信息 |
| | |
| | | String nickname = "用户" + IdUtil.fastSimpleUUID().substring(0, 6); |
| | | sysUser.setNickName(nickname); |
| | | appUser.setAvatar(body.getHeadImgUrl()); |
| | | appUser.setGender(body.getSex()); |
| | | appUser.setGender(3); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | appUser.setSanskritFlag(DisabledEnum.NO.getCode()); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | |
| | | appLoginUser.setUsername(appUser.getNickname()); |
| | | appLoginUser.setAppUserId(appUser.getId()); |
| | | appLoginUser.setSysUser(sysUser); |
| | | if (Objects.nonNull(sysUser.getUserName())) { |
| | | appLoginUser.setBindStatus(DisabledEnum.YES.getCode()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | } |
| | | // if (Objects.nonNull(sysUser.getUserName())) { |
| | | // appLoginUser.setBindStatus(DisabledEnum.YES.getCode()); |
| | | // appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | // } |
| | | return appLoginUser; |
| | | } |
| | | |
| | |
| | | // 存在账户,查询关联系统用户 |
| | | if (optionalAppUser.isPresent()) { |
| | | appUser = optionalAppUser.get(); |
| | | if (appUser.getUserStatus().equals(AppUserStatusEnum.FROZEN.getCode())) { |
| | | throw new ServiceException("账号已被冻结"); |
| | | } |
| | | sysUser = sysUserClient.getSysUser(appUser.getUserId()).getData(); |
| | | if (appUser.getCellPhone()!=null){ |
| | | appLoginUser.setBindStatus(DisabledEnum.NO.getCode()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | } |
| | | } else { |
| | | // 不存在账户,创建账户 |
| | | // 注册用户信息 |
| | | sysUser = new SysUser(); |
| | | String nickname = "用户" + IdUtil.fastSimpleUUID().substring(0, 6); |
| | | sysUser.setNickName(nickname); |
| | | sysUser.setAvatar("qwer"); |
| | | sysUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg"); |
| | | sysUser.setUserName(nickname); |
| | | sysUser.setUserType("01"); // app用户 |
| | | R<SysUser> registerResult = remoteUserService.registerAppUserInfo(sysUser, |
| | |
| | | appUser.setAppleId(appleId); |
| | | appUser.setUserId(sysUserRes.getUserId()); |
| | | appUser.setNickname(nickname); |
| | | appUser.setAvatar("qwer"); // TODO 待完善默认头像 |
| | | appUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg"); // TODO 待完善默认头像 |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | appUser.setSanskritFlag(DisabledEnum.NO.getCode()); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | |
| | | appLoginUser.setUsername(appUser.getNickname()); |
| | | appLoginUser.setAppUserId(appUser.getId()); |
| | | appLoginUser.setSysUser(sysUser); |
| | | if (Objects.nonNull(sysUser.getUserName())) { |
| | | appLoginUser.setBindStatus(DisabledEnum.YES.getCode()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | } |
| | | // if (Objects.nonNull(sysUser.getUserName())) { |
| | | // appLoginUser.setBindStatus(DisabledEnum.YES.getCode()); |
| | | // appLoginUser.setCellPhone(appUser.getCellPhone()); |
| | | // } |
| | | return appLoginUser; |
| | | } |
| | | |
| | |
| | | sysUser = new SysUser(); |
| | | String nickname = "用户" + IdUtil.fastSimpleUUID().substring(0, 6); |
| | | sysUser.setNickName(nickname); |
| | | sysUser.setAvatar("qwer"); |
| | | sysUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg"); |
| | | sysUser.setUserName(body.getCellPhone()); |
| | | sysUser.setUserType("01"); // app用户 |
| | | // 设置默认密码123456 |
| | |
| | | appUser.setUserId(sysUserRes.getUserId()); |
| | | appUser.setNickname(nickname); |
| | | appUser.setCellPhone(body.getCellPhone()); |
| | | appUser.setAvatar("qwer"); // TODO 待完善默认头像 |
| | | appUser.setAvatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg"); // TODO 待完善默认头像 |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | appUser.setSanskritFlag(DisabledEnum.NO.getCode()); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | |
| | | appUserTree.setTreeLevelType(TreeLevelEnum.SEED.getCode()); |
| | | appUserTree.setGrowthValue(0); |
| | | appUserTree.setSowAgain(2); |
| | | appUserTree.setTime(LocalDateTime.now()); |
| | | appUserTreeService.save(appUserTree); |
| | | } |
| | | |
| | |
| | | // 如果存在 更新wxOpenId 或appleId |
| | | if (baseOptionalAppUser.isPresent()) { |
| | | appUser = baseOptionalAppUser.get(); |
| | | if (appUser.getWxOpenId() !=null){ |
| | | throw new ServiceException("该手机号已绑定其他微信号,请更换手机号重新绑定"); |
| | | } |
| | | if (appUser.getAppleId() !=null){ |
| | | throw new ServiceException("该手机号已绑定其他苹果号,请更换手机号重新绑定"); |
| | | } |
| | | switch (body.getLoginType()){ |
| | | case 1: |
| | | this.remove(new LambdaQueryWrapper<AppUser>() |
| | |
| | | } |
| | | sysUser.setUserName(body.getCellPhone()); |
| | | sysUser.setPassword( |
| | | SecurityUtils.encryptPassword( |
| | | SecureUtil.md5(Constants.DEFAULT_PASSWORD).toUpperCase( |
| | | Locale.ROOT))) |
| | | ; // 默认密码为123456 |
| | | SecurityUtils.encryptPassword(Constants.DEFAULT_PASSWORD)) |
| | | ; // 默认密码为a12345678 |
| | | sysUser.setPhonenumber(body.getCellPhone()); |
| | | sysUserClient.updateSysUser(sysUser); |
| | | } |
| | |
| | | List<AppUserQuestion> appUserQuestionYesList = appUserQuestionList.stream() |
| | | .filter(appUserQuestion -> appUserQuestion.getAnswer().equals("1") |
| | | || appUserQuestion.getAnswer().equals("3")).collect(Collectors.toList()); |
| | | StringBuilder sb = new StringBuilder(); |
| | | // 使用 StringBuilder 提高字符串拼接效率 |
| | | if (CollUtils.isNotEmpty(appUserQuestionYesList)) { |
| | | List<Long> tagIdList = appUserQuestionYesList.stream() |
| | | .map(appUserQuestion -> Objects.requireNonNull(AnswerTagEnum.getEnumByCode(appUserQuestion.getType())) |
| | | .getTagId()).collect(Collectors.toList()); |
| | | if (CollUtils.isNotEmpty(tagIdList)) { |
| | | sb.append(CollUtils.join(tagIdList, ",")); |
| | | } |
| | | } |
| | | sb.append(","); |
| | | sb.append(dto.getTagIds()); |
| | | appUser.setTagId(sb.toString()); |
| | | appUser.setTagId(dto.getTagIds()); |
| | | this.updateById(appUser); |
| | | } |
| | | |
New file |
| | |
| | | package com.xinquan.user.utils; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.AppUserEnergyRecord; |
| | | import com.xinquan.system.api.domain.AppUserTree; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.user.service.AppUserEnergyRecordService; |
| | | import com.xinquan.user.service.AppUserService; |
| | | import com.xinquan.user.service.AppUserTreeService; |
| | | import com.xinquan.user.service.NoticeRecordService; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 定时任务工具类 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private AppUserEnergyRecordService appUserEnergyRecordService; |
| | | @Resource |
| | | private AppUserTreeService appUserTreeService; |
| | | @Resource |
| | | private NoticeRecordService noticeRecordService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每天凌晨12点执行的定时任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | public void taskLastDay() { |
| | | try { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | List<AppUserTree> list1 = appUserTreeService.lambdaQuery().eq(AppUserTree::getSowAgain, 2) |
| | | .list(); |
| | | for (AppUserTree appUserTree : list1) { |
| | | LocalDateTime time = appUserTree.getTime(); |
| | | // 计算两个now和time的天数差 |
| | | long between = ChronoUnit.DAYS.between(time, now); |
| | | if (between>7){ |
| | | double v = appUserTree.getTotal() * 0.02; |
| | | if ((appUserTree.getTotal() - (int) v)>0){ |
| | | appUserTree.setTotal(appUserTree.getTotal() - (int) v); |
| | | }else{ |
| | | appUserTree.setTotal(0); |
| | | } |
| | | appUserTree.setStatus(1); |
| | | }else if (between>=1){ |
| | | // 计算两个now和time的小时差 |
| | | long betweenHours = ChronoUnit.HOURS.between(time, now); |
| | | if (betweenHours>=24){ |
| | | double v = appUserTree.getTotal() * 0.01; |
| | | if ((appUserTree.getTotal() - (int) v)>0){ |
| | | appUserTree.setTotal(appUserTree.getTotal() - (int) v); |
| | | }else{ |
| | | appUserTree.setTotal(0); |
| | | } |
| | | } |
| | | } |
| | | appUserTreeService.updateById(appUserTree); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDate localDate = LocalDateTime.now().toLocalDate(); |
| | | System.err.println(localDate); |
| | | } |
| | | // 每天早上7点执行的定时任务 |
| | | @Scheduled(cron = "0 0 7 * * ?") |
| | | public void taskSivenDay() { |
| | | try { |
| | | 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(appUser.getVipExpireTime(), now); |
| | | if (between<=7){ |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(appUser.getId()); |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("【会员临期通知】"); |
| | | noticeRecord.setContent("尊敬的心泉疗愈会员你好,你的会员即将在" |
| | | +appUser.getVipExpireTime().toLocalDate()+"到期,到期后将不再享受会员权益,请及时续费"); |
| | | noticeRecordService.save(noticeRecord); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |