ny
昨天 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package jnpf.message.service.impl;
 
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.base.ActionResult;
import jnpf.base.service.SuperServiceImpl;
import jnpf.constant.MsgCode;
import jnpf.exception.DataException;
import jnpf.message.entity.SendConfigTemplateEntity;
import jnpf.message.entity.SendMessageConfigEntity;
import jnpf.message.mapper.SendConfigTemplateMapper;
import jnpf.message.mapper.SendMessageConfigMapper;
import jnpf.message.model.sendmessageconfig.SendMessageConfigForm;
import jnpf.message.model.sendmessageconfig.SendMessageConfigPagination;
import jnpf.message.service.SendMessageConfigService;
import jnpf.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * 消息发送配置
 * 版本: V3.2.0
 * 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
 * 作者: JNPF开发平台组
 * 日期: 2022-08-19
 */
@Service
public class SendMessageConfigServiceImpl extends SuperServiceImpl<SendMessageConfigMapper, SendMessageConfigEntity> implements SendMessageConfigService {
 
 
    @Autowired
    private SendConfigTemplateMapper sendConfigTemplateMapper;
 
    @Override
    public List<SendMessageConfigEntity> getList(SendMessageConfigPagination sendMessageConfigPagination, String dataType) {
        return this.baseMapper.getList(sendMessageConfigPagination, dataType);
    }
 
    @Override
    public List<SendMessageConfigEntity> getSelectorList(SendMessageConfigPagination sendMessageConfigPagination) {
        return this.baseMapper.getSelectorList(sendMessageConfigPagination);
    }
 
 
    @Override
    public SendMessageConfigEntity getInfo(String id) {
        return this.baseMapper.getInfo(id);
    }
 
    @Override
    public SendMessageConfigEntity getInfoByEnCode(String enCode) {
        return this.baseMapper.getInfoByEnCode(enCode);
    }
 
    @Override
    public void create(SendMessageConfigEntity entity) {
        this.save(entity);
    }
 
    @Override
    public boolean update(String id, SendMessageConfigEntity entity) {
        entity.setId(id);
        return this.updateById(entity);
    }
 
    @Override
    public void delete(SendMessageConfigEntity entity) {
        if (entity != null) {
            this.removeById(entity.getId());
        }
    }
 
    @Override
    public List<SendConfigTemplateEntity> getSendConfigTemplateList(String id) {
        QueryWrapper<SendConfigTemplateEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(SendConfigTemplateEntity::getSendConfigId, id);
        queryWrapper.lambda().orderByDesc(SendConfigTemplateEntity::getSortCode);
        return sendConfigTemplateMapper.selectList(queryWrapper);
    }
 
    //列表子表数据方法
 
 
    //验证表单唯一字段
    @Override
    public boolean checkForm(SendMessageConfigForm form, int i, String id) {
        int total = 0;
        if (ObjectUtil.isNotEmpty(form.getEnCode())) {
            QueryWrapper<SendMessageConfigEntity> enCodeWrapper = new QueryWrapper<>();
            enCodeWrapper.lambda().eq(SendMessageConfigEntity::getEnCode, form.getEnCode());
            if (StringUtil.isNotBlank(id) && !"null".equals(id)) {
                enCodeWrapper.lambda().ne(SendMessageConfigEntity::getId, id);
            }
            if ((int) this.count(enCodeWrapper) > i) {
                total++;
            }
        }
        if (form.getSendConfigTemplateList() != null) {
        }
        if (total > 0) {
            return true;
        }
        return false;
    }
 
    @Override
    public boolean isExistByFullName(String fullName, String id) {
        return this.baseMapper.isExistByFullName(fullName, id);
    }
 
    @Override
    public boolean isExistByEnCode(String enCode, String id) {
        return this.baseMapper.isExistByEnCode(enCode, id);
    }
 
    @Override
    public ActionResult ImportData(SendMessageConfigEntity entity) throws DataException {
        if (entity != null) {
            if (isExistByEnCode(entity.getEnCode(), entity.getId())) {
                return ActionResult.fail(MsgCode.EXIST002.get());
            }
            try {
                this.save(entity);
            } catch (Exception e) {
                throw new DataException(MsgCode.IMP003.get());
            }
            return ActionResult.success(MsgCode.IMP001.get());
        }
        return ActionResult.fail(MsgCode.IMP006.get());
    }
 
    @Override
    public List<SendMessageConfigEntity> getList(List<String> idList) {
        return this.baseMapper.getList(idList);
    }
 
 
    public List<String> getIdList(String usedId) {
        return this.baseMapper.getIdList(usedId);
    }
 
    @Override
    public boolean idUsed(String id) {
        return this.baseMapper.idUsed(id);
    }
 
}