ny
23 小时以前 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
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.AccountConfigEntity;
import jnpf.message.mapper.AccountConfigMapper;
import jnpf.message.model.accountconfig.AccountConfigForm;
import jnpf.message.model.accountconfig.AccountConfigPagination;
import jnpf.message.service.AccountConfigService;
import jnpf.util.StringUtil;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * 账号配置功能
 * 版本: V3.2.0
 * 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
 * 作者: JNPF开发平台组
 * 日期: 2022-08-18
 */
@Service
public class AccountConfigServiceImpl extends SuperServiceImpl<AccountConfigMapper, AccountConfigEntity> implements AccountConfigService {
 
    @Override
    public List<AccountConfigEntity> getList(AccountConfigPagination accountConfigPagination) {
        return this.getBaseMapper().getList(accountConfigPagination);
    }
 
    @Override
    public List<AccountConfigEntity> getTypeList(AccountConfigPagination accountConfigPagination, String dataType) {
        return this.getBaseMapper().getTypeList(accountConfigPagination, dataType);
    }
 
 
    @Override
    public AccountConfigEntity getInfo(String id) {
        return this.getBaseMapper().getInfo(id);
    }
 
    @Override
    public void create(AccountConfigEntity entity) {
        this.save(entity);
    }
 
    @Override
    public boolean update(String id, AccountConfigEntity entity) {
        entity.setId(id);
        return this.updateById(entity);
    }
 
    @Override
    public void delete(AccountConfigEntity entity) {
        if (entity != null) {
            this.removeById(entity.getId());
        }
    }
 
    @Override
    public boolean checkForm(AccountConfigForm form, int i, String type, String id) {
        int total = 0;
        if (ObjectUtil.isNotEmpty(form.getEnCode())) {
            QueryWrapper<AccountConfigEntity> codeWrapper = new QueryWrapper<>();
            codeWrapper.lambda().eq(AccountConfigEntity::getEnCode, form.getEnCode());
            codeWrapper.lambda().eq(AccountConfigEntity::getType, type);
            if (StringUtil.isNotBlank(id) && !"null".equals(id)) {
                codeWrapper.lambda().ne(AccountConfigEntity::getId, id);
            }
            total += (int) this.count(codeWrapper);
        }
        int c = 0;
        if (total > i + c) {
            return true;
        }
        return false;
    }
 
    @Override
    public boolean checkGzhId(String gzhId, int i, String type, String id) {
        int total = 0;
        if (StringUtil.isNotEmpty(gzhId) && !"null".equals(gzhId)) {
            QueryWrapper<AccountConfigEntity> codeWrapper = new QueryWrapper<>();
            codeWrapper.lambda().eq(AccountConfigEntity::getAppId, gzhId);
            codeWrapper.lambda().eq(AccountConfigEntity::getType, type);
            if (StringUtil.isNotBlank(id) && !"null".equals(id)) {
                codeWrapper.lambda().ne(AccountConfigEntity::getId, id);
            }
            total += (int) this.count(codeWrapper);
        }
        int c = 0;
        if (total > i + c) {
            return true;
        }
        return false;
    }
 
    @Override
    public AccountConfigEntity getInfoByType(String appKey, String type) {
        return this.getBaseMapper().getInfoByType(appKey, type);
    }
 
    @Override
    public AccountConfigEntity getInfoByEnCode(String enCode, String type) {
        return this.getBaseMapper().getInfoByEnCode(enCode, type);
    }
 
    @Override
    public List<AccountConfigEntity> getListByType(String type) {
        return this.getBaseMapper().getListByType(type);
    }
 
    @Override
    public boolean isExistByFullName(String fullName, String id) {
        return this.getBaseMapper().isExistByFullName(fullName, id);
    }
 
    @Override
    public boolean isExistByEnCode(String enCode, String id, String type) {
        return this.getBaseMapper().isExistByEnCode(enCode, id, type);
    }
 
    @Override
    public ActionResult ImportData(AccountConfigEntity entity) throws DataException {
        if (entity != null) {
            if (isExistByEnCode(entity.getEnCode(), entity.getId(), entity.getType())) {
                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());
    }
}