ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -1,5 +1,6 @@ package com.ruoyi.account.controller; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -24,6 +25,7 @@ import com.ruoyi.other.api.feignClient.VipSettingClient; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -73,12 +75,35 @@ @ApiOperation(value = "会员申请详情", tags = {"会员中心-小程序"}) public R<AgentApplication> detail(@RequestParam Long id) { AgentApplication agentApplication = agentApplicationService.getById(id); AppUser appUser = appUserService.getById(agentApplication.getAppUserId()); agentApplication.setShopPoint(appUser.getShopPoint()); agentApplication.setSharePoint(appUser.getSharePoint()); R<VipSetting> vipSetting = vipSettingClient.getVipSetting(agentApplication.getApplicationVipId()); VipSettingDto vipSettingDto = new VipSettingDto(); BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); agentApplication.setVipSettingDto(vipSettingDto); // List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() // .ne(AppUser::getStatus, 3) // .eq(AppUser::getDelFlag, 0)); // ArrayList<Long> userIds = new ArrayList<>(); // userIds.add(appUser.getId()); // getUserAncestorList(appUser,userIds,new ArrayList<>(),appUserList); return R.ok(agentApplication); } public void getUserAncestorList(AppUser user,List<Long> userIds, List<AppUser> children,List<AppUser> list) { children = list.stream().filter(u -> userIds.contains(u.getInviteUserId()) || userIds.contains(u.getTopInviteId())).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(children)){ user.setCount1((user.getCount1() == null ? 0L : user.getCount1()) + children.stream().filter(e->e.getVipId() == 1).count()); user.setCount2((user.getCount2() == null ? 0L : user.getCount2()) + children.stream().filter(e->e.getVipId() == 2).count()); user.setCount3((user.getCount3() == null ? 0L : user.getCount3()) + children.stream().filter(e->e.getVipId() == 3).count()); user.setCount4((user.getCount4() == null ? 0L : user.getCount4()) + children.stream().filter(e->e.getVipId() == 4).count()); user.setCount5((user.getCount5() == null ? 0L : user.getCount5()) + children.stream().filter(e->e.getVipId() == 5).count()); user.setCount6((user.getCount6() == null ? 0L : user.getCount6()) + children.stream().filter(e->e.getVipId() == 6).count()); user.setCount7((user.getCount7() == null ? 0L : user.getCount7()) + children.stream().filter(e->e.getVipId() == 7).count()); List<Long> userIdList = children.stream().map(AppUser::getId).collect(Collectors.toList()); getUserAncestorList(user,userIdList, children,list); } } @Resource private UserChangeLogService userChangeLogService; ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -574,9 +574,17 @@ @GetMapping("/danger/down") @ApiOperation(value = "用户列表-保级条件降级", tags = {"管理后台"}) public R down(Long id) { AppUser byId = appUserService.getById(id); byId.setVipId(byId.getVipId() - 1); appUserService.updateById(byId); AppUser appUser = appUserService.getById(id); UserChangeLog userChangeLog = new UserChangeLog(); userChangeLog.setDelFlag(0); userChangeLog.setCreateTime(LocalDateTime.now()); userChangeLog.setAppUserId(id); userChangeLog.setBeforeVipId(appUser.getVipId()); userChangeLog.setAfterVipId(appUser.getVipId() - 1); userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); appUser.setVipId(appUser.getVipId() - 1); appUserService.updateById(appUser); return R.ok(); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -18,6 +18,8 @@ import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.order.feignClient.OrderClient; import com.ruoyi.order.model.Order; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -130,6 +132,8 @@ IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint); return R.ok(userPointPage); } @Resource private OrderClient orderClient; @GetMapping("/user/list") @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台") @@ -140,6 +144,12 @@ .orderByDesc(UserPoint::getCreateTime) .page(Page.of(userPoint.getPageNum(), userPoint.getPageSize())); for (UserPoint record : page.getRecords()) { if (record.getType()==1 || record.getType()==11){ Order data = orderClient.getOrderById(record.getObjectId()).getData(); if (data!=null){ record.setExtention(data.getOrderNumber()); } } int i = record.getHistoricalPoint() - record.getBalance(); if (i>0){ record.setVariableType(2); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -103,6 +103,8 @@ return walletStatistics; } Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream() .collect(Collectors.groupingBy( WalletStatisticsDetail::getChangeType, @@ -118,7 +120,12 @@ BigDecimal totalShopWithdraw = shopCommissionMap.get(7); List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex); for (WalletStatisticsDetail changeRecord : walletStatisticsDetailList2) { if (changeRecord.getChangeType().equals(1)||changeRecord.getChangeType().equals(3)||changeRecord.getChangeType().equals(4)||changeRecord.getChangeType().equals(6)){ changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount()); } else{ changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount()); } walletStatisticsDetailPage.setCurrent(current); walletStatisticsDetailPage.setSize(size); walletStatisticsDetailPage.setTotal(walletStatisticsDetailList.size()); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletStatisticsDetail.java
@@ -43,6 +43,11 @@ * 变更数量 */ @ApiModelProperty(value = "变更数量") @Excel(name = "变更数量") private BigDecimal changeAmount; /** * 变更数量 */ @ApiModelProperty(value = "变更数量--带金额符号") @Excel(name = "变更数量") private String changeAmountString; } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -69,6 +69,17 @@ ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement); return R.ok(shopCommissionStatisticsVO); } /** * 导出门店分佣统计 */ @GetMapping("/export") @ApiOperation("导出门店分佣统计") public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); } @GetMapping("/commissionStatistics/list") @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"}) public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, @@ -171,17 +182,7 @@ } /** * 导出门店分佣统计 */ @GetMapping("/export") @ApiOperation("导出门店分佣统计") public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.ShopPoint; @@ -53,21 +54,41 @@ Integer sPoint = 0; Integer shopCommissionPoint = 0; Integer subShopCommissionPoint = 0; Integer serverCommissionPoint = 0; if (sysUser.getRoleType()==1){ List<Shop> shopIds = shopService.lambdaQuery().eq(Shop::getDelFlag, 0).list(); for (Shop shop : shopIds) { sPoint += shop.getServerPoint(); shopCommissionPoint += shop.getSharePoint(); subShopCommissionPoint += shop.getLowerLevelSharePoint(); if (StringUtils.isNotEmpty(shopPoint.getShopName())){ } if (StringUtils.isNotEmpty(shopPoint.getShopLeaderName())){ } ShopPointStatistics shopPointStatistics = new ShopPointStatistics(); shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint); shopPointStatistics.setShopPoint(sPoint); shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); shopPointStatistics.setShopPointIPage(shopPointIPage); for (ShopPoint record : shopPointIPage.getRecords()) { switch (record.getType()){ case 1: sPoint += record.getVariablePoint(); break; case 2: shopCommissionPoint += record.getVariablePoint(); break; case 3: subShopCommissionPoint += record.getVariablePoint(); break; case 4: serverCommissionPoint+= record.getVariablePoint(); break; } } shopPointStatistics.setTotalPoint(sPoint + shopCommissionPoint + subShopCommissionPoint+serverCommissionPoint); shopPointStatistics.setShopPoint(sPoint); shopPointStatistics.setShopCommissionPoint(shopCommissionPoint); shopPointStatistics.setSubShopCommissionPoint(subShopCommissionPoint); LocalDateTime startTime = shopPoint.getStartTime(); LocalDateTime endTime = shopPoint.getEndTime(); if(null != startTime){