huliguo
2025-05-06 05ea2cf040cfc966c96998cea8570f8f90d3c7ad
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -7,16 +7,19 @@
import com.ruoyi.account.api.model.*;
import com.ruoyi.account.mapper.UserPointMapper;
import com.ruoyi.account.service.*;
import com.ruoyi.account.vo.UserPointDetailVO;
import com.ruoyi.account.vo.UserPointStatistics;
import com.ruoyi.account.vo.UserPointVO;
import com.ruoyi.account.vo.*;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.PhoneNumberValidator;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.enums.PointChangeType;
import com.ruoyi.system.api.domain.SysConfig;
import com.ruoyi.system.api.feignClient.SysConfigClient;
import com.ruoyi.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -42,9 +45,10 @@
    private TokenService tokenService;
    @Resource
    private UserPointService userPointService;
    @Resource
    private SysConfigClient sysConfigClient;
    @Autowired
    private UserPointMapper userPointMapper;
    @Override
@@ -58,6 +62,16 @@
        userPointVO.setExpendPoint(appUser.getExchangePoint());
        userPointVO.setTransferableInPoint(appUser.getTransferableInPoint());
        userPointVO.setTransferableOutPoint(appUser.getTransferableOutPoint());
        R<SysConfig> info = sysConfigClient.getInfo(9L);
        if (info == null || info.getData() == null) {
            throw new RuntimeException("获取积分兑换比例配置失败");
        }
        String configValue = info.getData().getConfigValue();
        if (StringUtils.isBlank(configValue)) {
            throw new RuntimeException("积分兑换比例配置值为空");
        }
        Boolean isTransferable = Boolean.valueOf(configValue.trim());
        userPointVO.setIsTransferable(isTransferable);
        return userPointVO;
    }
@@ -248,4 +262,28 @@
        });
        return userPointIPage;
    }
    @Override
    public PageInfo<UserPointDetailVO> getUserPontDetailPageList(Collection<Integer> types, Long id, Integer pageCurr, Integer pageSize) {
        PageInfo<UserPointDetailVO> pageInfo = new PageInfo<>(pageCurr, pageSize);
        List<UserPointDetailVO> list =baseMapper.getUserPontDetailPageList(pageInfo,id,types);
        pageInfo.setRecords(list);
        return pageInfo;
    }
    @Override
    public Integer selectRechargeAndUse(String name, String phone, LocalDateTime beginTime, LocalDateTime endTime,Integer type) {
        return  baseMapper.selectRechargeAndUse(name,phone,beginTime,endTime,type);
    }
    @Override
    public PageInfo<UserPointStatisticsPageVO> getUserPointStatisticsPageList(Collection<Integer> types, String name, String phone, LocalDateTime beginTime, LocalDateTime endTime, Integer pageCurr, Integer pageSize) {
        PageInfo<UserPointStatisticsPageVO> pageInfo = new PageInfo<>(pageCurr, pageSize);
        List<UserPointStatisticsPageVO>list=baseMapper.getUserPointStatisticsPageList(pageInfo,types,name,phone,beginTime,endTime);
        pageInfo.setRecords(list);
        return pageInfo;
    }
}