| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | private UserCancellationLogService userCancellationLogService; |
| | | @Resource |
| | | private BalanceChangeRecordService balanceChangeRecordService; |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | public AppUser getAppUserById(@RequestParam("id") Long id) { |
| | | return appUserService.getById(id); |
| | | } |
| | | |
| | | @PostMapping("/getBaseUserById") |
| | | public R<Map<String, Object>> getBaseUserById(@RequestParam("id") Long id) { |
| | | AppUser appUser = appUserService.getById(id); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", appUser.getId()); |
| | | map.put("name", appUser.getName()); |
| | | map.put("phone", appUser.getPhone()); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/editAppUserById") |
| | |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "用户列表-详情", tags = {"管理后台"}) |
| | | public R<AppUser> detail(Long id,Integer shopId) { |
| | | public R<AppUser> detail(Long id, Integer shopId) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | AppUser byId = appUserService.getById(id); |
| | |
| | | List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); |
| | | byId.setBottomUsers(list); |
| | | //消费总金额 |
| | | if(null == shopId){ |
| | | if(null == shopId || 1 == sysUser.getRoleType()){ |
| | | shopId = -1; |
| | | } |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byShopIdAndUserId(id, shopId); |
| | | if(null == shopId && 2 == sysUser.getRoleType()){ |
| | | shopId = sysUser.getObjectId(); |
| | | } |
| | | R<List<Order>> orderR = remoteOrderGoodsClient.byUserId(id, shopId); |
| | | List<Order> orderList = orderR.getData(); |
| | | if (!CollectionUtils.isEmpty(orderList)){ |
| | | BigDecimal paymentAmount = orderList.stream().map(Order::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @Resource |
| | | private UserChangeLogService userChangeLogService; |
| | | |
| | | |
| | | @GetMapping("/change/vip") |
| | | @ApiOperation(value = "用户列表-修改会员等级", tags = {"管理后台"}) |
| | |
| | | public R<List<Order>> orders(Long id) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | Integer shopId = sysUser.getObjectId(); |
| | | Integer shopId = -1; |
| | | if(sysUser.getRoleType() == 2){ |
| | | shopId = sysUser.getObjectId(); |
| | | } |
| | | R<List<Order>> listR = remoteOrderGoodsClient.byUserId(id,shopId); |
| | | return R.ok(listR.getData()); |
| | | |