|
|
@@ -10,12 +10,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
10
|
10
|
import com.google.gson.Gson;
|
|
11
|
11
|
import com.google.gson.JsonArray;
|
|
12
|
12
|
import com.google.gson.JsonObject;
|
|
|
13
|
+import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
13
|
14
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
14
|
15
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
15
|
16
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
16
|
17
|
import com.ruoyi.common.enums.YesOrNoEnum;
|
|
17
|
18
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
18
|
19
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
20
|
+import com.ruoyi.common.utils.EmailOutUtil;
|
|
19
|
21
|
import com.ruoyi.common.utils.SmsUtils;
|
|
20
|
22
|
import com.ruoyi.common.utils.StringUtils;
|
|
21
|
23
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
|
@@ -27,6 +29,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
|
|
27
|
29
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
|
|
28
|
30
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
|
|
29
|
31
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|
|
32
|
+import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
|
|
30
|
33
|
import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
|
|
31
|
34
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
|
|
32
|
35
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
|
|
|
@@ -38,6 +41,7 @@ import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAffiliateMapper;
|
|
38
|
41
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
|
|
39
|
42
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
|
|
40
|
43
|
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseLogRecordMapper;
|
|
|
44
|
+import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SendMailRecordMapper;
|
|
41
|
45
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
|
42
|
46
|
import com.ruoyi.wisdomarbitrate.service.mscase.MsSignSealService;
|
|
43
|
47
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
|
@@ -47,7 +51,10 @@ import org.springframework.stereotype.Service;
|
|
47
|
51
|
import org.springframework.transaction.annotation.Transactional;
|
|
48
|
52
|
import tk.mybatis.mapper.entity.Example;
|
|
49
|
53
|
|
|
|
54
|
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
55
|
+
|
|
50
|
56
|
import javax.annotation.Resource;
|
|
|
57
|
+import java.io.File;
|
|
51
|
58
|
import java.util.*;
|
|
52
|
59
|
import java.util.stream.Collectors;
|
|
53
|
60
|
|
|
|
@@ -83,6 +90,12 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
83
|
90
|
@Autowired
|
|
84
|
91
|
private MsCaseLogRecordMapper caseLogRecordMapper;
|
|
85
|
92
|
|
|
|
93
|
+ @Autowired
|
|
|
94
|
+ private EmailOutUtil emailOutUtil;
|
|
|
95
|
+
|
|
|
96
|
+ @Autowired
|
|
|
97
|
+ private SendMailRecordMapper sendMailRecordMapper;
|
|
|
98
|
+
|
|
86
|
99
|
|
|
87
|
100
|
@Override
|
|
88
|
101
|
@Transactional
|
|
|
@@ -494,6 +507,139 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
494
|
507
|
return records;
|
|
495
|
508
|
}
|
|
496
|
509
|
|
|
|
510
|
+ @Override
|
|
|
511
|
+ @Transactional
|
|
|
512
|
+ public AjaxResult msCaseFile(List<Long> ids) {
|
|
|
513
|
+ try {
|
|
|
514
|
+ for (Long id : ids) {
|
|
|
515
|
+ MsCaseApplication caseApplication1 = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
516
|
+ if (caseApplication1 == null) {
|
|
|
517
|
+ return AjaxResult.error("未查询到相关案件");
|
|
|
518
|
+ }
|
|
|
519
|
+ MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
|
|
|
520
|
+ BeanUtil.copyProperties(caseApplication1, msCaseApplicationVO);
|
|
|
521
|
+ List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
|
|
|
522
|
+ if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
|
523
|
+ for (MsCaseAttach caseAttach : caseAttachList) {
|
|
|
524
|
+ if (caseAttach.getAnnexType() == 3) {
|
|
|
525
|
+ String annexName = caseAttach.getAnnexName();
|
|
|
526
|
+ String prefix = "/profile/upload/";
|
|
|
527
|
+ int startIndex = prefix.length();
|
|
|
528
|
+ String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
|
|
|
529
|
+ File file = new File(path);
|
|
|
530
|
+ // todo 部署放开
|
|
|
531
|
+ if (!file.exists()) {
|
|
|
532
|
+ return AjaxResult.error("未生成裁决书");
|
|
|
533
|
+ }
|
|
|
534
|
+
|
|
|
535
|
+ }
|
|
|
536
|
+ }
|
|
|
537
|
+ }
|
|
|
538
|
+ Integer caseFlowId = caseApplication1.getCaseFlowId();
|
|
|
539
|
+ // 根据流程id查找下一个流程节点
|
|
|
540
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
|
|
|
541
|
+ caseApplication1.setCaseFlowId(nextFlow.getId());
|
|
|
542
|
+ caseApplication1.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
543
|
+ caseApplicationMapper.updateByPrimaryKeySelective(caseApplication1);
|
|
|
544
|
+
|
|
|
545
|
+ String appEmail = "";
|
|
|
546
|
+ String resEmail = "";
|
|
|
547
|
+ MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
|
|
|
548
|
+ appEmail = caseAffiliate.getAgentEmail();
|
|
|
549
|
+ resEmail = caseAffiliate.getRespondentEmail();
|
|
|
550
|
+
|
|
|
551
|
+ boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList);
|
|
|
552
|
+
|
|
|
553
|
+ SendMailRecord sendMailRecord = new SendMailRecord();
|
|
|
554
|
+ sendMailRecord.setCaseId(id);
|
|
|
555
|
+ sendMailRecord.setMailAddress(appEmail);
|
|
|
556
|
+ sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅");
|
|
|
557
|
+// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
|
|
|
558
|
+ sendMailRecord.setMailName("签署后的裁决书");
|
|
|
559
|
+ sendMailRecord.setSendTime(new Date());
|
|
|
560
|
+ sendMailRecord.setCreateBy(getUsername());
|
|
|
561
|
+ if (appEmailFlag) {
|
|
|
562
|
+ sendMailRecord.setSendStatus(1);
|
|
|
563
|
+ } else {
|
|
|
564
|
+ sendMailRecord.setSendStatus(0);
|
|
|
565
|
+ }
|
|
|
566
|
+ sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
|
|
|
567
|
+
|
|
|
568
|
+ boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList);
|
|
|
569
|
+
|
|
|
570
|
+ SendMailRecord sendMailRecord1 = new SendMailRecord();
|
|
|
571
|
+ sendMailRecord1.setCaseId(id);
|
|
|
572
|
+ sendMailRecord1.setMailAddress(resEmail);
|
|
|
573
|
+// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
|
|
|
574
|
+ sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅");
|
|
|
575
|
+ sendMailRecord1.setMailName("签署后的裁决书");
|
|
|
576
|
+ sendMailRecord1.setSendTime(new Date());
|
|
|
577
|
+ sendMailRecord1.setCreateBy(getUsername());
|
|
|
578
|
+ if (resEmailFlag) {
|
|
|
579
|
+ sendMailRecord1.setSendStatus(1);
|
|
|
580
|
+ }else {
|
|
|
581
|
+ sendMailRecord1.setSendStatus(0);
|
|
|
582
|
+ }
|
|
|
583
|
+ sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
|
|
|
584
|
+ if(!appEmailFlag&&!resEmailFlag){
|
|
|
585
|
+ throw new ServiceException("裁决书发送失败");
|
|
|
586
|
+ }
|
|
|
587
|
+ if(!appEmailFlag){
|
|
|
588
|
+ throw new ServiceException("申请人裁决书发送失败");
|
|
|
589
|
+ }
|
|
|
590
|
+ if(!resEmailFlag){
|
|
|
591
|
+ throw new ServiceException("被申请人裁决书发送失败");
|
|
|
592
|
+ }
|
|
|
593
|
+
|
|
|
594
|
+ CaseLogUtils.insertCaseLog(caseApplication1.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"归档");
|
|
|
595
|
+
|
|
|
596
|
+ }
|
|
|
597
|
+ } catch (Exception e) {
|
|
|
598
|
+ return AjaxResult.error(e.getMessage());
|
|
|
599
|
+ }
|
|
|
600
|
+
|
|
|
601
|
+ return AjaxResult.success("归档成功");
|
|
|
602
|
+ }
|
|
|
603
|
+
|
|
|
604
|
+ /**
|
|
|
605
|
+ * 通过邮件发送裁决书文件
|
|
|
606
|
+ *
|
|
|
607
|
+ * @param caseApplication1
|
|
|
608
|
+ */
|
|
|
609
|
+ private boolean sendCaseEmail(MsCaseApplication caseApplication1, String email, List<MsCaseAttach> caseAttachList) {
|
|
|
610
|
+ List<File> fileList = new ArrayList<>();
|
|
|
611
|
+ File file = null;
|
|
|
612
|
+ if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
|
613
|
+ for (MsCaseAttach caseAttach : caseAttachList) {
|
|
|
614
|
+ if (caseAttach.getAnnexType() == 3) {
|
|
|
615
|
+ String annexName = caseAttach.getAnnexName();
|
|
|
616
|
+ String prefix = "/profile/upload/";
|
|
|
617
|
+ int startIndex = prefix.length();
|
|
|
618
|
+ String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
|
|
|
619
|
+ // todo 部署放开
|
|
|
620
|
+ file = new File(path);
|
|
|
621
|
+ fileList.add(file);
|
|
|
622
|
+ System.out.println("文件长度==================:" + file.length());
|
|
|
623
|
+ }
|
|
|
624
|
+ }
|
|
|
625
|
+ }
|
|
|
626
|
+
|
|
|
627
|
+ if (file != null && file.exists()) {
|
|
|
628
|
+ try {
|
|
|
629
|
+ Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null);
|
|
|
630
|
+
|
|
|
631
|
+ if (aBoolean) {
|
|
|
632
|
+ return Boolean.TRUE;
|
|
|
633
|
+ }
|
|
|
634
|
+ } catch (Exception e) {
|
|
|
635
|
+ System.out.println("邮件发送失败++++++++++++++++++++++++++++++++");
|
|
|
636
|
+ System.out.println(e.toString());
|
|
|
637
|
+ return Boolean.FALSE;
|
|
|
638
|
+ }
|
|
|
639
|
+ }
|
|
|
640
|
+ return Boolean.FALSE;
|
|
|
641
|
+ }
|
|
|
642
|
+
|
|
497
|
643
|
|
|
498
|
644
|
private MsCaseLogRecordVO getNextCaseLogRecord(String nodeName) {
|
|
499
|
645
|
MsCaseLogRecordVO caseLogRecord = new MsCaseLogRecordVO();
|