From 2086924387d271cf589fac4fb0dee8f29e89133f Mon Sep 17 00:00:00 2001 From: nyoung <12190070+nyoungo@user.noreply.gitee.com> Date: Wed, 18 Sep 2024 20:46:13 +0800 Subject: [PATCH] 1 --- dl-module-rescue/pom.xml | 8 +- .../controller/admin/SysLoginController.java | 81 +++++++++++++------ .../admin/user/vo/user/UserSaveReqVO.java | 2 + 3 files changed, 66 insertions(+), 25 deletions(-) diff --git a/dl-module-rescue/pom.xml b/dl-module-rescue/pom.xml index a49ff772..ded3b762 100644 --- a/dl-module-rescue/pom.xml +++ b/dl-module-rescue/pom.xml @@ -26,10 +26,16 @@ yudao-module-system-biz ${revision} + + cn.iocoder.boot + dl-module-inspection + 2.1.0-jdk8-snapshot + compile + 8 8 - \ No newline at end of file + diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java index 8d2286d1..6726c6ae 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/SysLoginController.java @@ -15,6 +15,11 @@ import cn.iocoder.yudao.module.rescue.domain.LoginBody; import cn.iocoder.yudao.module.rescue.domain.WxLoginBody; import cn.iocoder.yudao.module.rescue.service.IDriverInfoService; import cn.iocoder.yudao.module.rescue.utils.RescueSysLoginService; +import cn.iocoder.yudao.module.shop.entity.ShopConfig; +import cn.iocoder.yudao.module.shop.entity.UserBalance; +import cn.iocoder.yudao.module.shop.service.IShopConfigService; +import cn.iocoder.yudao.module.shop.service.IUserBalanceService; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; import cn.iocoder.yudao.util.WechatPayConfig; import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.permission.PermissionApi; @@ -98,14 +103,14 @@ public class SysLoginController { @Resource private SecurityProperties securityProperties; -// @Autowired -// private IUserBalanceService balanceService; + @Resource + private IUserBalanceService balanceService; // @Autowired // private IShopMallPartnersService partnersService; // @Autowired // private IPartnerWorkerService jcWorkerService; -// @Autowired -// private IShopConfigService configService; + @Resource + private IShopConfigService configService; @Resource private IDriverInfoService driverInfoService; // @Autowired @@ -333,33 +338,61 @@ public class SysLoginController { AdminUserDO user = userService.getUser(loginUser.getId()); List roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId()); List roleList = roleService.getRoleList(roleIdsByUserId); - // 角色集合 -// Set roles = roleList.stream().map(RoleDO::getCode).collect(Collectors.toSet()); -// UserBalance userBalance = balanceService.selectShopUserBalanceByUserId(NamedObject.user.getUserId()); -// if (ObjectUtil.isNotEmpty(userBalance)) { -// sysUser.setBalance(userBalance.getBalance()); -// } else { -// //新增用户积分表信息 -// userBalance=new UserBalance(); -// userBalance.setUserId(NamedObject.user.getUserId()); -// userBalance.setAllBalance(0L); -// userBalance.setBalance(0L); -// userBalance.setFrozenBalance(0L); -// balanceService.insertShopUserBalance(userBalance); -// sysUser.setBalance(0L); -// } Map ajax = new HashMap<>(); ajax.put("user", user); ajax.put("role", roleList); -// ShopConfig shopConfig = configService.selectShopConfigById(1L); -// if (StringUtils.isEmpty(shopConfig.getOpenRz())||shopConfig.getOpenRz().equals("0")){ -// ajax.put("openRz", "0"); -// }else { + ShopConfig shopConfig = configService.selectShopConfigById(1L); + if (StringUtils.isEmpty(shopConfig.getOpenRz())||shopConfig.getOpenRz().equals("0")){ ajax.put("openRz", "0"); -// } + }else { + ajax.put("openRz", "0"); + } return CommonResult.success(ajax); } + /** + * 获取App用户信息 + * + * @return 用户信息 + */ + @GetMapping("/getJcAppInfo") + @TenantIgnore + public CommonResult getJcAppInfo() + { + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + AdminUserDO user = userService.getUser(loginUser.getId()); + List roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId()); + List roleList = roleService.getRoleList(roleIdsByUserId); + // 角色集合 + UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); + UserBalance userBalance = balanceService.selectShopUserBalanceByUserId(loginUser.getId()); + if (ObjectUtil.isNotEmpty(userBalance)) { + userSaveReqVO.setBalance(userBalance.getBalance()); + } else { + //新增用户积分表信息 + userBalance=new UserBalance(); + userBalance.setUserId(loginUser.getId()); + userBalance.setAllBalance(0L); + userBalance.setBalance(0L); + userBalance.setFrozenBalance(0L); + balanceService.insertShopUserBalance(userBalance); + userSaveReqVO.setBalance(0L); + } + userService.updateUser(userSaveReqVO); + Map ajax = new HashMap<>(); + ajax.put("user", user); + ajax.put("role", roleList); + ShopConfig shopConfig = configService.selectShopConfigById(1L); + if (StringUtils.isEmpty(shopConfig.getOpenRz())||shopConfig.getOpenRz().equals("0")){ + ajax.put("openRz", "0"); + }else { + ajax.put("openRz", "0"); + } + return CommonResult.success(ajax); + } + + + /** * 获取App用户信息 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java index dc371a93..62044204 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java @@ -101,4 +101,6 @@ public class UserSaveReqVO { private Long tenantId; + private Long balance; + }