| | |
| | | |
| | | @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); |
| | |
| | | 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()); |
| | | |
| | |
| | | Set<Long> replaceable = redisTemplate.opsForZSet().rangeByScore("replaceable", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | if(replaceable.size() > 0){ |
| | | List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0) |
| | | .eq(AppUser::getStatus, 1).in(AppUser::getId, unbind_promoter)); |
| | | .eq(AppUser::getStatus, 1).in(AppUser::getId, replaceable)); |
| | | for (AppUser appUser : list) { |
| | | appUser.setChangePromoter(1); |
| | | this.updateById(appUser); |
| | |
| | | public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){ |
| | | List<Order> list = orderService.lambdaQuery() |
| | | .eq(Order::getAppUserId, appUserId) |
| | | .eq(Order::getShopId, shopId) |
| | | .eq(null != shopId && -1 != shopId, Order::getShopId, shopId) |
| | | .eq(Order::getDistributionMode, 1) |
| | | .ne(Order::getOrderStatus,5).list(); |
| | | .eq(Order::getPayStatus, 2) |
| | | .isNull(Order::getRefundStatus) |
| | | .eq(Order::getDelFlag, 0) |
| | | .notIn(Order::getOrderStatus, 5, 6).list(); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/byShopId") |
| | |
| | | List<Order> list = orderService.lambdaQuery().isNotNull(Order::getEndTime) |
| | | .eq(null != shopId && -1 != shopId, Order::getShopId, shopId) |
| | | .eq(Order::getAppUserId, appUserId) |
| | | .in(Order::getOrderStatus, 4, 7, 8).list(); |
| | | .eq(Order::getPayStatus, 2) |
| | | .isNull(Order::getRefundStatus) |
| | | .eq(Order::getDelFlag, 0) |
| | | .notIn(Order::getOrderStatus, 5, 6).list(); |
| | | return R.ok(list); |
| | | } |
| | | |