Merge branch 'qtz3' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #155.
This commit is contained in:
qtz
2023-10-27 10:01:26 +08:00
committed by Gitea
5 changed files with 54 additions and 21 deletions
@@ -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) {
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());
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
//设置邮件会话参数
@@ -125,13 +128,14 @@ public class EmailOutUtil {
//设置邮件消息
msg.setSubject(subject);
msg.setText(message);
msg.setDescription("messageutf-8html");
//设置发送的日期
msg.setSentDate(new Date());
// 创建邮件正文
MimeMultipart multipart = new MimeMultipart();
// MimeBodyPart bodyPart = new MimeBodyPart();
// bodyPart.setContent("This is the body of the email", "text/html");
// multipart.addBodyPart(bodyPart);
multipart.addBodyPart(messageBodyPart);
// 添加附件
if (file != null) {
MimeBodyPart attachmentPart = new MimeBodyPart();
@@ -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);
}