xiaoyong931011
2023-01-12 79461476f170523b9be727cf71a0261f4659d8a6
src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
@@ -12,13 +12,12 @@
import cc.mrbird.febs.mall.dto.ScoreSettingDto;
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.entity.MallMember;
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.mapper.MallAchieveRecordMapper;
import cc.mrbird.febs.mall.mapper.MallMemberMapper;
import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.vo.AdminSystemSettingVo;
import cc.mrbird.febs.monitor.service.ILoginLogService;
import cc.mrbird.febs.system.service.IUserService;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
@@ -28,6 +27,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import java.math.BigDecimal;
import java.util.*;
@@ -41,11 +41,21 @@
    private final MallMemberMapper mallMemberMapper;
    private final MallOrderInfoMapper mallOrderInfoMapper;
    private final MallAchieveRecordMapper mallAchieveRecordMapper;
    private final MallMemberWalletMapper mallMemberWalletMapper;
    private final RedisUtils redisUtils;
    @GetMapping("profitSetting")
    public String profitSetting() {
        return FebsUtil.view("modules/system/profitSetting");
    }
    /**
     * 会员等级设置
     * @return
     */
    @GetMapping("agentLevelSetting")
    public String agentLevelSetting() {
        return FebsUtil.view("modules/system/agentLevelSetting");
    }
    @GetMapping("cashOutSetting")
@@ -66,6 +76,56 @@
            model.addAttribute("scorePoor", JSONObject.parseObject(dic.getValue(), ScorePoorDto.class));
        }
        return FebsUtil.view("modules/system/scorePoorSetting");
    }
    @GetMapping("systemSetting")
    @RequiresPermissions("systemSetting:update")
    public String systemSetting(Model model) {
        AdminSystemSettingVo adminSystemSettingVo = new AdminSystemSettingVo();
        DataDictionaryCustom returnPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.RETURN_PERCENT.getType(),
                DataDictionaryEnum.RETURN_PERCENT.getCode());
        if (ObjectUtil.isNotEmpty(returnPercentDic)) {
            adminSystemSettingVo.setReturnPercent(returnPercentDic.getValue());
        }
        DataDictionaryCustom levelOneDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.LEVEL_ONE.getType(),
                DataDictionaryEnum.LEVEL_ONE.getCode());
        if (ObjectUtil.isNotEmpty(levelOneDic)) {
            adminSystemSettingVo.setLevelOne(levelOneDic.getValue());
        }
        DataDictionaryCustom levelTwoDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.LEVEL_TWO.getType(),
                DataDictionaryEnum.LEVEL_TWO.getCode());
        if (ObjectUtil.isNotEmpty(levelTwoDic)) {
            adminSystemSettingVo.setLevelTwo(levelTwoDic.getValue());
        }
        DataDictionaryCustom rewardPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.REWARD_PERCENT.getType(),
                DataDictionaryEnum.REWARD_PERCENT.getCode());
        if (ObjectUtil.isNotEmpty(rewardPercentDic)) {
            adminSystemSettingVo.setRewardPercent(rewardPercentDic.getValue());
        }
        DataDictionaryCustom buyTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.BUY_TIMES.getType(),
                DataDictionaryEnum.BUY_TIMES.getCode());
        if (ObjectUtil.isNotEmpty(buyTimesDic)) {
            adminSystemSettingVo.setBuyTimes(buyTimesDic.getValue());
        }
        DataDictionaryCustom subsidyPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.SUBSIDY_PERCENT.getType(),
                DataDictionaryEnum.SUBSIDY_PERCENT.getCode());
        if (ObjectUtil.isNotEmpty(subsidyPercentDic)) {
            adminSystemSettingVo.setSubsidyPercent(subsidyPercentDic.getValue());
        }
        DataDictionaryCustom allBuyTimesDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.ALL_BUY_TIMES.getType(),
                DataDictionaryEnum.ALL_BUY_TIMES.getCode());
        if (ObjectUtil.isNotEmpty(allBuyTimesDic)) {
            adminSystemSettingVo.setAllBuyTimes(allBuyTimesDic.getValue());
        }
        model.addAttribute("adminSystemSettingVo", adminSystemSettingVo);
        return FebsUtil.view("modules/system/systemSetting");
    }
    @GetMapping("indexData")
@@ -91,6 +151,11 @@
        data.put("lastMonth", mallAchieveRecordMapper.selectAchieveTotal("M", DateUtil.offsetMonth(new Date(), -1)));
        data.put("thisMonth", mallAchieveRecordMapper.selectAchieveTotal("M", new Date()));
        data.put("totalBalance",mallMemberWalletMapper.selectSumBalance().setScale(2, BigDecimal.ROUND_DOWN));
        data.put("totalScore",mallMemberWalletMapper.selectSumScore().setScale(2, BigDecimal.ROUND_DOWN));
        data.put("totalPrizeScore",mallMemberWalletMapper.selectSumPrizeScore().setScale(2, BigDecimal.ROUND_DOWN));
        data.put("totalCommission",mallMemberWalletMapper.selectSumCommission().setScale(2, BigDecimal.ROUND_DOWN));
        //会员数据
        data.put("totalMember",mallMemberMapper.selectCount(new QueryWrapper<>()) );
        QueryWrapper<MallMember> formalMember = new QueryWrapper<>();