修改发邮件功能

This commit is contained in:
qitz
2023-10-27 09:57:41 +08:00
parent b5c2bb391c
commit 8c950a2fd1
5 changed files with 54 additions and 21 deletions
@@ -8,4 +8,8 @@ public interface ISendMailRecordService {
List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord);
}
@@ -341,28 +341,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
if (appEmail != null) {
emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
, "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) {
emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
, "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);
@@ -480,6 +463,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
@Override
@Transactional
public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
@@ -509,6 +493,25 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
//发送邮件
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, "");
@@ -525,12 +528,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private void sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail) {
List<File> fileList = new ArrayList<>();
File file = null;
List<CaseAttach> caseAttachList = caseApplication1.getCaseAttachList();
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1);
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/" + annexPath;
String annexName = caseAttach.getAnnexName();
String prefix = "/profile/upload/";
int startIndex = prefix.length();
String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
file = new File(path);
fileList.add(file);
System.out.println("文件长度==================:" + file.length());
@@ -91,6 +91,13 @@ public class SignAward {
// 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);
}