Skip to content

Commit

Permalink
Merge pull request #10 from maiguoma/main
Browse files Browse the repository at this point in the history
fix: fix email utis and delete target file
  • Loading branch information
imneov authored Sep 26, 2022
2 parents 98cc334 + 2974bb7 commit 49710ab
Show file tree
Hide file tree
Showing 23 changed files with 14 additions and 1,278 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

/target/
/*/target/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN cd $WORK_PATH && mvn clean package -U -DskipTests


### 第二阶段,用第一阶段的jar和jre镜像合成一个小体积的镜像
FROM java:8-jre-alpine
FROM openjdk:8-jre-alpine

#定义工程名称,也是源文件的文件夹名称
ENV PROJECT_NAME iot-alarm
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/alarm/tkeel/controller/MailController.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class MailController {
@Autowired
private RuleMapper ruleMapper;

@Autowired
private EmailSendUtils emailSendUtils;



@PostMapping("/alarm/mailConfig")
@ApiOperation(value = "邮箱配置",notes = "邮箱配置",produces = "application/json")
Expand Down Expand Up @@ -178,7 +182,7 @@ public ResultData testSendEmail(@RequestBody Email email){
if(email == null){
return ResultData.fail("io.tkeel.INTERNAL_ERROR","无效参数!");
}
EmailSendUtils emailSendUtils =new EmailSendUtils();
// EmailSendUtils emailSendUtils =new EmailSendUtils();
int code = emailSendUtils.sendWithText(email);
if(code > 0){
return ResultData.success(code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class MailServiceImpl implements MailService {
@Autowired
private RuleServiceImpl ruleService;

@Autowired
private JavaMailSender javaMailSender;


@Override
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/com/alarm/tkeel/utils/EmailSendUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.mail.internet.MimeMessage;
Expand All @@ -16,12 +17,8 @@
* @Description 开心工作,快乐生活
* @Date 2022/07/08/14:09
*/
@Service
@Component
public class EmailSendUtils {
// 邮件发送类
@Autowired
private JavaMailSender mailSender;
// 简单邮件信息类


/**
Expand All @@ -30,7 +27,7 @@ public class EmailSendUtils {
*/
public int sendWithText(Email email) {
try {
mailSender = new JavaMailSenderImpl();
JavaMailSender mailSender = new JavaMailSenderImpl();
String host = email.getSmtpAddress();
String userName = email.getSmtpUserName();
String password =email.getSmtpPassWord();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spring:
url: jdbc:mysql://tkeel-middleware-mysql:3306/tkeel-alarm?useUnicode=true&characterEncoding=utf8
username: root
password: a3fks=ixmeb82a
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spring:
url: jdbc:mysql://192.168.100.5:32249/tkeel-alarm?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
username: root
password: a3fks=ixmeb82a
driver-class-name: com.mysql.jdbc.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
Expand Down
57 changes: 0 additions & 57 deletions target/classes/application-test.yml

This file was deleted.

63 changes: 0 additions & 63 deletions target/classes/application.yml

This file was deleted.

117 changes: 0 additions & 117 deletions target/classes/log4j2-spring.xml

This file was deleted.

Loading

0 comments on commit 49710ab

Please sign in to comment.