Pu Zhibing
2025-03-18 eb428cb6839049970e67264f4eafc612e5bcaa38
修改统计bug
10个文件已修改
114 ■■■■ 已修改文件
ruoyi-service/ruoyi-account/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopBalanceStatementMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/pom.xml
@@ -132,12 +132,6 @@
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>3.8.0</version>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-modules-other</artifactId>
            <version>3.6.2</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -1233,7 +1233,7 @@
                        .eq(BalanceChangeRecord::getVipId, i);
                if(sysUser.getRoleType() == 2){
                    Integer objectId = sysUser.getObjectId();
                    List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getShopId, objectId).eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1));
                    List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getShopId, objectId).eq(AppUser::getDelFlag, 0).ne(AppUser::getStatus, 1));
                    List<Long> appUserIds = list.stream().map(AppUser::getId).collect(Collectors.toList());
                    Set<Long> data = orderClient.getAppUserByShoppingShop(objectId).getData();
                    if(null != data){
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.account.vo.UserPointDetailVO;
import com.ruoyi.account.vo.UserPointStatistics;
import com.ruoyi.account.vo.UserPointVO;
import com.ruoyi.account.vo.UserStatisticsDetail;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.PhoneNumberValidator;
import com.ruoyi.common.core.web.page.PageInfo;
@@ -23,6 +24,7 @@
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.enums.PointChangeType;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -33,9 +35,7 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@@ -227,7 +227,7 @@
        int pullNewPoint = userBalanceMap.getOrDefault(PointChangeType.PULL_NEW.getCode(), 0);
        int registerPoint = userBalanceMap.getOrDefault(PointChangeType.REGISTER.getCode(), 0);
        // 做工积分:签到积分 + 每日分享积分 + 每日签到积分 + 每日使用时长积分
        // 做工积分:每日分享积分 + 每日签到积分 + 每日使用时长积分
        int share = userBalanceMap.getOrDefault(PointChangeType.SHARE.getCode(), 0);
        int signIn = userBalanceMap.getOrDefault(PointChangeType.SIGN_IN.getCode(), 0);
        int useTime = userBalanceMap.getOrDefault(PointChangeType.USE_TIME.getCode(), 0);
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/UserStatisticsDetail.java
@@ -4,6 +4,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel("用户统计详情")
public class UserStatisticsDetail {
@@ -54,17 +56,17 @@
     * 用户获得分佣总金额
     */
    @ApiModelProperty("用户获得分佣总金额")
    private Integer totalRebate;
    private BigDecimal totalRebate;
    /**
     * 充值金额
     */
    @ApiModelProperty("充值金额")
    private Integer totalRecharge;
    private BigDecimal totalRecharge;
    /**
     * 已提现金额
     */
    @ApiModelProperty("已提现金额")
    private Integer totalWithdraw;
    private BigDecimal totalWithdraw;
}
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -53,15 +53,13 @@
        SELECT *
        FROM t_app_user ta
        <where>
            ta.del_flag = 0
            ta.del_flag = 0 and ta.status != 3
            <if test="appUser.excludeStatus != null">
                and ta.status != #{appUser.excludeStatus}
            </if>
            <if test="appUser.name != null and appUser.name != ''">
                and ta.`name` like CONCAT('%',#{appUser.name},'%')
            </if>
            <if test="null != appUser.phone and '' != appUser.phone">
                and ta.phone like CONCAT('%',#{appUser.phone},'%')
            </if>
@@ -161,19 +159,16 @@
        FROM
            t_app_user tau
        <where>
            tau.del_flag = 0 and tau.status != 3
            <if test="null != shopId">
                tau.shop_id = #{shopId}
            </if>
            <if test="null != shopId and null != userId and userId.size() > 0">
                or
                and tau.shop_id = #{shopId}
            </if>
            <if test="null != userId and userId.size() > 0">
                tau.id in
                and tau.id in
                <foreach collection="userId" item="item" index="index" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        and tau.del_flag = 0
        </where>
    </select>
    <select id="getAppUserByPhoneNoFilter" resultType="com.ruoyi.account.api.model.AppUser">
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -337,7 +337,7 @@
                balanceChangeRecordCopy.setChangeType(4);
                balanceChangeRecordCopy.setBeforeAmount(balance);
                balanceChangeRecordCopy.setChangeAmount(zdls_price);
                balanceChangeRecordCopy.setAfterAmount(superiorLeader.getBalance());
                balanceChangeRecordCopy.setAfterAmount(superiorLeader.getBalance().add(zdls_price));
                balanceChangeRecordCopy.setDelFlag(0);
                balanceChangeRecordCopy.setCreateTime(LocalDateTime.now());
                balanceChangeRecordClient.saveBalanceChangeRecordCopy(balanceChangeRecordCopy);
@@ -348,7 +348,7 @@
                userPointCopy.setType(2);
                userPointCopy.setHistoricalPoint(lavePoint);
                userPointCopy.setVariablePoint(zdls_point);
                userPointCopy.setBalance(superiorLeader.getLavePoint());
                userPointCopy.setBalance(superiorLeader.getLavePoint() + zdls_point);
                userPointCopy.setCreateTime(LocalDateTime.now());
                userPointCopy.setAppUserId(superiorLeader.getId());
                userPointCopy.setObjectId(order.getId());
@@ -442,7 +442,7 @@
                    shopBalanceStatementCopy.setType(1);
                    shopBalanceStatementCopy.setHistoricalBalance(shopBalance);
                    shopBalanceStatementCopy.setVariableAmount(fws_price);
                    shopBalanceStatementCopy.setBalance(shop1.getBalance());
                    shopBalanceStatementCopy.setBalance(shop1.getBalance().add(fws_price));
                    shopBalanceStatementCopy.setCreateTime(LocalDateTime.now());
                    shopBalanceStatementCopy.setCreateUserId(order.getAppUserId());
                    shopBalanceStatementCopy.setObjectId(order.getId());
@@ -455,7 +455,7 @@
                    userPointCopy.setType(9);
                    userPointCopy.setHistoricalPoint(lavePoint);
                    userPointCopy.setVariablePoint(fws_point);
                    userPointCopy.setBalance(bdShopAppUser.getLavePoint());
                    userPointCopy.setBalance(bdShopAppUser.getLavePoint() + fws_point);
                    userPointCopy.setCreateTime(LocalDateTime.now());
                    userPointCopy.setAppUserId(bdShopAppUser.getId());
                    userPointCopy.setObjectId(order.getId());
@@ -471,7 +471,7 @@
                    shopPointCopy.setType(2);
                    shopPointCopy.setHistoricalPoint(shopLavePoint);
                    shopPointCopy.setVariablePoint(fws_point);
                    shopPointCopy.setBalance(shop1.getLavePoint());
                    shopPointCopy.setBalance(shop1.getLavePoint() + fws_point);
                    shopPointCopy.setCreateTime(LocalDateTime.now());
                    shopPointCopy.setCreateUserId(order.getAppUserId());
                    shopPointCopy.setObjectId(order.getId());
@@ -568,7 +568,7 @@
                    shopBalanceStatementCopy.setType(2);
                    shopBalanceStatementCopy.setHistoricalBalance(shopBalance);
                    shopBalanceStatementCopy.setVariableAmount(gjfws_price);
                    shopBalanceStatementCopy.setBalance(shop2.getBalance());
                    shopBalanceStatementCopy.setBalance(shop2.getBalance().add(gjfws_price));
                    shopBalanceStatementCopy.setCreateTime(LocalDateTime.now());
                    shopBalanceStatementCopy.setCreateUserId(order.getAppUserId());
                    shopBalanceStatementCopy.setObjectId(order.getId());
@@ -581,7 +581,7 @@
                    userPointCopy.setType(14);
                    userPointCopy.setHistoricalPoint(lavePoint);
                    userPointCopy.setVariablePoint(gjfws_point);
                    userPointCopy.setBalance(sjShopAppUser.getLavePoint());
                    userPointCopy.setBalance(sjShopAppUser.getLavePoint() + gjfws_point);
                    userPointCopy.setCreateTime(LocalDateTime.now());
                    userPointCopy.setAppUserId(sjShopAppUser.getId());
                    userPointCopy.setObjectId(order.getId());
@@ -597,7 +597,7 @@
                    shopPointCopy.setType(3);
                    shopPointCopy.setHistoricalPoint(shopLavePoint);
                    shopPointCopy.setVariablePoint(gjfws_point);
                    shopPointCopy.setBalance(shop2.getLavePoint());
                    shopPointCopy.setBalance(shop2.getLavePoint() + gjfws_point);
                    shopPointCopy.setCreateTime(LocalDateTime.now());
                    shopPointCopy.setCreateUserId(order.getAppUserId());
                    shopPointCopy.setObjectId(order.getId());
@@ -725,7 +725,7 @@
                shopBalanceStatementCopy.setType(3);
                shopBalanceStatementCopy.setHistoricalBalance(shopBalance);
                shopBalanceStatementCopy.setVariableAmount(hxmd_price);
                shopBalanceStatementCopy.setBalance(shop.getBalance());
                shopBalanceStatementCopy.setBalance(shop.getBalance().add(hxmd_price));
                shopBalanceStatementCopy.setCreateTime(LocalDateTime.now());
                shopBalanceStatementCopy.setCreateUserId(order.getAppUserId());
                shopBalanceStatementCopy.setObjectId(order.getId());
@@ -738,7 +738,7 @@
                userPointCopy.setType(8);
                userPointCopy.setHistoricalPoint(lavePoint);
                userPointCopy.setVariablePoint(hxmd_point);
                userPointCopy.setBalance(shopAppUser.getLavePoint());
                userPointCopy.setBalance(shopAppUser.getLavePoint() + hxmd_point);
                userPointCopy.setCreateTime(LocalDateTime.now());
                userPointCopy.setAppUserId(shopAppUser.getId());
                userPointCopy.setObjectId(order.getId());
@@ -754,7 +754,7 @@
                shopPointCopy.setType(1);
                shopPointCopy.setHistoricalPoint(shopLavePoint);
                shopPointCopy.setVariablePoint(hxmd_point);
                shopPointCopy.setBalance(shop.getLavePoint());
                shopPointCopy.setBalance(shop.getLavePoint() + hxmd_point);
                shopPointCopy.setCreateTime(LocalDateTime.now());
                shopPointCopy.setCreateUserId(order.getAppUserId());
                shopPointCopy.setObjectId(order.getId());
@@ -811,7 +811,7 @@
                        userPointCopy.setType(10);
                        userPointCopy.setHistoricalPoint(lavePoint);
                        userPointCopy.setVariablePoint(js_point);
                        userPointCopy.setBalance(technicianAppUser.getLavePoint());
                        userPointCopy.setBalance(technicianAppUser.getLavePoint() + js_point);
                        userPointCopy.setCreateTime(LocalDateTime.now());
                        userPointCopy.setAppUserId(technicianAppUser.getId());
                        userPointCopy.setObjectId(order.getId());
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -328,24 +328,26 @@
                        .eq(PointSetting::getId, appUser.getVipId()).eq(PointSetting::getDelFlag, 0));
                if(null != pointSetting){
                    Integer everySharePoint = pointSetting.getEverySharePoint();
                    Integer lavePoint = appUser.getLavePoint();
                    appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint);
                    appUser.setLavePoint(appUser.getLavePoint() + everySharePoint);
                    appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint);
                    appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint);
                    appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + everySharePoint);
                    appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint);
                    appUserClient.editAppUserById(appUser);
                    //添加积分流水
                    UserPoint userPoint = new UserPoint();
                    userPoint.setAppUserId(userid);
                    userPoint.setType(4);
                    userPoint.setHistoricalPoint(lavePoint);
                    userPoint.setVariablePoint(everySharePoint);
                    userPoint.setBalance(appUser.getLavePoint());
                    userPoint.setCreateTime(LocalDateTime.now());
                    userPoint.setAppUserId(appUser.getId());
                    userPointClient.saveUserPoint(userPoint);
                    if(everySharePoint > 0){
                        Integer lavePoint = appUser.getLavePoint();
                        appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint);
                        appUser.setLavePoint(appUser.getLavePoint() + everySharePoint);
                        appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint);
                        appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint);
                        appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + everySharePoint);
                        appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint);
                        appUserClient.editAppUserById(appUser);
                        //添加积分流水
                        UserPoint userPoint = new UserPoint();
                        userPoint.setAppUserId(userid);
                        userPoint.setType(4);
                        userPoint.setHistoricalPoint(lavePoint);
                        userPoint.setVariablePoint(everySharePoint);
                        userPoint.setBalance(appUser.getLavePoint());
                        userPoint.setCreateTime(LocalDateTime.now());
                        userPoint.setAppUserId(appUser.getId());
                        userPointClient.saveUserPoint(userPoint);
                    }
                }
            }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -259,6 +259,13 @@
                .between(ShopBalanceStatement::getCreateTime, date.with(LocalTime.MIN), date.with(LocalTime.MAX));
        if (null != shopId && 0 != shopId) {
            queryWrapper.eq(ShopBalanceStatement::getShopId, shopId);
        }else{
            List<Integer> shipIds = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0)).stream().map(Shop::getId).collect(Collectors.toList());
            if(shipIds.size() > 0){
                queryWrapper.in(ShopBalanceStatement::getShopId, shipIds);
            }else{
                queryWrapper.eq(ShopBalanceStatement::getShopId, -1);
            }
        }
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(queryWrapper);
        return R.ok(list);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -702,9 +702,7 @@
    @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"})
    public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) {
        ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId);
        List<Integer> shopIds;
        shopIds = shopService.list(new LambdaQueryWrapper<Shop>()
        List<Integer> shopIds = shopService.list(new LambdaQueryWrapper<Shop>()
                        .eq(Shop::getDelFlag, 0)
                        .eq(shopId !=null,Shop::getId, shopId))
                .stream()
@@ -898,7 +896,7 @@
        BigDecimal giveawayMoney = BigDecimal.ZERO;
        for (Shop shop : shopList) {
            serverGiveawayMoney = serverGiveawayMoney.add(shop.getServerGiveawayMoney());
            giveawayMoney = giveawayMoney.add(shop.getGiveawayMoney());
            giveawayMoney = giveawayMoney.add(shop.getGiveawayMoney().add(shop.getLowerLevelGiveawayMoney()));
        }
        Map<String, BigDecimal> map = new HashMap<>();
        map.put("serverGiveawayMoney", serverGiveawayMoney);
ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopBalanceStatementMapper.xml
@@ -12,7 +12,7 @@
        t_shop_balance_statement tsbs
        INNER JOIN t_shop ts ON ts.id = tsbs.shop_id
        <where>
            tsbs.type != 4
            tsbs.type != 4 and ts.del_flag = 0
            <if test="bs.shopName != null and bs.shopName != ''">
                AND ts.`name` like concat('%', #{bs.shopName}, '%')
            </if>