| | |
| | | return R.fail("获取分享信息失败"+cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TSysSet> promptVoice() { |
| | | return R.fail("获取提示音效失败"+cause.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.management.api.factory.TManagementFallbackFactory; |
| | | import com.ruoyi.management.api.model.*; |
| | | import com.ruoyi.management.api.query.UseGuideQuery; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | * @return 获取分享图片、标题及可获积分数 |
| | | */ |
| | | @GetMapping("/tSysSet/shareInfo") |
| | | @ApiOperation(value = "获取分享图片、标题及可获积分数", tags = {"获取分享图片、标题及可获积分数"}) |
| | | R<TSysSet> shareInfo(); |
| | | |
| | | /** |
| | | * 获取分享图片、标题及可获积分数 |
| | | * |
| | | * @return 获取分享图片、标题及可获积分数 |
| | | */ |
| | | @GetMapping("/tSysSet/promptVoice") |
| | | R<TSysSet> promptVoice(); |
| | | |
| | | } |
| | |
| | | public static final Integer SIXTY = 60; |
| | | |
| | | /** |
| | | * 0数字 |
| | | */ |
| | | public static final Integer ZERO = 0; |
| | | |
| | | /** |
| | | * 1数字 |
| | | */ |
| | | public static final Integer ONE = 1; |
| | | /** |
| | | * 字符串 1 |
| | | */ |
| | | public static final String ONE_STR = "1"; |
| | | /** |
| | | * 字符串 2 |
| | | */ |
| | | public static final String TWO_STR = "2"; |
| | | /** |
| | | * 数字 2 |
| | | */ |
| | | public static final Integer TWO = 2; |
| | | /** |
| | | * 字符串 3 |
| | | */ |
| | | public static final String THREE_STR = "3"; |
| | | /** |
| | | * 数字 3 |
| | | */ |
| | | public static final Integer THREE = 3; |
| | | /** |
| | | * 字符串 4 |
| | | */ |
| | | public static final String FOUR_STR = "4"; |
| | | /** |
| | | * 数字 4 |
| | | */ |
| | | public static final Integer FOUR = 4; |
| | | /** |
| | | * 字符串5 |
| | | */ |
| | | public static final String FIVE_STR = "5"; |
| | | /** |
| | | * 数字 5 |
| | | */ |
| | | public static final Integer FIVE = 5; |
| | | /** |
| | | * 字符串6 |
| | | */ |
| | | public static final String SIX_STR = "6"; |
| | | /** |
| | | * 数字6 |
| | | */ |
| | | public static final Integer SIX = 6; |
| | | /** |
| | | * 字符串7 |
| | | */ |
| | | public static final String SEVEN_STR = "7"; |
| | | /** |
| | | * 数字7 |
| | | */ |
| | | public static final Integer SEVEN = 7; |
| | | |
| | | /** |
| | | * 1数字 |
| | | */ |
| | | public static final Integer ONE_HUNDRED = 100; |
| | | |
| | | /** |
| | | * 1000数字 |
| | | */ |
| | | public static final Integer ONE_THOUSAND = 1000; |
| | |
| | | */ |
| | | public static final String ERR_CODE = "errcode"; |
| | | |
| | | /** |
| | | * 积分来源 - 完成学习 |
| | | */ |
| | | public static final String COMPLETE_LEARNING = "完成学习"; |
| | | |
| | | /** |
| | | * 积分来源 - 完成游戏 |
| | | */ |
| | | public static final String COMPLETE_GAME = "完成游戏"; |
| | | |
| | | /** |
| | | * 积分来源 - 完成听故事 |
| | | */ |
| | | public static final String COMPLETE_STORY= "完成听故事"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.constant; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-30 10:06 |
| | | */ |
| | | public class ExceptionCodeConstants { |
| | | |
| | | /** |
| | | * token失效 |
| | | */ |
| | | public static final Integer TOKEN_EXPIRE = 600; |
| | | |
| | | /** |
| | | * 短信验证码无效或错误 |
| | | */ |
| | | public static final Integer PHONE_CODE_ERROR_OR_EXPIRE = 503; |
| | | |
| | | /** |
| | | * 账号冻结 |
| | | */ |
| | | public static final Integer ACCOUNT_FREEZE = 502; |
| | | |
| | | |
| | | } |
| | |
| | | String userkey = JwtUtils.getUserKeyStudy(token); |
| | | user = redisService.getCacheObject(getTokenKeyStudy(userkey)); |
| | | // 再次判断登录状态是否已过期 |
| | | if (null == user) { |
| | | throw new StudyLoginException("登录信息已过期,请重新登录!", 504); |
| | | } |
| | | // 优先判断当前账号是否已在其他设备登录 |
| | | if (!user.getIsCanLogin()) { |
| | | throw new StudyLoginException("当前登录账号在其他设备登录!", 505); |
| | | } |
| | | // 再次判断登录状态是否已过期 |
| | | if (System.currentTimeMillis() > user.getExpireTime()) { |
| | | throw new StudyLoginException("登录信息已过期,请重新登录!", 504); |
| | | } |
| | | // if (null == user) { |
| | | // throw new StudyLoginException("登录信息已过期,请重新登录!", 504); |
| | | // } |
| | | // // 优先判断当前账号是否已在其他设备登录 |
| | | // if (!user.getIsCanLogin()) { |
| | | // throw new StudyLoginException("当前登录账号在其他设备登录!", 505); |
| | | // } |
| | | // // 再次判断登录状态是否已过期 |
| | | // if (System.currentTimeMillis() > user.getExpireTime()) { |
| | | // throw new StudyLoginException("登录信息已过期,请重新登录!", 504); |
| | | // } |
| | | return user; |
| | | } |
| | | return user; |
| | |
| | | |
| | | @ApiOperation("权限列表查询") |
| | | @GetMapping("/listPage") |
| | | public AjaxResult<PageInfo<SysRoleVO> > listPage(String roleName,int pageNumber,int pageSize) |
| | | public AjaxResult<PageInfo<SysRole> > listPage(String roleName,int pageNumber,int pageSize) |
| | | { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<>(); |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "添加", tags = {"后台-商品管理"}) |
| | | public R addGoods(@RequestBody TGoods dto) { |
| | | dto.setSurplus(dto.getTotal()); |
| | | goodsService.save(dto); |
| | | return R.ok("添加成功"); |
| | | } |
| | |
| | | * 兑换记录 |
| | | */ |
| | | @GetMapping("/exchangeRecord") |
| | | @ApiOperation(value = "学习端-兑换记录", tags = {"学习端-兑换记录"}) |
| | | public R<List<TOrder>> exchangeRecord() { |
| | | return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, tokenService.getLoginUserStudy().getUserid()) |
| | | .orderByDesc(TOrder::getCreateTime).list()); |
| | | @ApiOperation(value = "学习端-兑换记录", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 28) |
| | | public R<List<ExchangeRecordVO>> exchangeRecord() { |
| | | List<ExchangeRecordVO> exchangeRecord = orderService.exchangeRecord(tokenService.getLoginUserStudy().getUserid()); |
| | | for (ExchangeRecordVO record : exchangeRecord) { |
| | | TGoods goods = goodsService.getById(record.getGoodsId()); |
| | | List<String> typeList; |
| | | if (null != goods) { |
| | | List<TGoodsType> goodsTypes = goodsTypeService.lambdaQuery().in(TGoodsType::getId, Arrays.stream(goods.getTypeIds().split(",")).collect(Collectors.toList())) |
| | | .eq(TGoodsType::getIsDelete, 0).list(); |
| | | typeList = goodsTypes.stream().map(TGoodsType::getName).collect(Collectors.toList()); |
| | | } else { |
| | | typeList = new ArrayList<>(); |
| | | } |
| | | record.setGoodsType(typeList); |
| | | } |
| | | return R.ok(exchangeRecord); |
| | | } |
| | | |
| | | @GetMapping("/exchangeRecordParent") |
| | |
| | | */ |
| | | @GetMapping("/confirm") |
| | | @ApiOperation(value = "确认收货", tags = {"家长端-兑换记录"}) |
| | | @ApiOperationSupport(order = 16) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * 兑换记录 |
| | | */ |
| | | @GetMapping("/confirmStudy") |
| | | @ApiOperation(value = "确认收货", tags = {"学习端-兑换记录"}) |
| | | @ApiOperation(value = "确认收货", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 29) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | */ |
| | | @GetMapping("/shopAddressParent") |
| | | @ApiOperation(value = "获取用户收货地址", tags = {"家长端-获取用户收货地址"}) |
| | | @ApiOperationSupport(order = 17) |
| | | public R<List<Recipient>> shopAddressParent() { |
| | | if (tokenService.getLoginUser1() == null) { |
| | | return R.tokenError("登录失效"); |
| | |
| | | */ |
| | | @GetMapping("/setDefault") |
| | | @ApiOperation(value = "设置默认地址", tags = {"家长端-设置默认地址"}) |
| | | @ApiOperationSupport(order = 18) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * 设置默认地址 |
| | | */ |
| | | @GetMapping("/setDefaultStudy") |
| | | @ApiOperation(value = "设置默认地址", tags = {"学习端-设置默认地址"}) |
| | | @ApiOperation(value = "设置默认地址", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 30) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAddressById") |
| | | @ApiOperation(value = "获取地址详情", tags = {"家长端-获取地址详情"}) |
| | | @ApiOperation(value = "获取地址详情", tags = {"家长端-收货地址"}) |
| | | @ApiOperationSupport(order = 19) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAddressByIdStudy") |
| | | @ApiOperation(value = "获取地址详情", tags = {"学习端-获取地址详情"}) |
| | | @ApiOperation(value = "获取地址详情", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 31) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * 获取用户收货地址 |
| | | */ |
| | | @GetMapping("/shopAddress") |
| | | @ApiOperation(value = "获取用户收货地址", tags = {"学习端-获取用户收货地址"}) |
| | | @ApiOperation(value = "获取用户收货地址列表", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 32) |
| | | public R<List<Recipient>> shopAddress() { |
| | | if (tokenService.getLoginUserStudy() == null) { |
| | | return R.tokenError("登录失效"); |
| | |
| | | * 新增收货地址/修改收货地址 |
| | | */ |
| | | @PostMapping("/addressSaveOrUpdate") |
| | | @ApiOperation(value = "学习端-新增收货地址/修改收货地址", tags = {"学习端-新增收货地址/修改收货地址"}) |
| | | @ApiOperation(value = "新增收货地址/修改收货地址", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 33) |
| | | public R<String> addressSave(@RequestBody Recipient recipient) { |
| | | recipient.setUserId(tokenService.getLoginUserStudy().getUserid()); |
| | | if (recipient.getIsDefault() == 1){ |
| | |
| | | */ |
| | | @PostMapping("/addressSaveOrUpdateParent") |
| | | @ApiOperation(value = "家长端-新增收货地址/修改收货地址", tags = {"家长端-新增收货地址/修改收货地址"}) |
| | | @ApiOperationSupport(order = 20) |
| | | public R<String> addressSaveOrUpdateParent(@RequestBody Recipient recipient) { |
| | | if (tokenService.getLoginUser1() == null){ |
| | | return R.tokenError("登录失效!"); |
| | |
| | | * 删除收货地址 |
| | | */ |
| | | @GetMapping("/addressDelete") |
| | | @ApiOperation(value = "学习端-删除收货地址", tags = {"学习端-删除收货地址"}) |
| | | @ApiOperation(value = "删除收货地址", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 34) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "String", required = true) |
| | | @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "Integer", required = true) |
| | | }) |
| | | public R<String> addressDelete(@RequestParam String id) { |
| | | public R<String> addressDelete(@RequestParam Integer id) { |
| | | return R.ok(recipientService.removeById(id) ? "删除成功!" : "删除失败!"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/addressDeleteParent") |
| | | @ApiOperation(value = "家长端-删除收货地址", tags = {"家长端-删除收货地址"}) |
| | | @ApiOperationSupport(order = 21) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "String", required = true) |
| | | @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "Integer", required = true) |
| | | }) |
| | | public R<String> addressDeleteParent(@RequestParam Integer id) { |
| | | return R.ok(recipientService.removeById(id) ? "删除成功!" : "删除失败!"); |
| | |
| | | |
| | | @GetMapping("/getOrderAddressParent") |
| | | @ApiOperation(value = "获取修改订单收货地址", tags = {"家长端-获取修改订单收货地址"}) |
| | | @ApiOperationSupport(order = 22) |
| | | public R<List<Recipient>> getOrderAddressParent() { |
| | | if (tokenService.getLoginUser1() == null) { |
| | | return R.tokenError("登录失效"); |
| | |
| | | } |
| | | |
| | | @GetMapping("/getOrderAddress") |
| | | @ApiOperation(value = "获取修改订单收货地址", tags = {"学习端-获取修改订单收货地址"}) |
| | | @ApiOperation(value = "获取修改订单收货地址", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 35) |
| | | public R<List<Recipient>> getOrderAddress() { |
| | | if (tokenService.getLoginUserStudy() == null) { |
| | | return R.tokenError("登录失效"); |
| | |
| | | } |
| | | |
| | | @GetMapping("/updateOrderAddress") |
| | | @ApiOperation(value = "修改订单收货地址", tags = {"学习端-修改订单收货地址"}) |
| | | @ApiOperation(value = "修改订单收货地址", tags = {"学习端-收货地址"}) |
| | | @ApiOperationSupport(order = 36) |
| | | public R updateOrderAddress(@RequestParam Integer orderId, @RequestParam Integer recipientId) { |
| | | if (tokenService.getLoginUserStudy() == null) { |
| | | return R.tokenError("登录失效"); |
| | |
| | | * 收货地址省市区三级联动 |
| | | */ |
| | | @GetMapping("/addressTree") |
| | | @ApiOperation(value = "学习端-收货地址省市区三级联动", tags = {"学习端-收货地址省市区三级联动"}) |
| | | @ApiOperation(value = "收货地址省市区三级联动", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 37) |
| | | public R<List<Region>> addressTree() { |
| | | return R.ok(regionService.addressTree()); |
| | | } |
| | |
| | | * 远程调用 |
| | | */ |
| | | @GetMapping("/goodRecommend") |
| | | @ApiOperation(value = "学习端-可兑换商品推荐", tags = {"学习端-可兑换商品推荐"}) |
| | | @ApiOperation(value = "可兑换商品推荐", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 38) |
| | | public R<List<TGoodsVO>> goodRecommend() { |
| | | return R.ok(goodsService.goodRecommend(tokenService.getLoginUserStudy().getUserid())); |
| | | } |
| | |
| | | * 获取所有商品分类 |
| | | */ |
| | | @GetMapping("/goodTypeStudy") |
| | | @ApiOperation(value = "学习端-商品分类列表", tags = {"学习端-商品分类列表"}) |
| | | @ApiOperation(value = "商品分类列表", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 39) |
| | | public R<List<TGoodsType>> goodTypeStudy() { |
| | | return R.ok(goodsTypeService.lambdaQuery().eq(TGoodsType::getIsDelete, 0).eq(TGoodsType::getIsDelete, 0).list()); |
| | | } |
| | |
| | | * @param goodId 商品id |
| | | */ |
| | | @GetMapping("/goodDetail") |
| | | @ApiOperation(value = "学习端-商品详情", tags = {"学习端-商城"}) |
| | | @ApiOperation(value = "商品详情", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 40) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | */ |
| | | @GetMapping("/goodDetailParent") |
| | | @ApiOperation(value = "商品详情", tags = {"家长端-商城"}) |
| | | @ApiOperationSupport(order = 24) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | */ |
| | | @GetMapping("/redeemNow") |
| | | @ApiOperation(value = "商城立即兑换", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 41) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | */ |
| | | @GetMapping("/redeemNowParent") |
| | | @ApiOperation(value = "商城立即兑换", tags = {"家长端-商城"}) |
| | | @ApiOperationSupport(order = 25) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | } |
| | | |
| | | @PostMapping("/goodExchangeStudy") |
| | | @ApiOperation(value = "学习端-商品兑换确认", tags = {"学习端-商品兑换确认"}) |
| | | @ApiOperation(value = "商品兑换确认", tags = {"学习端-商城"}) |
| | | @ApiOperationSupport(order = 42) |
| | | public R goodExchangeStudy(@RequestBody GoodExchangeDTO goodExchange) { |
| | | Recipient recipient = recipientService.getById(goodExchange.getRecipientId()); |
| | | return goodsService.goodExchange(goodExchange, recipient); |
| | |
| | | |
| | | @PostMapping("/getOrderInfo/{id}") |
| | | @ApiOperation(value = "查看详情", tags = {"后台-订单管理"}) |
| | | @ApiOperationSupport(order = 11) |
| | | public R<TOrderVO> getOrderInfo(@PathVariable("id") Integer id) { |
| | | TOrder byId = orderService.getById(id); |
| | | TGoods byId2 = goodsService.getById(byId.getGoodsId()); |
| | |
| | | |
| | | @PostMapping("/confirm1") |
| | | @ApiOperation(value = "确认发货", tags = {"后台-订单管理"}) |
| | | @ApiOperationSupport(order = 12) |
| | | public R getGoodsInfo1(@RequestBody OrderDTO dto) { |
| | | TOrder byId = orderService.getById(dto.getId()); |
| | | byId.setState(2); |
| | |
| | | |
| | | @PostMapping("/listAll1") |
| | | @ApiOperation(value = "列表查询", tags = {"后台-订单管理"}) |
| | | @ApiOperationSupport(order = 13) |
| | | public R<PageInfo<TOrderVO>> listAll1(@RequestBody OrderQuery query) throws ParseException { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.ruoyi.common.core.web.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * 地址 |
| | | */ |
| | | @ApiModelProperty(value = "是否为默认地址0否1是") |
| | | @NotNull(message = "请选择:是否为默认收货地址") |
| | | private Integer isDefault; |
| | | |
| | | |
| | |
| | | @Override |
| | | public String toString() { |
| | | return "Recipient{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", recipient=" + recipient + |
| | | ", recipientPhone=" + recipientPhone + |
| | | ", province=" + province + |
| | | ", provinceCode=" + provinceCode + |
| | | ", city=" + city + |
| | | ", cityCode=" + cityCode + |
| | | ", address=" + address + |
| | | "}"; |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", recipient=" + recipient + |
| | | ", recipientPhone=" + recipientPhone + |
| | | ", province=" + province + |
| | | ", provinceCode=" + provinceCode + |
| | | ", city=" + city + |
| | | ", cityCode=" + cityCode + |
| | | ", address=" + address + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 消耗积分 |
| | | */ |
| | | @ApiModelProperty(value = "消耗积分") |
| | | private Integer integral; |
| | | @ApiModelProperty(value = "收货人姓名") |
| | | private String consigneeName; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private String keywords; |
| | | |
| | | @ApiModelProperty(value = "页码,首页1", required = true) |
| | | @NotNull(message = "请选择:当前页码数!") |
| | | private Integer pageNumber; |
| | | @ApiModelProperty(value = "页条数", required = true) |
| | | @NotNull(message = "请选择:每页显示条数!") |
| | | private Integer pageSize; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.goods.domain.TOrder; |
| | | import com.ruoyi.goods.dto.OrderQuery; |
| | | import com.ruoyi.goods.vo.ExchangeRecordVO; |
| | | import com.ruoyi.goods.vo.TOrderVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return 购买数量 |
| | | */ |
| | | Integer getGoodBuyNumber(@Param("goodId") Integer id); |
| | | |
| | | /** |
| | | * 兑换记录 |
| | | * |
| | | * @param userid 用户id |
| | | * @return 兑换记录 |
| | | */ |
| | | List<ExchangeRecordVO> exchangeRecord(Integer userid); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.goods.domain.TOrder; |
| | | import com.ruoyi.goods.dto.OrderQuery; |
| | | import com.ruoyi.goods.vo.ExchangeRecordVO; |
| | | import com.ruoyi.goods.vo.TOrderVO; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | Integer getGoodBuyNumber(Integer id); |
| | | |
| | | /** |
| | | * 兑换记录 |
| | | * |
| | | * @param userid 用户id |
| | | * @return 兑换记录 |
| | | */ |
| | | List<ExchangeRecordVO> exchangeRecord(Integer userid); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.RedisConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.goods.domain.Recipient; |
| | | import com.ruoyi.goods.domain.TGoods; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | String key = String.format(RedisConstants.GOOD_STOCK, goods.getId()); |
| | | RSemaphore semaphore = redissonClient.getSemaphore(key); |
| | | semaphore.trySetPermits(goods.getSurplus()); |
| | | semaphore.expire(Constants.SIXTY, TimeUnit.MINUTES); |
| | | return new GoodDetailVO(goods, recipient); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.goods.dto.OrderQuery; |
| | | import com.ruoyi.goods.mapper.TOrderMapper; |
| | | import com.ruoyi.goods.service.ITOrderService; |
| | | import com.ruoyi.goods.vo.ExchangeRecordVO; |
| | | import com.ruoyi.goods.vo.TOrderVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | return baseMapper.getGoodBuyNumber(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExchangeRecordVO> exchangeRecord(Integer userid) { |
| | | return baseMapper.exchangeRecord(userid); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-06-04 9:49 |
| | | */ |
| | | @Data |
| | | public class ExchangeRecordVO { |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @ApiModelProperty(value = "订单id") |
| | | private Integer orderId; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNumber; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "下单用户id") |
| | | private Integer userId; |
| | | /** |
| | | * 下单时间 |
| | | */ |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date insertTime; |
| | | @ApiModelProperty(value = "收货时间") |
| | | private Date completeTime; |
| | | /** |
| | | * 商品id |
| | | */ |
| | | @ApiModelProperty(value = "商品id") |
| | | private Integer goodsId; |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | /** |
| | | * 商品封面图 |
| | | */ |
| | | @ApiModelProperty(value = "商品封面图") |
| | | private String coverImg; |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | | @ApiModelProperty(value = "商品类型") |
| | | private List<String> goodsType; |
| | | /** |
| | | * 购买数量 |
| | | */ |
| | | @ApiModelProperty(value = "购买数量") |
| | | private Integer count; |
| | | /** |
| | | * 订单状态1待发货2已发货3已完成 |
| | | */ |
| | | @ApiModelProperty(value = "订单状态1待发货2已发货3已完成") |
| | | private Integer state; |
| | | /** |
| | | * 快递名称 |
| | | */ |
| | | @ApiModelProperty(value = "快递名称") |
| | | private String express; |
| | | /** |
| | | * 快递编号 |
| | | */ |
| | | @ApiModelProperty(value = "快递编号") |
| | | private String expressNumber; |
| | | /** |
| | | * 发货时间 |
| | | */ |
| | | @ApiModelProperty(value = "发货时间") |
| | | private Date expressTime; |
| | | /** |
| | | * 消耗积分 |
| | | */ |
| | | @ApiModelProperty(value = "消耗积分") |
| | | private Integer integral; |
| | | @ApiModelProperty(value = "收货人姓名") |
| | | private String consigneeName; |
| | | /** |
| | | * 消耗积分 |
| | | */ |
| | | @ApiModelProperty(value = "收货人电话") |
| | | private String consigneePhone; |
| | | @ApiModelProperty(value = "收货人地址") |
| | | private String consigneeAddress; |
| | | |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.goods.mapper.TOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.goods.domain.TOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | <result column="goodsId" property="goodsId" /> |
| | | <result column="count" property="count" /> |
| | | <result column="state" property="state" /> |
| | | <result column="express" property="express" /> |
| | | <result column="expressNumber" property="expressNumber" /> |
| | | <result column="expressTime" property="expressTime" /> |
| | | <result column="integral" property="integral" /> |
| | | <id column="id" property="id"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="goodsId" property="goodsId"/> |
| | | <result column="count" property="count"/> |
| | | <result column="state" property="state"/> |
| | | <result column="express" property="express"/> |
| | | <result column="expressNumber" property="expressNumber"/> |
| | | <result column="expressTime" property="expressTime"/> |
| | | <result column="integral" property="integral"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, orderNumber, userId, insertTime, goodsId, count, state, express, expressNumber, expressTime, integral |
| | | id, |
| | | orderNumber, |
| | | userId, |
| | | insertTime, |
| | | goodsId, |
| | | count, |
| | | state, |
| | | express, |
| | | expressNumber, |
| | | expressTime, |
| | | integral |
| | | </sql> |
| | | <select id="listAll" resultType="com.ruoyi.goods.vo.TOrderVO"> |
| | | select t1.*,t2.name as name |
| | | select t1.*, t2.name as name |
| | | from t_order t1 |
| | | left join t_goods t2 on t1.goodsId = t2.id |
| | | where 1=1 |
| | | left join t_goods t2 on t1.goodsId = t2.id |
| | | where 1 = 1 |
| | | <if test="null != req.state"> |
| | | and t1.state = #{req.state} |
| | | </if> |
| | |
| | | </select> |
| | | |
| | | <select id="getGoodBuyNumber" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(SUM(count), 0) FROM t_order WHERE goodsId = #{goodId} |
| | | SELECT IFNULL(SUM(count), 0) |
| | | FROM t_order |
| | | WHERE goodsId = #{goodId} |
| | | </select> |
| | | |
| | | <resultMap id="exchangRecordMap" type="com.ruoyi.goods.vo.ExchangeRecordVO"> |
| | | <id column="id" property="orderId"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="completeTime" property="completeTime"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="goodsId" property="goodsId"/> |
| | | <result column="count" property="count"/> |
| | | <result column="state" property="state"/> |
| | | <result column="express" property="express"/> |
| | | <result column="expressNumber" property="expressNumber"/> |
| | | <result column="expressTime" property="expressTime"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="consigneePhone" property="consigneePhone"/> |
| | | <result column="consigneeAddress" property="consigneeAddress"/> |
| | | <result column="goodsName" property="goodsName"/> |
| | | <result column="consigneeName" property="consigneeName"/> |
| | | <result column="coverImg" property="coverImg"/> |
| | | </resultMap> |
| | | |
| | | <select id="exchangeRecord" resultMap="exchangRecordMap"> |
| | | select o.*, g.id as goodsId, g.name as goodsName,g.coverImg |
| | | from t_order o |
| | | left join t_goods g on o.goodsId = g.id |
| | | where o.userId = #{userid} |
| | | </select> |
| | | </mapper> |
| | |
| | | public AjaxResult getSysSet() { |
| | | TSysSet byId = sysSetService.getById(1); |
| | | SysSetVO sysSetVO = new SysSetVO(); |
| | | BeanUtils.copyProperties(byId,sysSetVO); |
| | | BeanUtils.copyProperties(byId, sysSetVO); |
| | | return AjaxResult.success(sysSetVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "保存系统设置", tags = {"后台-系统设置"}) |
| | | @PostMapping(value = "/saveSysSet") |
| | | public AjaxResult saveSysSet(SysSetVO vo) { |
| | | TSysSet byId = sysSetService.getById(1); |
| | | BeanUtils.copyProperties(vo,byId); |
| | | BeanUtils.copyProperties(vo, byId); |
| | | byId.setId(1); |
| | | sysSetService.updateById(byId); |
| | | return AjaxResult.success("保存成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取启动页", tags = {"后台-启动页管理"}) |
| | | @PostMapping(value = "/getPage") |
| | | public AjaxResult getPage() { |
| | | List<TPage> list = pageService.list(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取注意事项、启动页", tags = {"家长端-获取注意事项、启动页"}) |
| | | @PostMapping(value = "/getPage1") |
| | | public R<List<TPage>> getPage1() { |
| | | List<TPage> list = pageService.list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "保存启动页", tags = {"后台-启动页管理"}) |
| | | @PostMapping(value = "/setPage") |
| | | public AjaxResult setPage(@RequestBody PageVO vo) { |
| | |
| | | String page2 = vo.getPage2(); |
| | | String page3 = vo.getPage3(); |
| | | String page4 = vo.getPage4(); |
| | | if (StringUtils.hasLength(page1)){ |
| | | if (StringUtils.hasLength(page1)) { |
| | | TPage type = pageService.getOne(new QueryWrapper<TPage>() |
| | | .eq("type", 1)); |
| | | TPage tPage = new TPage(); |
| | | |
| | | if (type == null){ |
| | | if (type == null) { |
| | | tPage.setImg(page1); |
| | | tPage.setType(1); |
| | | pageService.save(tPage); |
| | | }else{ |
| | | } else { |
| | | type.setImg(page1); |
| | | pageService.updateById(type); |
| | | } |
| | | } |
| | | if (StringUtils.hasLength(page2)){ |
| | | if (StringUtils.hasLength(page2)) { |
| | | TPage type = pageService.getOne(new QueryWrapper<TPage>() |
| | | .eq("type", 2)); |
| | | TPage tPage = new TPage(); |
| | | if (type == null){ |
| | | if (type == null) { |
| | | tPage.setImg(page2); |
| | | tPage.setType(2); |
| | | pageService.save(tPage); |
| | | }else{ |
| | | } else { |
| | | type.setImg(page2); |
| | | pageService.updateById(type); |
| | | } |
| | | } |
| | | if (StringUtils.hasLength(page3)){ |
| | | if (StringUtils.hasLength(page3)) { |
| | | TPage type = pageService.getOne(new QueryWrapper<TPage>() |
| | | .eq("type", 3)); |
| | | TPage tPage = new TPage(); |
| | | |
| | | if (type == null){ |
| | | if (type == null) { |
| | | tPage.setImg(page3); |
| | | tPage.setType(3); |
| | | pageService.save(tPage); |
| | | }else{ |
| | | } else { |
| | | type.setImg(page3); |
| | | pageService.updateById(type); |
| | | } |
| | | } |
| | | if (StringUtils.hasLength(page4)){ |
| | | if (StringUtils.hasLength(page4)) { |
| | | TPage type = pageService.getOne(new QueryWrapper<TPage>() |
| | | .eq("type", 4)); |
| | | if (type == null){ |
| | | if (type == null) { |
| | | TPage tPage = new TPage(); |
| | | tPage.setImg(page4); |
| | | tPage.setType(4); |
| | | pageService.save(tPage); |
| | | }else{ |
| | | } else { |
| | | type.setImg(page4); |
| | | pageService.updateById(type); |
| | | } |
| | | } |
| | | return AjaxResult.success("保存成功"); |
| | | } |
| | | |
| | | @PostMapping("/agreement") |
| | | @ApiOperation(value = "协议", tags = {"后台-协议管理"}) |
| | | public AjaxResult agreement(@RequestBody AggrementDTO dto) { |
| | | TProtocol protocol = protocolService.getById(dto.getType()); |
| | | if(StringUtils.hasLength(dto.getContent())){ |
| | | if (StringUtils.hasLength(dto.getContent())) { |
| | | protocol.setContent(dto.getContent()); |
| | | protocolService.updateById(protocol); |
| | | return AjaxResult.success("修改成功"); |
| | | }else{ |
| | | } else { |
| | | return AjaxResult.success(protocol.getContent()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/agreement1/{type}") |
| | | @ApiOperation(value = "协议", tags = {"家长端/学习端-获取协议"}) |
| | | public R<String> agreement1(@PathVariable("type") Integer type) { |
| | | public R<String> agreement1(@PathVariable("type") Integer type) { |
| | | TProtocol protocol = protocolService.getOne(new QueryWrapper<TProtocol>() |
| | | .eq("type",type)); |
| | | .eq("type", type)); |
| | | |
| | | return R.ok(protocol.getContent()); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/useGuide") |
| | | @ApiOperation(value = "使用指南-列表查询", tags = {"后台-使用指南"}) |
| | | public AjaxResult<PageInfo<TUseGuide>> agreement(String title, Integer pageNumber, Integer pageSize) { |
| | | QueryWrapper<TUseGuide> wrapper = new QueryWrapper<>(); |
| | | if (StringUtils.hasLength(title)){ |
| | | wrapper.like("title",title); |
| | | if (StringUtils.hasLength(title)) { |
| | | wrapper.like("title", title); |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | strings.add("insertTime"); |
| | |
| | | res.setTotal(useGuides.size()); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | @PostMapping("/useGuide1") |
| | | @ApiOperation(value = "列表查询", tags = {"家长端-使用指南"}) |
| | | public R<PageInfo<TUseGuide>> useGuide1(@RequestBody UseGuideQuery query) { |
| | | query.setPageNumber((query.getPageNumber() - 1) * query.getPageSize()); |
| | | QueryWrapper<TUseGuide> wrapper = new QueryWrapper<>(); |
| | | if (StringUtils.hasLength(query.getTitle())){ |
| | | wrapper.like("title",query.getTitle()); |
| | | if (StringUtils.hasLength(query.getTitle())) { |
| | | wrapper.like("title", query.getTitle()); |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | strings.add("insertTime"); |
| | |
| | | @PostMapping("/updateUseGuide") |
| | | @ApiOperation(value = "使用指南-添加/编辑/查看详情", tags = {"使用指南"}) |
| | | public AjaxResult<TUseGuide> updateUseGuide(@RequestBody UseGuidDTO dto) { |
| | | switch (dto.getType()){ |
| | | switch (dto.getType()) { |
| | | case 1: |
| | | TUseGuide useGuide = new TUseGuide(); |
| | | useGuide.setTitle(dto.getTitle()); |
| | |
| | | } |
| | | return AjaxResult.success(new TUseGuide()); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "使用指南-删除", tags = {"使用指南"}) |
| | | public AjaxResult updateUseGuide( Integer id) { |
| | | public AjaxResult updateUseGuide(Integer id) { |
| | | // TUseGuide useGuide2 = useGuideService.getById(id); |
| | | useGuideService.removeById(id); |
| | | return AjaxResult.success("删除成功"); |
| | |
| | | return R.ok(sysSetService.lambdaQuery().one()); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取正确及错误提示音效", tags = {"学习端-首页"}) |
| | | @GetMapping(value = "/promptVoice") |
| | | public R<TSysSet> promptVoice() { |
| | | return R.ok(sysSetService.lambdaQuery().eq(TSysSet::getDisabled, 0).one()); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private ITSubjectRecordService subjectRecordService; |
| | | @Resource |
| | | private ManagementClient managementClient; |
| | | |
| | | @PostMapping("/storyList") |
| | | // @ApiOperation(value = "配置学习类型选择故事", tags = {"题目管理"}) |
| | |
| | | @ApiOperation(value = "个人中心-积分明细", tags = {"家长端"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "查询时间 格式yyyy-MM", name = "time", dataType = "Integer"), |
| | | @ApiImplicitParam(value = "页码", name = "pageNumber", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "页码", name = "pageNum", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(value = "每页显示条数", name = "pageSize", dataType = "Integer", required = true) |
| | | }) |
| | | public R<IPage<TIntegralRecord>> integralDetailParent(String time, |
| | | @RequestParam("pageNumber") Integer pageNumber, |
| | | @RequestParam("pageNum") Integer pageNum, |
| | | @RequestParam("pageSize") Integer pageSize) { |
| | | if(tokenService.getLoginUser1() == null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | |
| | | return R.ok(integralRecordService.integralDetail(new Page<>(pageNumber, pageSize), tokenService.getLoginUser1().getUserid(), time)); |
| | | return R.ok(integralRecordService.integralDetail(new Page<>(pageNum, pageSize), tokenService.getLoginUser1().getUserid(), time)); |
| | | } |
| | | |
| | | /** |
| | |
| | | integralRecord.setUpdateTime(new Date()); |
| | | return R.ok(integralRecordService.save(integralRecord)); |
| | | } |
| | | |
| | | @GetMapping("/addIntegralDetail1") |
| | | // @ApiOperation(value = "添加-积分明细", tags = {"添加-积分明细"}) |
| | | @ApiImplicitParams({ |
| | |
| | | public R addIntegralDetail1(@RequestParam("integral") String integral, @RequestParam("method") String method) { |
| | | // 当前登录用户 |
| | | LoginUserParent userStudy = tokenService.getLoginUser1(); |
| | | if (userStudy == null){ |
| | | if (userStudy == null) { |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | // 生成积分明细信息 |
| | |
| | | } |
| | | return R.ok(userService.updateById(user)); |
| | | } |
| | | |
| | | @GetMapping("/exchangeIntegral1") |
| | | // @ApiOperation(value = "用户积分变动", tags = {"用户积分变动"}) |
| | | public R<Boolean> exchangeIntegral1(@RequestParam("integral") Integer integral, @RequestParam("method") String method) { |
| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @PostMapping("/pay") |
| | | @ApiOperation(value = "购买会员支付操作", tags = {"家长端-个人中心"}) |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/order") |
| | | @ApiOperation(value = "购买会员下单操作", tags = {"家长端-个人中心"}) |
| | | @ApiImplicitParams({ |
| | |
| | | */ |
| | | @GetMapping("/userInfo") |
| | | @ApiOperation(value = "用户详情", tags = {"学习端-用户详情"}) |
| | | public R<TUser> userInfo() { |
| | | |
| | | return R.ok(userService.lambdaQuery().eq(TUser::getId, tokenService.getLoginUserStudy().getUserid()).one()); |
| | | public R<UserPersonalCenterVO> userInfo() { |
| | | TUser user = userService.lambdaQuery().eq(TUser::getId, tokenService.getLoginUserStudy().getUserid()).one(); |
| | | TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, user.getId()).eq(TUserStudy::getDisabled, 0).one(); |
| | | return R.ok(new UserPersonalCenterVO(user, userStudy)); |
| | | } |
| | | |
| | | @PostMapping("/deleteUser") |
| | |
| | | @ApiModelProperty(value = "已回答正确的题目id 多个逗号隔开") |
| | | private String completeSubject; |
| | | |
| | | |
| | | } |
| | |
| | | * 所属周目 |
| | | */ |
| | | @ApiModelProperty(value = "所属周目") |
| | | private Integer week;/** |
| | | private Integer week; |
| | | /** |
| | | * 故事名称 |
| | | */ |
| | | @ApiModelProperty(value = "学习进度dayXX") |
| | | private Integer day;/** |
| | | private Integer day; |
| | | /** |
| | | * 故事名称 |
| | | */ |
| | | @ApiModelProperty(value = "总学习时长 单位小时") |
| | | private Integer totalStudy;/** |
| | | private Integer totalStudy; |
| | | /** |
| | | * 故事名称 |
| | | */ |
| | | @ApiModelProperty(value = "今日学习时长 单位小时") |
| | | private Integer todayStudy;/** |
| | | private Integer todayStudy; |
| | | /** |
| | | * 故事名称 |
| | | */ |
| | | @ApiModelProperty(value = "本周学习时长") |
| | | private Integer weekStudy;/** |
| | | private Integer weekStudy; |
| | | /** |
| | | * 故事名称 |
| | | */ |
| | | @ApiModelProperty(value = "本月学习时长") |
| | |
| | | @ApiModelProperty("根据正确率计算可获得积分数量") |
| | | private Integer availableIntegral; |
| | | |
| | | /** |
| | | * 完成听故事、完成游戏、完成答题、完成每日学习、商城消费 |
| | | */ |
| | | @ApiModelProperty("完成听故事、完成游戏、完成答题、完成每日学习、商城消费") |
| | | private String method; |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | |
| | | public class CompleteStudyDTO { |
| | | |
| | | /** |
| | | * 积分数量 |
| | | * 题目id数组 |
| | | */ |
| | | @ApiModelProperty("积分数量") |
| | | private Integer integral; |
| | | @ApiModelProperty("题目类型(1:听音选图;2:看图选音;3:归纳排除;4:有问有答;5:音图相配)") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 完成听故事、完成游戏、完成答题、完成每日学习、商城消费 |
| | | * 题目id数组 |
| | | */ |
| | | @ApiModelProperty("完成听故事、完成游戏、完成答题、完成每日学习、商城消费、分享") |
| | | private String method; |
| | | @ApiModelProperty("题目id数组") |
| | | private List<Integer> studyIds; |
| | | |
| | | /** |
| | | * 该学习是否完成 |
| | |
| | | @ApiModelProperty("该学习是否完成(如果已完成再次进入学习并完成学习后,该字段传值 false)") |
| | | private Boolean isComplete; |
| | | |
| | | /** |
| | | * 学习时长 |
| | | */ |
| | | @ApiModelProperty("完成学习所用时长") |
| | | @NotNull(message = "本次学习时长不能为空!") |
| | | private Integer studyTime; |
| | | |
| | | } |
| | |
| | | public class StudyWeekDTO extends StudyDTO { |
| | | |
| | | @ApiModelProperty("完成后可获积分数") |
| | | private Integer totalIntegral; |
| | | private Long totalIntegral; |
| | | |
| | | @ApiModelProperty("所属季度") |
| | | private Integer quarter; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.study.domain.TStudyAnswer; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TStudyAnswerMapper extends BaseMapper<TStudyAnswer> { |
| | | |
| | | /** |
| | | * 自主学习4-有问有答 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 有问有答 |
| | | */ |
| | | List<TStudyAnswer> questionsAndAnswers(@Param("quarter") Integer quarter, @Param("week") Integer week, @Param("day") Integer day); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.study.domain.TStudyInduction; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TStudyInductionMapper extends BaseMapper<TStudyInduction> { |
| | | |
| | | /** |
| | | * 自主学习3-归纳排除 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 归纳排除 |
| | | */ |
| | | List<TStudyInduction> induceExclude(@Param("quarter") Integer quarter, @Param("week") Integer week, @Param("day") Integer day); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.study.domain.TStudyListen; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TStudyListenMapper extends BaseMapper<TStudyListen> { |
| | | |
| | | /** |
| | | * 自主学习1-听音选图 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 听音选图 |
| | | */ |
| | | List<TStudyListen> listenSelectPicture(@Param("quarter") Integer quarter, @Param("week") Integer week, @Param("day") Integer day); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.study.domain.TStudyLook; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TStudyLookMapper extends BaseMapper<TStudyLook> { |
| | | |
| | | /** |
| | | * 自主学习2-看图选音 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 听音选图 |
| | | */ |
| | | List<TStudyLook> pictureSelectVoice(@Param("quarter") Integer quarter, @Param("week") Integer week, @Param("day") Integer day); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.study.domain.TStudyPair; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TStudyPairMapper extends BaseMapper<TStudyPair> { |
| | | |
| | | /** |
| | | * 自主学习5-音图相配 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 音图相配 |
| | | */ |
| | | List<TStudyPair> pictureMateVoice(@Param("quarter") Integer quarter, @Param("week") Integer week, @Param("day") Integer day); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudyAnswer; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务类 |
| | |
| | | */ |
| | | public interface ITStudyAnswerService extends IService<TStudyAnswer> { |
| | | |
| | | /** |
| | | * 自主学习4-有问有答 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 有问有答 |
| | | */ |
| | | List<TStudyAnswer> questionsAndAnswers(Integer quarter, Integer week, Integer day); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudyInduction; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务类 |
| | |
| | | */ |
| | | public interface ITStudyInductionService extends IService<TStudyInduction> { |
| | | |
| | | /** |
| | | * 自主学习3-归纳排除 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 归纳排除 |
| | | */ |
| | | List<TStudyInduction> induceExclude(Integer quarter, Integer week, Integer day); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudyListen; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务类 |
| | |
| | | */ |
| | | public interface ITStudyListenService extends IService<TStudyListen> { |
| | | |
| | | /** |
| | | * 自主学习1-听音选图 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 听音选图 |
| | | */ |
| | | List<TStudyListen> listenSelectPicture(Integer quarter, Integer week, Integer day); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudyLook; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务类 |
| | |
| | | */ |
| | | public interface ITStudyLookService extends IService<TStudyLook> { |
| | | |
| | | /** |
| | | * 自主学习2-看图选音 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 听音选图 |
| | | */ |
| | | List<TStudyLook> pictureSelectVoice(Integer quarter, Integer week, Integer day); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudyPair; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务类 |
| | |
| | | */ |
| | | public interface ITStudyPairService extends IService<TStudyPair> { |
| | | |
| | | /** |
| | | * 自主学习5-音图相配 |
| | | * |
| | | * @param quarter 季度 |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 音图相配 |
| | | */ |
| | | List<TStudyPair> pictureMateVoice(Integer quarter, Integer week, Integer day); |
| | | } |
| | |
| | | * |
| | | * @param userId 用户id |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 学习信息 |
| | | */ |
| | | TUserStudy studySchedule(String userId, Integer week, Integer day); |
| | | TUserStudy studySchedule(String userId, Integer week); |
| | | |
| | | /** |
| | | * 自主学习1-听音选图 |
| | |
| | | * @param pair 音图相配 |
| | | * @return 题目信息 |
| | | */ |
| | | StudyPairResultVO pictureMateVoice(Integer week, Integer day, TStudyPair pair); |
| | | StudyPairResultVO pictureMateVoice(Integer week, Integer day, List<TStudyPair> pair); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.study.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.study.domain.TStudy; |
| | | import com.ruoyi.study.domain.TUserStudy; |
| | | import com.ruoyi.study.dto.CompleteStudyDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * |
| | | * @param userId 用户id |
| | | * @param week 周目 |
| | | * @param day 所属day |
| | | * @return 学习信息 |
| | | */ |
| | | TUserStudy studySchedule(String userId, Integer week, Integer day); |
| | | TUserStudy studySchedule(String userId, Integer week); |
| | | |
| | | /** |
| | | * 根据条件清空用户学习时长 |
| | | * 定时任务 清空用户学习时长 |
| | | * |
| | | * @param time 今日/本周/本月 |
| | | */ |
| | | void resettingStudyRecord(String time); |
| | | |
| | | /** |
| | | * 更改学习进度 |
| | | * |
| | | * @param studyList 学习配置列表 |
| | | * @param userId 用户id |
| | | * @param completeStudy 学习情况 |
| | | * @return 更改结果 |
| | | */ |
| | | Boolean exchangeStudyRecord(List<TStudy> studyList, Integer userId, CompleteStudyDTO completeStudy); |
| | | } |
| | |
| | | return availableIntegral; |
| | | } else { |
| | | // 积分明细不为空,根据正确率及已获取积分数量计算本次答题可获取的积分数量 |
| | | List<Integer> integralList = integralRecordList.stream().map(TIntegralRecord::getIntegral).collect(Collectors.toList()).stream().map(Integer::parseInt).collect(Collectors.toList()); |
| | | List<Integer> integralList = integralRecordList.stream().map(TIntegralRecord::getIntegral).collect(Collectors.toList()) |
| | | .stream().map(Integer::parseInt).collect(Collectors.toList()); |
| | | int sumIntegral = integralList.stream().mapToInt(Integer::intValue).sum(); |
| | | if (availableIntegral > sumIntegral) { |
| | | return availableIntegral - sumIntegral; |
| | |
| | | import com.ruoyi.study.service.ITStudyAnswerService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务实现类 |
| | |
| | | @Service |
| | | public class TStudyAnswerServiceImpl extends ServiceImpl<TStudyAnswerMapper, TStudyAnswer> implements ITStudyAnswerService { |
| | | |
| | | @Override |
| | | public List<TStudyAnswer> questionsAndAnswers(Integer quarter, Integer week, Integer day) { |
| | | return baseMapper.questionsAndAnswers(quarter, week, day); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.study.service.ITStudyInductionService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务实现类 |
| | |
| | | @Service |
| | | public class TStudyInductionServiceImpl extends ServiceImpl<TStudyInductionMapper, TStudyInduction> implements ITStudyInductionService { |
| | | |
| | | @Override |
| | | public List<TStudyInduction> induceExclude(Integer quarter, Integer week, Integer day) { |
| | | return baseMapper.induceExclude(quarter, week, day); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.study.service.ITStudyListenService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务实现类 |
| | |
| | | @Service |
| | | public class TStudyListenServiceImpl extends ServiceImpl<TStudyListenMapper, TStudyListen> implements ITStudyListenService { |
| | | |
| | | @Override |
| | | public List<TStudyListen> listenSelectPicture(Integer quarter, Integer week, Integer day) { |
| | | return baseMapper.listenSelectPicture(quarter, week, day); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.study.mapper.TStudyLookMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务实现类 |
| | |
| | | @Service |
| | | public class TStudyLookServiceImpl extends ServiceImpl<TStudyLookMapper, TStudyLook> implements ITStudyLookService { |
| | | |
| | | @Override |
| | | public List<TStudyLook> pictureSelectVoice(Integer quarter, Integer week, Integer day) { |
| | | return baseMapper.pictureSelectVoice(quarter, week, day); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.study.mapper.TStudyPairMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 自主游戏 服务实现类 |
| | |
| | | @Service |
| | | public class TStudyPairServiceImpl extends ServiceImpl<TStudyPairMapper, TStudyPair> implements ITStudyPairService { |
| | | |
| | | @Override |
| | | public List<TStudyPair> pictureMateVoice(Integer quarter, Integer week, Integer day) { |
| | | return baseMapper.pictureMateVoice(quarter, week, day); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public TUserStudy studySchedule(String userId, Integer week, Integer day) { |
| | | return userStudyService.studySchedule(userId, week, day); |
| | | public TUserStudy studySchedule(String userId, Integer week) { |
| | | return userStudyService.studySchedule(userId, week); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public StudyListenResultVO listenSelectPicture(Integer week, Integer day, List<TStudyListen> studyListens) { |
| | | if (studyListens.isEmpty()) { |
| | | throw new GlobalException("当前学习周目题目数量不足!"); |
| | | } |
| | | // 随机获取一组题 |
| | | Random rand = new Random(); |
| | | TStudyListen data = studyListens.get(rand.nextInt(studyListens.size())); |
| | | TStudyListen data; |
| | | if (studyListens.size() == 1) { |
| | | data = studyListens.get(0); |
| | | } else { |
| | | data = studyListens.get(rand.nextInt(studyListens.size())); |
| | | } |
| | | List<TSubject> subjectList = getSubjects(data.getSubject().split(",")); |
| | | return new StudyListenResultVO(data, subjectList); |
| | | } |
| | | |
| | | @Override |
| | | public StudyLookResultVO pictureSelectVoice(Integer week, Integer day, List<TStudyLook> lookList) { |
| | | if (lookList.isEmpty()) { |
| | | throw new GlobalException("当前学习周目题目数量不足!"); |
| | | } |
| | | // 随机获取一组题 |
| | | Random rand = new Random(); |
| | | TStudyLook data = lookList.get(rand.nextInt(lookList.size())); |
| | | TStudyLook data; |
| | | if (lookList.size() == 1) { |
| | | data = lookList.get(0); |
| | | } else { |
| | | data = lookList.get(rand.nextInt(lookList.size())); |
| | | } |
| | | List<TSubject> subjectList = getSubjects(data.getSubject().split(",")); |
| | | return new StudyLookResultVO(data, subjectList); |
| | | } |
| | | |
| | | @Override |
| | | public StudyInductionResultVO induceExclude(Integer week, Integer day, List<TStudyInduction> inductionList) { |
| | | if (inductionList.isEmpty()) { |
| | | throw new GlobalException("当前学习周目题目数量不足!"); |
| | | } |
| | | // 随机获取一组题 |
| | | Random rand = new Random(); |
| | | TStudyInduction data = inductionList.get(rand.nextInt(inductionList.size())); |
| | | List<TSubject> subjectList = getSubjects(data.getSubject().split(",")); |
| | | TStudyInduction data; |
| | | if (inductionList.size() == 1) { |
| | | data = inductionList.get(0); |
| | | } else { |
| | | data = inductionList.get(rand.nextInt(inductionList.size())); |
| | | } |
| | | String[] ids = data.getSubject().split(","); |
| | | List<TSubject> subjectList = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | if (id.startsWith("-")) { |
| | | id = id.replace("-", ""); |
| | | } |
| | | subjectList.add(subjectService.getById(id)); |
| | | } |
| | | return new StudyInductionResultVO(data, subjectList); |
| | | } |
| | | |
| | | @Override |
| | | public StudyAnswerResultVO questionsAndAnswers(Integer week, Integer day, List<TStudyAnswer> answerList) { |
| | | if (answerList.isEmpty()) { |
| | | throw new GlobalException("当前学习周目题目数量不足!"); |
| | | } |
| | | // 随机获取一组题 |
| | | Random rand = new Random(); |
| | | TStudyAnswer data = answerList.get(rand.nextInt(answerList.size())); |
| | | TStudyAnswer data; |
| | | TStudyAnswer dataTwo; |
| | | if (answerList.size() == 1) { |
| | | data = answerList.get(0); |
| | | dataTwo = answerList.get(0); |
| | | } else { |
| | | data = answerList.get(rand.nextInt(answerList.size())); |
| | | dataTwo = answerList.get(rand.nextInt(answerList.size())); |
| | | } |
| | | AnswerVO one = new AnswerVO(); |
| | | BeanUtils.copyProperties(data, one); |
| | | answerList.remove(data); |
| | | TStudyAnswer dataTwo = answerList.get(rand.nextInt(answerList.size())); |
| | | AnswerVO two = new AnswerVO(); |
| | | BeanUtils.copyProperties(dataTwo, two); |
| | | // 获取问题题目 和 回答题目 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public StudyPairResultVO pictureMateVoice(Integer week, Integer day, TStudyPair pair) { |
| | | List<TSubject> subjectList = getSubjects(pair.getSubject().split(",")); |
| | | return new StudyPairResultVO(pair, subjectList); |
| | | public StudyPairResultVO pictureMateVoice(Integer week, Integer day, List<TStudyPair> pair) { |
| | | if (pair.isEmpty()) { |
| | | throw new GlobalException("当前学习周目题目数量不足!"); |
| | | } |
| | | // 随机获取一组题 |
| | | Random rand = new Random(); |
| | | TStudyPair data; |
| | | if (pair.size() == 1) { |
| | | data = pair.get(0); |
| | | } else { |
| | | data = pair.get(rand.nextInt(pair.size())); |
| | | } |
| | | List<TSubject> subjectList = getSubjects(data.getSubject().split(",")); |
| | | return new StudyPairResultVO(data, subjectList); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 图片及语音集合 |
| | | */ |
| | | private List<TSubject> getSubjects(String[] ids) { |
| | | return subjectService.lambdaQuery().in(TSubject::getId, Arrays.asList(ids)).list(); |
| | | List<TSubject> list = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | TSubject data = subjectService.lambdaQuery().eq(TSubject::getId, id) |
| | | .eq(TSubject::getDisabled, 0).one(); |
| | | list.add(data); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.study.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.study.domain.TStudy; |
| | | import com.ruoyi.study.domain.TUserStudy; |
| | | import com.ruoyi.study.dto.CompleteStudyDTO; |
| | | import com.ruoyi.study.mapper.TUserStudyMapper; |
| | | import com.ruoyi.study.service.ITUserStudyService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TUserStudyServiceImpl extends ServiceImpl<TUserStudyMapper, TUserStudy> implements ITUserStudyService { |
| | | |
| | | /** |
| | | * 所属day map |
| | | */ |
| | | private static final Map<String, Integer> DAY_MAP = new HashMap<>(12); |
| | | |
| | | static { |
| | | DAY_MAP.put(Constants.ONE_STR, Constants.TWO); |
| | | DAY_MAP.put(Constants.TWO_STR, Constants.THREE); |
| | | DAY_MAP.put(Constants.THREE_STR, Constants.FOUR); |
| | | DAY_MAP.put(Constants.FOUR_STR, Constants.FIVE); |
| | | DAY_MAP.put(Constants.FIVE_STR, Constants.ONE); |
| | | // DAY_MAP.put(Constants.SIX_STR, Constants.SEVEN); |
| | | // DAY_MAP.put(Constants.SEVEN_STR, Constants.ONE); |
| | | } |
| | | |
| | | @Override |
| | | public TUserStudy studySchedule(String userId, Integer week, Integer day) { |
| | | return lambdaQuery().eq(TUserStudy::getUserId, userId) |
| | | .eq(TUserStudy::getDay, day).eq(TUserStudy::getWeek, week) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | public TUserStudy studySchedule(String userId, Integer week) { |
| | | LambdaQueryChainWrapper<TUserStudy> wrapper = lambdaQuery().eq(TUserStudy::getUserId, userId); |
| | | wrapper = null != week ? wrapper.eq(TUserStudy::getWeek, week) : wrapper; |
| | | return wrapper.eq(TUserStudy::getDisabled, 0).one(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | break; |
| | | default: |
| | | } |
| | | // 自旋重试 |
| | | int number = 0; |
| | | boolean update = this.updateBatchById(list); |
| | | while (!update) { |
| | |
| | | number++; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Boolean exchangeStudyRecord(List<TStudy> studyList, Integer userId, CompleteStudyDTO completeStudy) { |
| | | Integer studyTime = completeStudy.getStudyTime(); |
| | | // 学习记录 |
| | | TUserStudy userStudyRecord = lambdaQuery().eq(TUserStudy::getUserId, userId) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | Integer type = completeStudy.getType(); |
| | | if (Constants.ONE.equals(type)) { |
| | | userStudyRecord.setListen(Constants.ONE_HUNDRED); |
| | | } else if (Constants.TWO.equals(type)) { |
| | | userStudyRecord.setLook(Constants.ONE_HUNDRED); |
| | | } else if (Constants.THREE.equals(type)) { |
| | | userStudyRecord.setInduction(Constants.ONE_HUNDRED); |
| | | } else if (Constants.FOUR.equals(type)) { |
| | | userStudyRecord.setAnswer(Constants.ONE_HUNDRED); |
| | | } else if (Constants.FIVE.equals(type)) { |
| | | // 类型五,说明当前day已经全部完成,更新学习记录的 day |
| | | Integer nextDay = DAY_MAP.get(String.valueOf(userStudyRecord.getDay())); |
| | | userStudyRecord.setDay(nextDay); |
| | | // 学习day已切换更新学习进度及学习时长 |
| | | userStudyRecord.setListen(Constants.ZERO); |
| | | userStudyRecord.setLook(Constants.ZERO); |
| | | userStudyRecord.setInduction(Constants.ZERO); |
| | | userStudyRecord.setAnswer(Constants.ZERO); |
| | | userStudyRecord.setPair(Constants.ZERO); |
| | | // 下一day为 1说明该周目已完成,应更改为下一周目 |
| | | if (Constants.ONE.equals(nextDay)) { |
| | | // 获取下一周目信息 |
| | | int index = -1; |
| | | for (int i = 0; i < studyList.size(); i++) { |
| | | if (studyList.get(i).getWeek().equals(userStudyRecord.getWeek())) { |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | int nextIndex = (index + 1) % studyList.size(); |
| | | TStudy nextStudy = studyList.get(nextIndex); |
| | | // 更新学习进度及学习时长 |
| | | userStudyRecord.setWeek(nextStudy.getWeek()); |
| | | } |
| | | } |
| | | // 更新学习时长 |
| | | userStudyRecord.setTotalStudy(userStudyRecord.getTotalStudy() + studyTime); |
| | | userStudyRecord.setTodayStudy(userStudyRecord.getTodayStudy() + studyTime); |
| | | userStudyRecord.setWeekStudy(userStudyRecord.getWeekStudy() + studyTime); |
| | | userStudyRecord.setMonthStudy(userStudyRecord.getMonthStudy() + studyTime); |
| | | // 更新学习进度及学习时长 |
| | | return this.updateById(userStudyRecord); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.study.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-06-04 17:00 |
| | | */ |
| | | @Data |
| | | public class PromptVoiceVO { |
| | | |
| | | @ApiModelProperty("正确音效") |
| | | private String correct; |
| | | |
| | | @ApiModelProperty("错误音效") |
| | | private String error; |
| | | |
| | | public PromptVoiceVO(String correct, String error) { |
| | | this.correct = correct; |
| | | this.error = error; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.study.vo; |
| | | |
| | | import com.ruoyi.study.domain.TUser; |
| | | import com.ruoyi.study.domain.TUserStudy; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-06-04 9:38 |
| | | */ |
| | | @Data |
| | | public class UserPersonalCenterVO { |
| | | |
| | | @ApiModelProperty("用户信息") |
| | | private TUser user; |
| | | |
| | | @ApiModelProperty("用户学习信息(学习时长、学习进度)") |
| | | private TUserStudy userStudy; |
| | | |
| | | public UserPersonalCenterVO(TUser user, TUserStudy userStudy) { |
| | | this.user = user; |
| | | this.userStudy = userStudy; |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.study.mapper.TStudyAnswerMapper"> |
| | | |
| | | |
| | | <select id="questionsAndAnswers" resultType="com.ruoyi.study.domain.TStudyAnswer"> |
| | | select sl.* |
| | | from t_study_answer sl |
| | | left join t_study s on sl.studyId = s.id |
| | | <where> |
| | | sl.disabled = 0 |
| | | and s.disabled = 0 |
| | | and sl.day = #{day} |
| | | and sl.week = #{week} |
| | | and s.quarter = #{quarter} |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.study.mapper.TStudyInductionMapper"> |
| | | |
| | | |
| | | |
| | | <select id="induceExclude" resultType="com.ruoyi.study.domain.TStudyInduction"> |
| | | select sl.* |
| | | from t_study_induction sl |
| | | left join t_study s on sl.studyId = s.id |
| | | <where> |
| | | sl.disabled = 0 |
| | | and s.disabled = 0 |
| | | and sl.day = #{day} |
| | | and sl.week = #{week} |
| | | and s.quarter = #{quarter} |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.study.mapper.TStudyListenMapper"> |
| | | |
| | | |
| | | |
| | | <select id="listenSelectPicture" resultType="com.ruoyi.study.domain.TStudyListen"> |
| | | select sl.* |
| | | from t_study_listen sl |
| | | left join t_study s on sl.studyId = s.id |
| | | <where> |
| | | sl.disabled = 0 and s.disabled = 0 |
| | | and sl.day = #{day} and sl.week = #{week} and s.quarter = #{quarter} |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.study.mapper.TStudyLookMapper"> |
| | | |
| | | |
| | | <select id="pictureSelectVoice" resultType="com.ruoyi.study.domain.TStudyLook"> |
| | | select sl.* |
| | | from t_study_look sl |
| | | left join t_study s on sl.studyId = s.id |
| | | <where> |
| | | sl.disabled = 0 and s.disabled = 0 |
| | | and sl.day = #{day} and sl.week = #{week} and s.quarter = #{quarter} |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | COALESCE(SUM(g.integral), 0) AS totalIntegral, |
| | | s.week, |
| | | s.title, |
| | | s.quarter,s.id |
| | | s.quarter, |
| | | s.id |
| | | FROM t_study s |
| | | LEFT JOIN t_study_answer sa ON s.id = sa.studyId |
| | | LEFT JOIN t_study_induction si ON s.id = si.studyId |
| | |
| | | LEFT JOIN t_study_pair sp ON s.id = sp.studyId |
| | | LEFT JOIN t_story_listen sl ON s.id = sl.studyId |
| | | LEFT JOIN t_game g ON s.id = g.studyId |
| | | GROUP BY s.week, s.title, s.quarter,s.id; |
| | | <where> |
| | | <if test="quarter != null"> |
| | | s.quarter = #{quarter} |
| | | </if> |
| | | <if test="type != null"> |
| | | and s.type = #{type} |
| | | </if> |
| | | </where> |
| | | GROUP BY s.week, s.title, s.quarter, s.id; |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.study.mapper.TStudyPairMapper"> |
| | | |
| | | |
| | | |
| | | <select id="pictureMateVoice" resultType="com.ruoyi.study.domain.TStudyPair"> |
| | | select sl.* |
| | | from t_study_pair sl |
| | | left join t_study s on sl.studyId = s.id |
| | | <where> |
| | | sl.disabled = 0 |
| | | and s.disabled = 0 |
| | | and sl.day = #{day} |
| | | and sl.week = #{week} |
| | | and s.quarter = #{quarter} |
| | | </where> |
| | | </select> |
| | | </mapper> |