保誠-保戶業務員媒合平台
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
package com.pollex.pam.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
 
import com.pollex.pam.domain.Appointment;
import com.pollex.pam.service.dto.AppointmentNoticeSendDTO;
 
@Service
@Transactional
public class NoticeService {
    
    @Autowired
    AppointmentService appointmentService;
    
    @Autowired
    SendMsgService sendMsgService;
    
    @Autowired
    AppointmentNoticeLogService appointmentNoticeLogService;
 
    public void sendNotice(AppointmentNoticeSendDTO dto) {
        String subject = "保誠媒合平台系統通知:預約通知";
 
//        Appointment appointment = appointmentService.findById(dto.getAppointmentId());
        if(StringUtils.hasText(dto.getEmail())) {
            sendMsgService.sendMsgByEmail(dto.getEmail(), subject, dto.getMessage(), true);
        }if(StringUtils.hasText(dto.getPhone())) {
            sendMsgService.sendMsgBySMS(dto.getPhone(), dto.getMessage());
        }
        
        appointmentNoticeLogService.create(dto);
    }
 
}