huliguo
2025-06-04 7e9508a252df668c3f7472be02595c79b21be11a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.ruoyi.system.service.impl;
 
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.mapper.SystemConfigMapper;
import com.ruoyi.system.domain.SystemConfig;
import com.ruoyi.system.pojo.dto.AddSystemConfigDTO;
import com.ruoyi.system.pojo.model.DrawSheet;
import com.ruoyi.system.pojo.vo.SystemConfigVO;
import com.ruoyi.system.service.SystemConfigService;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements SystemConfigService {
    @Resource
    private SystemConfigMapper systemConfigMapper;
 
    /**
     * 查看系统设置  1=启动页,2=客服,3=抽单
     */
    @Override
    public SystemConfigVO getSystemConfigByType(Integer type) {
        SystemConfigVO vo = new SystemConfigVO();
        //根据类型查询
        SystemConfig systemConfig = systemConfigMapper.selectOne(new LambdaQueryWrapper<SystemConfig>().eq(SystemConfig::getType, type));
        vo.setType(type);
        if (type!=3){
            if (systemConfig!=null){
                vo.setUrl(systemConfig.getContent());
            }
            return vo;
        }else {
            //抽单
            DrawSheet drawSheet = JSON.parseObject(systemConfig.getContent(), DrawSheet.class);
            vo.setDrawSheet(drawSheet);
            return vo;
        }
    }
    /**
     * 设置系统设置  1=启动页,2=客服,3=抽单
     */
    @Override
    public void setSystemConfig(AddSystemConfigDTO dto) {
        SystemConfig systemConfig = new SystemConfig();
        systemConfig.setType(dto.getType());
        //根据类型删除
        systemConfigMapper.delete(new LambdaQueryWrapper<SystemConfig>().eq(SystemConfig::getType, dto.getType()));
        if (dto.getType()==3){
            //抽单设置
            DrawSheet drawSheet = new DrawSheet();
            drawSheet.setPlatform(dto.getPlatform());
            drawSheet.setUser(dto.getUser());
            String json = JSON.toJSONString(drawSheet);
            systemConfig.setContent(json);
        }else {
            systemConfig.setContent(dto.getUrl());
        }
        systemConfigMapper.insert(systemConfig);
    }
 
 
 
}