ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/GlobalException.java
@@ -5,8 +5,7 @@ * * @author ruoyi */ public class GlobalException extends RuntimeException { public class GlobalException extends RuntimeException { private static final long serialVersionUID = 1L; /** @@ -16,41 +15,34 @@ /** * 错误明细,内部调试错误 * */ private String detailMessage; /** * 空构造方法,避免反序列化问题 */ public GlobalException() { public GlobalException() { } public GlobalException(String message) { public GlobalException(String message) { this.message = message; } public String getDetailMessage() { public String getDetailMessage() { return detailMessage; } public GlobalException setDetailMessage(String detailMessage) { public GlobalException setDetailMessage(String detailMessage) { this.detailMessage = detailMessage; return this; } @Override public String getMessage() { public String getMessage() { return message; } public GlobalException setMessage(String message) { public GlobalException setMessage(String message) { this.message = message; return this; } ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/service/TokenService.java
@@ -145,7 +145,7 @@ public LoginUserParent getLoginUserStudy() { LoginUserParent userStudy = getLoginUserStudy(ServletUtils.getRequest()); if (null == userStudy) { throw new StudyLoginException("登录失效,请重新登录!", 504); throw new StudyLoginException("登录失效,请重新登录!", 600); } return userStudy; } ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java
@@ -62,7 +62,7 @@ String userkey2 = JwtUtils.getUserKey2(claims); boolean islogin = redisService.hasKey(getTokenKey(userkey)); boolean islogin1 = redisService.hasKey(getTokenKey(userkey1)); boolean islogin2 = redisService.hasKey(getTokenKey(userkey2)); boolean islogin2 = redisService.hasKey(getTokenKeyStudy(userkey2)); if (!islogin && !islogin1 && !islogin2) { return unauthorizedResponse(exchange, "登录状态已过期"); } @@ -115,6 +115,13 @@ } /** * 获取学习端缓存key */ private String getTokenKeyStudy(String token) { return CacheConstants.LOGIN_TOKEN_KEY_STUDY + token; } /** * 获取请求token */ private String getToken(ServerHttpRequest request) { ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -1,10 +1,12 @@ package com.ruoyi.system.service.impl; import java.util.*; import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysRole; import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.SysMenus; import com.ruoyi.system.domain.vo.MetaVo; @@ -17,11 +19,9 @@ import com.ruoyi.system.service.ISysMenuService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysRole; import java.util.*; import java.util.stream.Collectors; /** * 菜单 业务层处理 @@ -29,8 +29,7 @@ * @author ruoyi */ @Service public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService { public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService { public static final String PREMISSION_STRING = "perms[\"{0}\"]"; @Autowired @@ -55,8 +54,7 @@ * @return 菜单列表 */ @Override public List<SysMenu> selectMenuList(Long userId) { public List<SysMenu> selectMenuList(Long userId) { return selectMenuList(new SysMenu(), userId); } @@ -67,8 +65,7 @@ * @return 菜单列表 */ @Override public List<SysMenu> selectMenuList(SysMenu menu, Long userId) { public List<SysMenu> selectMenuList(SysMenu menu, Long userId) { List<SysMenu> menuList = null; // 管理员显示所有菜单信息 { @@ -85,14 +82,11 @@ * @return 权限列表 */ @Override public Set<String> selectMenuPermsByUserId(Long userId) { public Set<String> selectMenuPermsByUserId(Long userId) { List<String> perms = menuMapper.selectMenuPermsByUserId(userId); Set<String> permsSet = new HashSet<>(); for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } @@ -106,14 +100,11 @@ * @return 权限列表 */ @Override public Set<String> selectMenuPermsByRoleId(Long roleId) { public Set<String> selectMenuPermsByRoleId(Long roleId) { List<String> perms = menuMapper.selectMenuPermsByRoleId(roleId); Set<String> permsSet = new HashSet<>(); for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { for (String perm : perms) { if (StringUtils.isNotEmpty(perm)) { permsSet.addAll(Arrays.asList(perm.trim().split(","))); } } @@ -127,15 +118,11 @@ * @return 菜单列表 */ @Override public List<SysMenu> selectMenuTreeByUserId(Long userId) { public List<SysMenu> selectMenuTreeByUserId(Long userId) { List<SysMenu> menus = null; if (SecurityUtils.isAdmin(userId)) { if (SecurityUtils.isAdmin(userId)) { menus = menuMapper.selectMenuTreeAll(); } else { } else { menus = menuMapper.selectMenuTreeByUserId(userId); } return getChildPerms(menus, 0); @@ -148,8 +135,7 @@ * @return 选中菜单列表 */ @Override public List<Long> selectMenuListByRoleId(Long roleId) { public List<Long> selectMenuListByRoleId(Long roleId) { SysRole role = roleMapper.selectRoleById(roleId); return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); } @@ -161,11 +147,9 @@ * @return 路由列表 */ @Override public List<RouterVo> buildMenus(List<SysMenu> menus) { public List<RouterVo> buildMenus(List<SysMenu> menus) { List<RouterVo> routers = new LinkedList<RouterVo>(); for (SysMenu menu : menus) { for (SysMenu menu : menus) { RouterVo router = new RouterVo(); router.setHidden("1".equals(menu.getVisible())); router.setName(getRouteName(menu)); @@ -174,14 +158,11 @@ router.setQuery(menu.getQuery()); router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); List<SysMenu> cMenus = menu.getChildren(); if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { router.setAlwaysShow(true); router.setRedirect("noRedirect"); router.setChildren(buildMenus(cMenus)); } else if (isMenuFrame(menu)) { } else if (isMenuFrame(menu)) { router.setMeta(null); List<RouterVo> childrenList = new ArrayList<RouterVo>(); RouterVo children = new RouterVo(); @@ -192,9 +173,7 @@ children.setQuery(menu.getQuery()); childrenList.add(children); router.setChildren(childrenList); } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); router.setPath("/"); List<RouterVo> childrenList = new ArrayList<RouterVo>(); @@ -219,22 +198,18 @@ * @return 树结构列表 */ @Override public List<SysMenu> buildMenuTree(List<SysMenu> menus) { public List<SysMenu> buildMenuTree(List<SysMenu> menus) { List<SysMenu> returnList = new ArrayList<SysMenu>(); List<Long> tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext();) { for (Iterator<SysMenu> iterator = menus.iterator(); iterator.hasNext(); ) { SysMenu menu = (SysMenu) iterator.next(); // 如果是顶级节点, 遍历该父节点的所有子节点 if (!tempList.contains(menu.getParentId())) { if (!tempList.contains(menu.getParentId())) { recursionFn(menus, menu); returnList.add(menu); } } if (returnList.isEmpty()) { if (returnList.isEmpty()) { returnList = menus; } return returnList; @@ -247,8 +222,7 @@ * @return 下拉树结构列表 */ @Override public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus) { public List<TreeSelect> buildMenuTreeSelect(List<SysMenu> menus) { List<SysMenu> menuTrees = buildMenuTree(menus); return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); } @@ -260,8 +234,7 @@ * @return 菜单信息 */ @Override public SysMenu selectMenuById(Long menuId) { public SysMenu selectMenuById(Long menuId) { return menuMapper.selectMenuById(menuId); } @@ -272,8 +245,7 @@ * @return 结果 */ @Override public boolean hasChildByMenuId(Long menuId) { public boolean hasChildByMenuId(Long menuId) { int result = menuMapper.hasChildByMenuId(menuId); return result > 0; } @@ -285,8 +257,7 @@ * @return 结果 */ @Override public boolean checkMenuExistRole(Long menuId) { public boolean checkMenuExistRole(Long menuId) { int result = roleMenuMapper.checkMenuExistRole(menuId); return result > 0; } @@ -298,8 +269,7 @@ * @return 结果 */ @Override public int insertMenu(SysMenu menu) { public int insertMenu(SysMenu menu) { return menuMapper.insertMenu(menu); } @@ -310,8 +280,7 @@ * @return 结果 */ @Override public int updateMenu(SysMenu menu) { public int updateMenu(SysMenu menu) { return menuMapper.updateMenu(menu); } @@ -322,8 +291,7 @@ * @return 结果 */ @Override public int deleteMenuById(Long menuId) { public int deleteMenuById(Long menuId) { return menuMapper.deleteMenuById(menuId); } @@ -334,12 +302,10 @@ * @return 结果 */ @Override public boolean checkMenuNameUnique(SysMenu menu) { public boolean checkMenuNameUnique(SysMenu menu) { Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -388,12 +354,10 @@ * @param menu 菜单信息 * @return 路由名称 */ public String getRouteName(SysMenu menu) { public String getRouteName(SysMenu menu) { String routerName = StringUtils.capitalize(menu.getPath()); // 非外链并且是一级目录(类型为目录) if (isMenuFrame(menu)) { if (isMenuFrame(menu)) { routerName = StringUtils.EMPTY; } return routerName; @@ -405,23 +369,19 @@ * @param menu 菜单信息 * @return 路由地址 */ public String getRouterPath(SysMenu menu) { public String getRouterPath(SysMenu menu) { String routerPath = menu.getPath(); // 内链打开外网方式 if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { routerPath = innerLinkReplaceEach(routerPath); } // 非外链并且是一级目录(类型为目录) if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) && UserConstants.NO_FRAME.equals(menu.getIsFrame())) { && UserConstants.NO_FRAME.equals(menu.getIsFrame())) { routerPath = "/" + menu.getPath(); } // 非外链并且是一级目录(类型为菜单) else if (isMenuFrame(menu)) { else if (isMenuFrame(menu)) { routerPath = "/"; } return routerPath; @@ -433,19 +393,13 @@ * @param menu 菜单信息 * @return 组件信息 */ public String getComponent(SysMenu menu) { public String getComponent(SysMenu menu) { String component = UserConstants.LAYOUT; if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { component = menu.getComponent(); } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { component = UserConstants.INNER_LINK; } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { component = UserConstants.PARENT_VIEW; } return component; @@ -457,8 +411,7 @@ * @param menu 菜单信息 * @return 结果 */ public boolean isMenuFrame(SysMenu menu) { public boolean isMenuFrame(SysMenu menu) { return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) && menu.getIsFrame().equals(UserConstants.NO_FRAME); } @@ -469,8 +422,7 @@ * @param menu 菜单信息 * @return 结果 */ public boolean isInnerLink(SysMenu menu) { public boolean isInnerLink(SysMenu menu) { return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); } @@ -480,8 +432,7 @@ * @param menu 菜单信息 * @return 结果 */ public boolean isParentView(SysMenu menu) { public boolean isParentView(SysMenu menu) { return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); } @@ -492,15 +443,12 @@ * @param parentId 传入的父节点ID * @return String */ public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) { public List<SysMenu> getChildPerms(List<SysMenu> list, int parentId) { List<SysMenu> returnList = new ArrayList<SysMenu>(); for (Iterator<SysMenu> iterator = list.iterator(); iterator.hasNext();) { for (Iterator<SysMenu> iterator = list.iterator(); iterator.hasNext(); ) { SysMenu t = (SysMenu) iterator.next(); // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 if (t.getParentId() == parentId) { if (t.getParentId() == parentId) { recursionFn(list, t); returnList.add(t); } @@ -514,15 +462,12 @@ * @param list * @param t */ private void recursionFn(List<SysMenu> list, SysMenu t) { private void recursionFn(List<SysMenu> list, SysMenu t) { // 得到子节点列表 List<SysMenu> childList = getChildList(list, t); t.setChildren(childList); for (SysMenu tChild : childList) { if (hasChild(list, tChild)) { for (SysMenu tChild : childList) { if (hasChild(list, tChild)) { recursionFn(list, tChild); } } @@ -531,15 +476,12 @@ /** * 得到子节点列表 */ private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { private List<SysMenu> getChildList(List<SysMenu> list, SysMenu t) { List<SysMenu> tlist = new ArrayList<SysMenu>(); Iterator<SysMenu> it = list.iterator(); while (it.hasNext()) { while (it.hasNext()) { SysMenu n = (SysMenu) it.next(); if (n.getParentId().longValue() == t.getMenuId().longValue()) { if (n.getParentId().longValue() == t.getMenuId().longValue()) { tlist.add(n); } } @@ -549,8 +491,7 @@ /** * 判断是否有子节点 */ private boolean hasChild(List<SysMenu> list, SysMenu t) { private boolean hasChild(List<SysMenu> list, SysMenu t) { return getChildList(list, t).size() > 0; } @@ -559,8 +500,7 @@ * * @return */ public String innerLinkReplaceEach(String path) { public String innerLinkReplaceEach(String path) { return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." }, new String[] { "", "", "", "/" }); } ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPermissionServiceImpl.java
@@ -1,16 +1,16 @@ package com.ruoyi.system.service.impl; import java.util.HashSet; import java.util.List; import java.util.Set; import com.ruoyi.system.service.ISysRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.api.domain.SysRole; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysPermissionService; import com.ruoyi.system.service.ISysRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.List; import java.util.Set; /** * 用户权限处理 @@ -18,8 +18,7 @@ * @author ruoyi */ @Service public class SysPermissionServiceImpl implements ISysPermissionService { public class SysPermissionServiceImpl implements ISysPermissionService { @Autowired private ISysRoleService roleService; @@ -33,16 +32,12 @@ * @return 角色权限信息 */ @Override public Set<String> getRolePermission(SysUser user) { public Set<String> getRolePermission(SysUser user) { Set<String> roles = new HashSet<String>(); // 管理员拥有所有权限 if (user.isAdmin()) { if (user.isAdmin()) { roles.add("admin"); } else { } else { roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); } return roles; @@ -55,29 +50,21 @@ * @return 菜单权限信息 */ @Override public Set<String> getMenuPermission(SysUser user) { public Set<String> getMenuPermission(SysUser user) { Set<String> perms = new HashSet<String>(); // 管理员拥有所有权限 if (user.isAdmin()) { if (user.isAdmin()) { perms.add("*:*:*"); } else { } else { List<SysRole> roles = user.getRoles(); if (!roles.isEmpty() && roles.size() > 1) { if (!roles.isEmpty() && roles.size() > 1) { // 多角色设置permissions属性,以便数据权限匹配权限 for (SysRole role : roles) { for (SysRole role : roles) { Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); role.setPermissions(rolePerms); perms.addAll(rolePerms); } } else { } else { perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); } } ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/config/DataUpdateHandlerConfig.java
@@ -3,7 +3,6 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.system.api.model.LoginUser; import com.ruoyi.system.api.model.LoginUserParent; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.reflection.MetaObject; import org.springframework.beans.factory.annotation.Autowired; @@ -66,7 +65,12 @@ public void updateFill(MetaObject metaObject) { // 获取登录信息 LoginUser loginUser = tokenService.getLoginUser(); String userName = loginUser.getUsername(); String userName; if (null == loginUser) { userName = tokenService.getLoginUserStudy().getName(); } else { userName = loginUser.getUsername(); } if (StringUtils.hasLength(userName)) { this.setFieldValByName("createBy", userName, metaObject); this.setFieldValByName("createTime", new Date(), metaObject); ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java
@@ -1,7 +1,6 @@ package com.ruoyi.goods.controller; import com.alibaba.fastjson2.util.UUIDUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.page.PageInfo; @@ -9,8 +8,6 @@ import com.ruoyi.goods.domain.*; import com.ruoyi.goods.dto.*; import com.ruoyi.goods.service.*; import com.ruoyi.goods.utils.MyQrCodeUtil; import com.ruoyi.goods.utils.QRCodeUtil; import com.ruoyi.goods.vo.GoodDetailVO; import com.ruoyi.goods.vo.TGoodsVO; import com.ruoyi.goods.vo.TOrderVO; @@ -19,15 +16,12 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.logging.log4j.core.util.UuidUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.awt.image.BufferedImage; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; @@ -95,6 +89,7 @@ wrapper.eq("isDelete", 0); return R.ok(goodsService.page(new PageInfo<>(goodQuery.getPageNumber(), goodQuery.getPageSize()), wrapper)); } @PostMapping("/goodListStudy") @ApiOperation(value = "商品列表查询", tags = {"学习端"}) public R<PageInfo<TGoods>> goodListStudy(@RequestBody GoodQueryDTO goodQuery) { @@ -209,6 +204,7 @@ return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, tokenService.getLoginUserStudy().getUserid()) .orderByDesc(TOrder::getCreateTime).list()); } @GetMapping("/exchangeRecordParent") @ApiOperation(value = "家长端-兑换记录", tags = {"家长端-兑换记录"}) public R<List<TOrder>> exchangeRecordParent() { @@ -235,6 +231,7 @@ byId.setState(3); return R.ok(orderService.updateById(byId)); } /** * 兑换记录 */ @@ -264,6 +261,7 @@ return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId, tokenService.getLoginUser1().getUserid()).list()); } /** * 设置默认地址 */ @@ -281,6 +279,7 @@ recipientService.updateById(byId); return R.ok(); } /** * 设置默认地址 */ @@ -301,6 +300,7 @@ /** * 根据地址id 获取详情 * * @param id * @return */ @@ -316,8 +316,10 @@ Recipient byId = recipientService.getById(id); return R.ok(byId); } /** * 根据地址id 获取详情 * * @param id * @return */ @@ -333,6 +335,7 @@ Recipient byId = recipientService.getById(id); return R.ok(byId); } /** * 获取用户收货地址 */ @@ -352,10 +355,9 @@ @PostMapping("/addressSaveOrUpdate") @ApiOperation(value = "学习端-新增收货地址/修改收货地址", tags = {"学习端-新增收货地址/修改收货地址"}) public R<String> addressSave(@RequestBody Recipient recipient) { recipient.setUserId(tokenService.getLoginUserStudy().getUserid()); recipientService.addressSaveOrUpdate(recipient); return R.ok(); return R.ok(recipientService.addressSaveOrUpdate(recipient)); } /** * 新增收货地址/修改收货地址 */ @@ -382,6 +384,7 @@ public R<String> addressDelete(@RequestParam String id) { return R.ok(recipientService.removeById(id) ? "删除成功!" : "删除失败!"); } /** * 删除收货地址 */ @@ -406,6 +409,7 @@ return R.ok(userId); } @GetMapping("/getOrderAddress") @ApiOperation(value = "获取修改订单收货地址", tags = {"学习端-获取修改订单收货地址"}) public R<List<Recipient>> getOrderAddress() { @@ -416,6 +420,7 @@ .eq("userId", tokenService.getLoginUserStudy().getUserid())); return R.ok(userId); } @GetMapping("/updateOrderAddressParent") @ApiOperation(value = "修改订单收货地址", tags = {"家长端-修改订单收货地址"}) @ApiImplicitParams({ @@ -434,6 +439,7 @@ orderService.updateById(byId); return R.ok("修改成功"); } @GetMapping("/updateOrderAddress") @ApiOperation(value = "修改订单收货地址", tags = {"学习端-修改订单收货地址"}) public R updateOrderAddress(@RequestParam Integer orderId,@RequestParam Integer recipientId) { @@ -469,6 +475,15 @@ } /** * 获取所有商品分类 */ @GetMapping("/goodTypeStudy") @ApiOperation(value = "学习端-商品分类列表", tags = {"学习端-商品分类列表"}) public R<List<TGoodsType>> goodTypeStudy() { return R.ok(goodsTypeService.lambdaQuery().eq(TGoodsType::getIsDelete, 0).eq(TGoodsType::getIsDelete, 0).list()); } /** * 商品详情 * * @param goodId 商品id @@ -487,6 +502,7 @@ int number = goods.getBasicCount() + orderService.getGoodBuyNumber(goods.getId()); return R.ok(new GoodDetailVO(goods, goodsTypes, number)); } /** * 商品详情 * @@ -541,6 +557,7 @@ goodDetailVO.setOrderNumber(orderNumber); return R.ok(goodDetailVO); } /** * 商城-立即兑换 */ @@ -585,6 +602,7 @@ Recipient recipient = recipientService.getById(goodExchange.getRecipientId()); return goodsService.goodExchange1(goodExchange, recipient); } @PostMapping("/goodExchangeStudy") @ApiOperation(value = "学习端-商品兑换确认", tags = {"学习端-商品兑换确认"}) public R goodExchangeStudy(@RequestBody GoodExchangeDTO goodExchange) { @@ -595,6 +613,7 @@ @Autowired private StudyClient studyClient; @PostMapping("/getOrderInfo/{id}") @ApiOperation(value = "查看详情", tags = {"后台-订单管理"}) public R<TOrderVO> getOrderInfo(@PathVariable("id")Integer id) { @@ -608,6 +627,7 @@ tGoodsVO.setPhone(byId1.getPhone()); return R.ok(tGoodsVO); } @PostMapping("/confirm1") @ApiOperation(value = "确认发货", tags = {"后台-订单管理"}) public R getGoodsInfo1(@RequestBody OrderDTO dto) { @@ -619,6 +639,7 @@ orderService.updateById(byId); return R.ok("修改成功"); } @PostMapping("/listAll1") @ApiOperation(value = "列表查询", tags = {"后台-订单管理"}) public R<PageInfo<TOrderVO>> listAll1(@RequestBody OrderQuery query) throws ParseException { ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/RecipientServiceImpl.java
@@ -30,7 +30,7 @@ public String addressSaveOrUpdate(Recipient recipient) { boolean result; // 主键ID为空,新增收货地址 if (StringUtils.isEmpty(String.valueOf(recipient.getId()))) { if (null == recipient.getId()) { recipient.setUserId(tokenService.getLoginUserStudy().getUserid()); result = this.save(recipient); } else { ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java
@@ -656,9 +656,6 @@ } /** * 可兑换商品推荐 */ @@ -667,6 +664,7 @@ public R<List<TGoodsVO>> studySchedule() { return R.ok(goodsClient.goodRecommend().getData()); } /** * 首次页面加载时调用,获取学习进度及学习时长等信息 * @@ -683,6 +681,7 @@ TUserStudy result = studyService.studySchedule(String.valueOf(tokenService.getLoginUserStudy().getUserid()), week, day); return R.ok(result); } /** * 查询周目列表 * @@ -699,6 +698,7 @@ List<StudyWeekDTO> result = studyService.weekList(type, quarter); return R.ok(result); } /** * 进入题组后,获取题组学习进度信息 * @@ -881,9 +881,9 @@ LambdaQueryChainWrapper<TStudyPair> wrapper = studyPairService.lambdaQuery().eq(TStudyPair::getWeek, week) .eq(TStudyPair::getDay, day).eq(TStudyPair::getDisabled, 0); // 非会员只能查看非会员题目,会员可以查看所有题目 if (!isVip) { wrapper.eq(TStudyPair::getIsVip, 0); } // if (!isVip) { // wrapper.eq(TStudyPair::getIsVip, 0); // } TStudyPair pair = wrapper.one(); if (pair.getIsVip() == 1){ // 需要会员查看 @@ -1071,8 +1071,13 @@ TStoryListen listen = storyListenService.lambdaQuery().eq(TStoryListen::getWeek, week).one(); // 获取对应图片语音 List<String> list = Arrays.asList(listen.getLookStory().split(",")); return R.ok(new StudyStoryListenResultVO(listen, subjectService.lambdaQuery().in(TSubject::getId, list).eq(TSubject::getState, 1).list())); List<TSubject> subjectList; if (!list.isEmpty()) { subjectList = subjectService.lambdaQuery().in(TSubject::getId, list).eq(TSubject::getState, 1).list(); } else { subjectList = new ArrayList<>(); } return R.ok(new StudyStoryListenResultVO(listen, subjectList)); } /** @@ -1090,8 +1095,13 @@ TStoryListen listen = storyListenService.lambdaQuery().eq(TStoryListen::getWeek, week).one(); // 获取对应图片语音 List<String> list = Arrays.asList(listen.getStory().split(",")); return R.ok(new StudyStoryListenResultVO(listen, subjectService.lambdaQuery().in(TSubject::getId, list).eq(TSubject::getState, 1).list())); List<TSubject> subjectList; if (!list.isEmpty()) { subjectList = subjectService.lambdaQuery().in(TSubject::getId, list).eq(TSubject::getState, 1).list(); } else { subjectList = new ArrayList<>(); } return R.ok(new StudyStoryListenResultVO(listen,subjectList)); } /** @@ -1140,6 +1150,7 @@ .eq(TGameRecord::getDisabled, 0).list(); return R.ok(new StudyRecordResultVO(studyRecord, gameRecordList)); } @GetMapping("/record") @ApiOperation(value = "游戏测试成绩", tags = {"家长端-游戏测试成绩"}) public R<StudyRecordResultVO> record() { @@ -1166,12 +1177,14 @@ .eq(TGameRecord::getDisabled, 0).list(); return R.ok(new StudyRecordResultVO(studyRecord, gameRecordList)); } @GetMapping("/getIntegral") @ApiOperation(value = "获取剩余积分", tags = {"家长端-获取剩余积分"}) public R<Integer> getIntegral() { Integer userId = tokenService.getLoginUser1().getUserid(); return R.ok(userService.getById(userId).getIntegral()); } @GetMapping("/getIntegralStudy") @ApiOperation(value = "获取剩余积分", tags = {"学习端-获取剩余积分"}) public R<Integer> getIntegralStudy() { @@ -1194,6 +1207,7 @@ } return R.ok(integralRecordService.integralDetail(new Page<>(pageNum, pageSize), tokenService.getLoginUserStudy().getUserid(), time)); } @GetMapping("/integralDetailParent") @ApiOperation(value = "个人中心-积分明细", tags = {"家长端"}) @ApiImplicitParams({ @@ -1238,6 +1252,7 @@ integralRecord.setUpdateTime(new Date()); return R.ok(integralRecordService.save(integralRecord)); } @GetMapping("/addIntegralDetail1") // @ApiOperation(value = "添加-积分明细", tags = {"添加-积分明细"}) @ApiImplicitParams({ @@ -1280,6 +1295,7 @@ } return R.ok(userService.updateById(user)); } @GetMapping("/exchangeIntegral1") // @ApiOperation(value = "用户积分变动", tags = {"用户积分变动"}) public R<Boolean> exchangeIntegral1(@RequestParam("integral") Integer integral, @RequestParam("method") String method) { ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TUserController.java
@@ -29,7 +29,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -325,6 +324,7 @@ } return R.ok(); } @PostMapping("/getUserInfoParent") @ApiOperation(value = "获取用户信息", tags = {"家长端-获取用户信息"}) public R<TUser> getUserInfo() { @@ -343,6 +343,7 @@ return R.tokenError("登录失效"); } } @PostMapping("/parentPage") @ApiOperation(value = "平板", tags = {"启动页"}) public R<String> parentPage() { @@ -496,6 +497,7 @@ /** * 学生端退出登录 * * @param request 请求信息 */ @PostMapping("/logoutStudy") @@ -599,6 +601,7 @@ } return R.ok(data); } /** * 获取用户信息 *