| | |
| | | SpringTemplateEngine springTemplateEngine; |
| | | |
| | | public SendSMSResponse sendMsgBySMS(String toMobile, String content) throws SendSMSFailException { |
| | | SMS smsProperties = applicationProperties.getSms(); |
| | | if(!applicationProperties.isSendNotifyMsg()) { |
| | | // return getMockSMSResponse(); |
| | | return null; |
| | | } |
| | | |
| | | SMS smsProperties = applicationProperties.getSms(); |
| | | |
| | | SendSMSRequest sendSMSRequest = new SendSMSRequest(); |
| | | sendSMSRequest.setpKey(UUID.randomUUID().toString()); |
| | |
| | | } |
| | | } |
| | | |
| | | public String sendMsgByEmail(String from, String to, String subject, String content, boolean htmlFormat) throws SendEmailFailException{ |
| | | return sendMsgByEmail(from, to, subject, content, htmlFormat, Collections.emptyList(), Collections.emptyList()); |
| | | // private SendSMSResponse getMockSMSResponse() { |
| | | // SendSMSResponse mock = new SendSMSResponse(); |
| | | // mock.set |
| | | // return null; |
| | | // } |
| | | |
| | | public String sendMsgByEmail(String to, String subject, String content, boolean htmlFormat) throws SendEmailFailException{ |
| | | return sendMsgByEmail(to, subject, content, htmlFormat, Collections.emptyList(), Collections.emptyList()); |
| | | } |
| | | |
| | | public String sendMsgByEmail( |
| | | String fromAddress, String toAddress, String subject, String content, boolean htmlFormat, List<String> toCCAddress, |
| | | List<String> attachments) throws SendEmailFailException |
| | | { |
| | | public String sendMsgByEmail(String toAddress, String subject, String content, boolean htmlFormat, List<String> toCCAddress, |
| | | List<String> attachments) throws SendEmailFailException { |
| | | String fromAddress = applicationProperties.getEmail().getSenderEmail(); |
| | | |
| | | SendMailRequest sendMailRequest = new SendMailRequest(); |
| | | sendMailRequest.setSendMailAddresses(Collections.singletonList(toAddress)); |
| | | sendMailRequest.setFrom(fromAddress); |
| | |
| | | } |
| | | |
| | | public String sendMsgByEmail(SendMailRequest sendMailRequest) throws SendEmailFailException{ |
| | | try { |
| | | if(!applicationProperties.isSendNotifyMsg()) { |
| | | return null; |
| | | } |
| | | try { |
| | | ResponseEntity<String> responseEntity = |
| | | HttpRequestUtil.postWithJson( applicationProperties.getEmail().getUrl(), sendMailRequest, String.class); |
| | | log.debug("responseEntity = {}", responseEntity); |