修改发邮件功能 #155
+12
@@ -30,6 +30,18 @@ public class SendMailRecordController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 新增立案数据
|
||||||
|
// */
|
||||||
|
// @Log(title = "新增立案数据", businessType = BusinessType.INSERT)
|
||||||
|
// @PostMapping("/addSendMailRecord")
|
||||||
|
// public AjaxResult addSendMailRecord(@Validated @RequestBody SendMailRecord sendMailRecord)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// return toAjax(sendMailRecordService.addSendMailRecord(sendMailRecord));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ public class EmailOutUtil {
|
|||||||
*/
|
*/
|
||||||
public void sendEmil(String to, String message, String subject, List<File> fileList, File file) {
|
public void sendEmil(String to, String message, String subject, List<File> fileList, File file) {
|
||||||
try {
|
try {
|
||||||
|
String messageContent = "<html><body><p style=\"font-family: Arial, sans-serif; font-size: 18px;\">"+message+"。</p></body></html>";
|
||||||
|
MimeBodyPart messageBodyPart = new MimeBodyPart();
|
||||||
|
messageBodyPart.setContent(messageContent, "text/html;charset=utf-8");
|
||||||
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
|
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
|
||||||
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
|
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
|
||||||
//设置邮件会话参数
|
//设置邮件会话参数
|
||||||
@@ -125,13 +128,14 @@ public class EmailOutUtil {
|
|||||||
//设置邮件消息
|
//设置邮件消息
|
||||||
msg.setSubject(subject);
|
msg.setSubject(subject);
|
||||||
msg.setText(message);
|
msg.setText(message);
|
||||||
|
msg.setDescription("messageutf-8html");
|
||||||
//设置发送的日期
|
//设置发送的日期
|
||||||
msg.setSentDate(new Date());
|
msg.setSentDate(new Date());
|
||||||
// 创建邮件正文
|
// 创建邮件正文
|
||||||
MimeMultipart multipart = new MimeMultipart();
|
MimeMultipart multipart = new MimeMultipart();
|
||||||
// MimeBodyPart bodyPart = new MimeBodyPart();
|
// MimeBodyPart bodyPart = new MimeBodyPart();
|
||||||
// bodyPart.setContent("This is the body of the email", "text/html");
|
// bodyPart.setContent("This is the body of the email", "text/html");
|
||||||
// multipart.addBodyPart(bodyPart);
|
multipart.addBodyPart(messageBodyPart);
|
||||||
// 添加附件
|
// 添加附件
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
MimeBodyPart attachmentPart = new MimeBodyPart();
|
MimeBodyPart attachmentPart = new MimeBodyPart();
|
||||||
|
|||||||
+4
@@ -8,4 +8,8 @@ public interface ISendMailRecordService {
|
|||||||
|
|
||||||
|
|
||||||
List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord);
|
List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-20
@@ -341,28 +341,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
if (appEmail != null) {
|
if (appEmail != null) {
|
||||||
emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
||||||
, "hjbjava@163.com", javaMailSender);
|
, "hjbjava@163.com", javaMailSender);
|
||||||
|
|
||||||
SendMailRecord sendMailRecord = new SendMailRecord();
|
|
||||||
sendMailRecord.setCaseId(id);
|
|
||||||
sendMailRecord.setMailAddress(appEmail);
|
|
||||||
sendMailRecord.setMailContent("您的裁决书已送达,详情请查阅附件");
|
|
||||||
sendMailRecord.setMailName("案件裁决书");
|
|
||||||
sendMailRecord.setSendTime(new Date());
|
|
||||||
sendMailRecord.setCreateBy(getUsername());
|
|
||||||
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
||||||
}
|
}
|
||||||
if (resEmail != null) {
|
if (resEmail != null) {
|
||||||
emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
||||||
, "hjbjava@163.com", javaMailSender);
|
, "hjbjava@163.com", javaMailSender);
|
||||||
|
|
||||||
SendMailRecord sendMailRecord = new SendMailRecord();
|
|
||||||
sendMailRecord.setCaseId(id);
|
|
||||||
sendMailRecord.setMailAddress(resEmail);
|
|
||||||
sendMailRecord.setMailContent("您的裁决书已送达,详情请查阅附件");
|
|
||||||
sendMailRecord.setMailName("案件裁决书");
|
|
||||||
sendMailRecord.setSendTime(new Date());
|
|
||||||
sendMailRecord.setCreateBy(getUsername());
|
|
||||||
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
||||||
}
|
}
|
||||||
//修改案件状态
|
//修改案件状态
|
||||||
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
|
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
|
||||||
@@ -480,6 +463,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
|
public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
|
||||||
CaseApplication caseApplication = new CaseApplication();
|
CaseApplication caseApplication = new CaseApplication();
|
||||||
caseApplication.setId(id);
|
caseApplication.setId(id);
|
||||||
@@ -509,6 +493,25 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
}
|
}
|
||||||
//发送邮件
|
//发送邮件
|
||||||
sendCaseEmail(caseApplication1, appEmail, resEmail);
|
sendCaseEmail(caseApplication1, appEmail, resEmail);
|
||||||
|
|
||||||
|
SendMailRecord sendMailRecord = new SendMailRecord();
|
||||||
|
sendMailRecord.setCaseId(id);
|
||||||
|
sendMailRecord.setMailAddress(appEmail);
|
||||||
|
sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅");
|
||||||
|
sendMailRecord.setMailName("签署后的裁决书");
|
||||||
|
sendMailRecord.setSendTime(new Date());
|
||||||
|
sendMailRecord.setCreateBy(getUsername());
|
||||||
|
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
||||||
|
|
||||||
|
SendMailRecord sendMailRecord1 = new SendMailRecord();
|
||||||
|
sendMailRecord1.setCaseId(id);
|
||||||
|
sendMailRecord1.setMailAddress(resEmail);
|
||||||
|
sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅");
|
||||||
|
sendMailRecord1.setMailName("签署后的裁决书");
|
||||||
|
sendMailRecord1.setSendTime(new Date());
|
||||||
|
sendMailRecord1.setCreateBy(getUsername());
|
||||||
|
sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
|
||||||
|
|
||||||
// 新增日志
|
// 新增日志
|
||||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, "");
|
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, "");
|
||||||
|
|
||||||
@@ -525,12 +528,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
private void sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) {
|
private void sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) {
|
||||||
List<File> fileList = new ArrayList<>();
|
List<File> fileList = new ArrayList<>();
|
||||||
File file = null;
|
File file = null;
|
||||||
List<CaseAttach> caseAttachList = caseApplication1.getCaseAttachList();
|
|
||||||
|
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1);
|
||||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||||
for (CaseAttach caseAttach : caseAttachList) {
|
for (CaseAttach caseAttach : caseAttachList) {
|
||||||
if (caseAttach.getAnnexType() == 3) {
|
if (caseAttach.getAnnexType() == 3) {
|
||||||
String annexPath = caseAttach.getAnnexPath();
|
String annexName = caseAttach.getAnnexName();
|
||||||
String path = "/home/ruoyi/" + annexPath;
|
String prefix = "/profile/upload/";
|
||||||
|
int startIndex = prefix.length();
|
||||||
|
String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
|
||||||
file = new File(path);
|
file = new File(path);
|
||||||
fileList.add(file);
|
fileList.add(file);
|
||||||
System.out.println("文件长度==================:" + file.length());
|
System.out.println("文件长度==================:" + file.length());
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ public class SignAward {
|
|||||||
|
|
||||||
// System.out.println(signFlowDetailJsonObject);
|
// System.out.println(signFlowDetailJsonObject);
|
||||||
|
|
||||||
|
String annexName = "/profile/upload/2023/10/26/1f6fe04f5f984e8ab5bbaf70dd47100a.docx";
|
||||||
|
String prefix = "/profile/upload/";
|
||||||
|
int startIndex = prefix.length();
|
||||||
|
String annexPath = "/home/ruoyi/uploadPath/upload/";
|
||||||
|
String annexPathnew = annexPath + annexName.substring(startIndex);
|
||||||
|
System.out.println(annexPathnew);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user