许鹏程
2023-05-25 213cc37cbf0b2515a4de56cc1e01813211bad183
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
package com.product.admin.service;
 
import java.util.Date;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.alibaba.druid.util.StringUtils;
import com.product.core.dao.BaseDao;
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
import com.product.core.service.support.AbstractBaseService;
import com.product.core.spring.context.SpringMVCContextHolder;
 
/**
 * Copyright © 2020 LX-BASE
 * 
 * @Title: SystemEmailSmtpSerivce
 * @Project: lx-server-admin
 * @Date: 2020年9月9日
 * @Author: Mr.Zhengmeng
 * @Description:系统邮箱Serivc
 */
@Component
public class SystemEmailSmtpSerivce extends AbstractBaseService {
    @Autowired
    public BaseDao baseDao;
 
    public FieldSetEntity findEmailSmtp(FieldSetEntity fs) throws BaseException {
        //郑盟   2020年12月17日   下午14:05
        if (StringUtils.isEmpty(fs.getString("org_level_uuid"))) {
            return null;
        }
        return baseDao.getFieldSetEntityByFilter("product_sys_email_smtp", "org_level_uuid=?",
                new String[] { fs.getString("org_level_uuid") }, false);
    }
 
    public boolean setUpEmailSmtp(FieldSetEntity fs) throws BaseException {
        if (StringUtils.isEmpty(fs.getString("uuid"))) {
            fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());// 获取登录帐号
            fs.setValue("created_utc_datetime", new Date());// 创建时间
            String add = baseDao.add(fs);
            return null!=add;
        } else {
            fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id());// 获取登录帐号
            fs.setValue("updated_utc_datetime", new Date());
            return baseDao.update(fs);
        }
    }
}