|
|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
16
|
16
|
import org.springframework.mail.MailSendException;
|
|
17
|
17
|
import org.springframework.mail.javamail.JavaMailSender;
|
|
18
|
18
|
import org.springframework.stereotype.Service;
|
|
|
19
|
+import org.springframework.transaction.annotation.Transactional;
|
|
19
|
20
|
|
|
20
|
21
|
import java.io.*;
|
|
21
|
22
|
import java.net.HttpURLConnection;
|
|
|
@@ -125,10 +126,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|
125
|
126
|
datas.put("year", now.getYear());
|
|
126
|
127
|
datas.put("months", now.getMonthValue());
|
|
127
|
128
|
datas.put("day", now.getDayOfMonth());
|
|
128
|
|
- //String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
|
|
129
|
|
- String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
|
|
130
|
|
- //String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
131
|
|
- String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
|
129
|
+ String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
|
|
|
130
|
+ //String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
|
|
|
131
|
+ String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
|
132
|
+ //String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
132
|
133
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
|
133
|
134
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
|
134
|
135
|
// 创建日期目录
|
|
|
@@ -167,7 +168,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|
167
|
168
|
}
|
|
168
|
169
|
|
|
169
|
170
|
@Override
|
|
170
|
|
- public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail) {
|
|
|
171
|
+ @Transactional
|
|
|
172
|
+ public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail ,String apptrackingNum,String restrackingNum) {
|
|
171
|
173
|
CaseApplication caseApplication = new CaseApplication();
|
|
172
|
174
|
caseApplication.setId(id);
|
|
173
|
175
|
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
@@ -187,19 +189,40 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|
187
|
189
|
}
|
|
188
|
190
|
}
|
|
189
|
191
|
}
|
|
|
192
|
+ if (fileList.size()<1){
|
|
|
193
|
+ return AjaxResult.error("未查询到裁决书");
|
|
|
194
|
+ }
|
|
|
195
|
+ File file = fileList.get(0);
|
|
190
|
196
|
//电子邮件送达
|
|
191
|
197
|
JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
|
|
192
|
198
|
if (appEmail != null) {
|
|
193
|
|
- emailOutUtil.sendMessageCarryFiles(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
|
|
|
199
|
+ emailOutUtil.sendMessageCarryFile(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
|
194
|
200
|
, "hjbjava@163.com", javaMailSender);
|
|
195
|
201
|
}
|
|
196
|
202
|
if (resEmail != null) {
|
|
197
|
|
- emailOutUtil.sendMessageCarryFiles(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
|
|
|
203
|
+ emailOutUtil.sendMessageCarryFile(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
|
|
198
|
204
|
, "hjbjava@163.com", javaMailSender);
|
|
199
|
205
|
}
|
|
200
|
206
|
//修改案件状态
|
|
201
|
207
|
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
|
|
202
|
208
|
caseApplicationMapper.submitCaseApplication(caseApplication1);
|
|
|
209
|
+ //保存邮箱信息和快递单号到关联人表
|
|
|
210
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
211
|
+ caseAffiliate.setCaseAppliId(id);
|
|
|
212
|
+ List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
213
|
+ if (caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
|
214
|
+ for (CaseAffiliate affiliate : caseAffiliates) {
|
|
|
215
|
+ if (affiliate.getIdentityType() == 1){ //申请人
|
|
|
216
|
+ affiliate.setSendEmail(appEmail);
|
|
|
217
|
+ affiliate.setTrackNum(apptrackingNum);
|
|
|
218
|
+ caseAffiliateMapper.updataCaseAffiliate(affiliate);
|
|
|
219
|
+ }else {
|
|
|
220
|
+ affiliate.setSendEmail(resEmail);
|
|
|
221
|
+ affiliate.setTrackNum(restrackingNum);
|
|
|
222
|
+ caseAffiliateMapper.updataCaseAffiliate(affiliate);
|
|
|
223
|
+ }
|
|
|
224
|
+ }
|
|
|
225
|
+ }
|
|
203
|
226
|
return AjaxResult.success("仲裁文书送达成功");
|
|
204
|
227
|
} catch (MailSendException e) {
|
|
205
|
228
|
return AjaxResult.error("发送失败,请检查文件路径");
|