From d6e819838bba8477029f53c68570402bf449ab8f Mon Sep 17 00:00:00 2001 From: phpcjl <phpcjl@gmail.com> Date: 星期三, 18 十二月 2024 14:01:45 +0800 Subject: [PATCH] 1 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java | 3 +++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java | 23 +++-------------------- ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml | 23 +++++++++++++++++++++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java | 9 +++------ 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java index e157ab1..35ee127 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java @@ -9,4 +9,7 @@ public interface BalanceChangeRecordMapper extends BaseMapper<BalanceChangeRecord> { IPage<BalanceChangeRecord> pageList(@Param("page") Page<BalanceChangeRecord> page,@Param("agentQuery") BalanceQuery agentQuery); + + IPage<BalanceChangeRecord> queryCommissionStatistics(@Param("page") Page<BalanceChangeRecord> page, + @Param("changeRecord") BalanceChangeRecord changeRecord); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java index 828b2a5..0cffbae 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java @@ -38,25 +38,8 @@ @Override public CommissionStatistics commissionStatistics(Page<BalanceChangeRecord> page, BalanceChangeRecord balanceChangeRecord) { - - List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() - .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserName()), AppUser::getName, balanceChangeRecord.getUserName()) - .like(StringUtils.isNotEmpty(balanceChangeRecord.getUserPhone()), AppUser::getPhone, balanceChangeRecord.getUserPhone())); - if (CollectionUtils.isEmpty(appUserList)){ - return new CommissionStatistics(); - } - - List<Long> appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); - - BigDecimal totalCommission = appUserList.stream() - .map(AppUser::getTotalDistributionAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - - Page<BalanceChangeRecord> changeRecordPage = page(page, new LambdaQueryWrapper<BalanceChangeRecord>() - .in(BalanceChangeRecord::getAppUserId, appUserIds) - .between(balanceChangeRecord.getStartTime() != null && balanceChangeRecord.getEndTime() != null, - BalanceChangeRecord::getCreateTime, balanceChangeRecord.getStartTime(), balanceChangeRecord.getEndTime())); - return new CommissionStatistics(totalCommission, changeRecordPage); + IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); +// return new CommissionStatistics(totalCommission, changeRecordPage); + return null; } } diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml index bdeadcf..71ed297 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml @@ -21,4 +21,27 @@ </if> </where> </select> + <select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> + SELECT + tcr.*, + tau.`name` userName, + tau.phone userPhone + FROM + t_balance_change_record tcr + LEFT JOIN t_app_user tau ON tcr.app_user_id = tau.id + <where> + <if test="changeRecord.userName != null and changeRecord.userName != ''"> + and tau.name like concat('%',#{changeRecord.userName},'%') + </if> + <if test="changeRecord.userPhone != null and changeRecord.userPhone != ''"> + and tau.phone like concat('%',#{changeRecord.userPhone},'%') + </if> + <if test="changeRecord.changeType != null"> + and tcr.change_type = #{changeRecord.changeType} + </if> + <if test="changeRecord.startTime != null and changeRecord.endTime != null"> + and DATE(tcr.create_time) between #{changeRecord.startTime} and #{changeRecord.endTime} + </if> + </where> + </select> </mapper> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java index 4bdf64d..0b9afb2 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java @@ -14,10 +14,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.time.LocalDateTime; @@ -60,9 +57,9 @@ /** * 审核 */ - @RequestMapping("/audit") + @PostMapping("/audit") @ApiOperation("审核") - public R<Void> audit(ShopWithdraw shopWithdraw) { + public R<Void> audit(@RequestBody ShopWithdraw shopWithdraw) { LoginUser loginUser = tokenService.getLoginUser(); ShopWithdraw shopWithdraw1 = shopWithdrawService.getById(shopWithdraw.getId()); shopWithdraw1.setAuditStatus(shopWithdraw.getAuditStatus()); -- Gitblit v1.7.1