提交配置及邮件配置修改

This commit is contained in:
daihh
2022-11-07 18:31:38 +08:00
parent 9560eb787d
commit 06fccac0e2
6 changed files with 41 additions and 7 deletions

View File

@@ -8,8 +8,8 @@ import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xboe.core.SysConstant;
import com.xboe.core.utils.OkHttpUtil;
import com.xboe.module.assistance.service.IEmailService;
@@ -42,23 +42,31 @@ public class EmailServiceImpl implements IEmailService {
// $r = TNetworkHelper::HttpPost($url, $arr);
// var_dump($r);
// }
private static final String PostUrl="https://u-pre.boe.com/api/b1/email/send";
//private static final String PostUrl="https://u-pre.boe.com/api/b1/email/send";
@Override
public void sendMail(String to, String subject, String htmlMsg, String from) throws Exception {
String cfgUrl=SysConstant.getConfigValue("xboe.email.url");
if(StringUtils.isBlank(cfgUrl)) {
throw new Exception("发送邮件失败,未配置邮件信息");
}
String cfgFrom=SysConstant.getConfigValue("xboe.email.from","boeu_learning@boe.com.cn");
String cfgUser=SysConstant.getConfigValue("xboe.email.user");
String cfgWord=SysConstant.getConfigValue("xboe.email.password");
Map<String,Object> data=new HashMap<String,Object>();
data.put("to",to);
data.put("subject",subject);
data.put("content", htmlMsg);
data.put("fromName", "boeu_learning@boe.com.cn");
data.put("fromName", cfgFrom);
data.put("cc", "");
data.put("type", 0);
ObjectMapper mapper=new ObjectMapper();
String json=mapper.writeValueAsString(data);
String[] headers=new String[] {"Content-Type","application/json","Host","u.boe.com"};
String rs=httpUtil.doPostJson(PostUrl,json,headers);
String rs=httpUtil.doPostJson(cfgUrl,json,headers);
//System.out.println(mailInfo.toString());
//System.out.println(rs);
if(StringUtils.isNotBlank(rs)) {

View File

@@ -475,6 +475,8 @@ public class CourseManageApi extends ApiBaseController{
if(!isLocalDevelopment()) {
//只是非开发模式下才可以发送
service.sendMail(email,"课程审核提醒", htmlEmail,"数字化学习平台");
}else {
//service.sendMail("daihaixing@bjxask.com","课程审核提醒", htmlEmail,"数字化学习平台");
}
} catch (Exception ex) {

View File

@@ -9,7 +9,7 @@ spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.0.11:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=root
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
@@ -52,11 +52,17 @@ jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
# elasticsearch config
xboe.elasticsearch.server.ip=192.168.0.11
xboe.elasticsearch.server.ip=127.0.0.1
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=
xboe.elasticsearch.server.password=
# 默认搜索的索引
xboe.elasticsearch.index.name=new_resource_list
## 邮件的配置
xboe.email.url=https://u-pre.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.password=

View File

@@ -48,3 +48,9 @@ xboe.elasticsearch.server.ip=10.251.129.25
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=elastic
xboe.elasticsearch.server.password=Boe@es123
## 邮件的配置
xboe.email.url=https://u.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.password=

View File

@@ -85,3 +85,9 @@ xboe.elasticsearch.server.ip=127.0.0.1
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=elastic
xboe.elasticsearch.server.password=Boe@es123
## 邮件的配置
xboe.email.url=https://u.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.password=

View File

@@ -59,4 +59,10 @@ jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
xboe.elasticsearch.server.ip=10.251.129.25
xboe.elasticsearch.server.port=9200
xboe.elasticsearch.server.user=elastic
xboe.elasticsearch.server.password=Boe@es123
xboe.elasticsearch.server.password=Boe@es123
## 邮件的配置
xboe.email.url=https://u-pre.boe.com/api/b1/email/send
xboe.email.from=boeu_learning@boe.com.cn
xboe.email.user=
xboe.email.password=