|
|
@@ -596,9 +596,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
596
|
596
|
Gson gson = new Gson();
|
|
597
|
597
|
EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord);
|
|
598
|
598
|
JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
599
|
|
- JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
600
|
|
- String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
601
|
|
- sealSignRecordres.setSealUrl(urlapply);
|
|
|
599
|
+ if(signUrlJsonObject.get("data")==null||signUrlJsonObject.get("data").isJsonNull()){
|
|
|
600
|
+ throw new ServiceException("该用户和流程无关,不能查看当前流程");
|
|
|
601
|
+ }else {
|
|
|
602
|
+ JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
|
603
|
+ String urlapply = signUrlData.get("shortUrl").getAsString();
|
|
|
604
|
+ sealSignRecordres.setSealUrl(urlapply);
|
|
|
605
|
+ }
|
|
602
|
606
|
}
|
|
603
|
607
|
return AjaxResult.success(sealSignRecordres);
|
|
604
|
608
|
}else {
|
|
|
@@ -722,7 +726,14 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
722
|
726
|
if(signStatusResponse!=null&&signStatusResponse.intValue()==1&&
|
|
723
|
727
|
signStatusMediator!=null&&signStatusMediator.intValue()==1){
|
|
724
|
728
|
// 根据流程id查找下一个流程节点
|
|
725
|
|
- MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
|
|
|
729
|
+ MsCaseFlow nextFlow=null;
|
|
|
730
|
+ if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
|
|
|
731
|
+ // 需要用印
|
|
|
732
|
+ nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
|
|
|
733
|
+ }else {
|
|
|
734
|
+ // 不需要用印
|
|
|
735
|
+ nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue());
|
|
|
736
|
+ }
|
|
726
|
737
|
MsCaseApplication application = new MsCaseApplication();
|
|
727
|
738
|
application.setId(caseApplicationselect.getId());
|
|
728
|
739
|
application.setCaseFlowId(nextFlow.getId());
|
|
|
@@ -730,8 +741,17 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
730
|
741
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
731
|
742
|
|
|
732
|
743
|
//修改"签署用印记录表"的状态为待用印
|
|
733
|
|
- sealSignRecordsel.setSignFlowStatus(2);
|
|
734
|
|
- sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
744
|
+ if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
|
|
|
745
|
+ sealSignRecordsel.setSignFlowStatus(2);
|
|
|
746
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
747
|
+ }else {
|
|
|
748
|
+ // 否则为已完成
|
|
|
749
|
+ sealSignRecordsel.setSignFlowStatus(3);
|
|
|
750
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
751
|
+ // 下载调解书
|
|
|
752
|
+ downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
|
|
|
753
|
+ }
|
|
|
754
|
+
|
|
735
|
755
|
}
|
|
736
|
756
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
|
|
737
|
757
|
//被申请人签名
|
|
|
@@ -755,8 +775,17 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
755
|
775
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
756
|
776
|
|
|
757
|
777
|
//修改"签署用印记录表"的状态为待用印
|
|
758
|
|
- sealSignRecordsel.setSignFlowStatus(2);
|
|
759
|
|
- sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
778
|
+ if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
|
|
|
779
|
+ sealSignRecordsel.setSignFlowStatus(2);
|
|
|
780
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
781
|
+ }else {
|
|
|
782
|
+ // 否则为已完成
|
|
|
783
|
+ sealSignRecordsel.setSignFlowStatus(3);
|
|
|
784
|
+ sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
785
|
+ // 下载调解书
|
|
|
786
|
+ downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
|
|
|
787
|
+ }
|
|
|
788
|
+
|
|
760
|
789
|
}
|
|
761
|
790
|
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){
|
|
762
|
791
|
//调解员签名
|
|
|
@@ -780,10 +809,16 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
780
|
809
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
781
|
810
|
|
|
782
|
811
|
//修改"签署用印记录表"的状态为待用印
|
|
783
|
|
- sealSignRecordsel.setSignFlowStatus(2);
|
|
|
812
|
+ if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
|
|
|
813
|
+ sealSignRecordsel.setSignFlowStatus(2);
|
|
|
814
|
+ }else {
|
|
|
815
|
+ // 否则为已完成
|
|
|
816
|
+ sealSignRecordsel.setSignFlowStatus(3);
|
|
|
817
|
+ }
|
|
784
|
818
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
785
|
819
|
}
|
|
786
|
|
- }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc)){
|
|
|
820
|
+ }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){
|
|
|
821
|
+ //需要用印
|
|
787
|
822
|
sealSignRecordsel.setSealStatus(1);
|
|
788
|
823
|
sealSignRecordsel.setSignFlowStatus(3);
|
|
789
|
824
|
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
|
|
|
@@ -804,73 +839,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
804
|
839
|
caseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
805
|
840
|
|
|
806
|
841
|
//下载审核完成的调解书
|
|
807
|
|
- EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
|
|
808
|
|
- JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
|
809
|
|
- JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
|
810
|
|
- JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
|
811
|
|
- if (filesArray != null && filesArray.size() > 0) {
|
|
812
|
|
- JsonObject fileObject = (JsonObject) filesArray.get(0);
|
|
813
|
|
- String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
|
814
|
|
- LocalDate now = LocalDate.now();
|
|
815
|
|
- String year = Integer.toString(now.getYear());
|
|
816
|
|
- String month = String.format("%02d", now.getMonthValue());
|
|
817
|
|
- String day = String.format("%02d", now.getDayOfMonth());
|
|
818
|
|
- String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
819
|
|
- String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
|
820
|
|
-// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
821
|
|
-// String savePath = "/home/ruoyi/uploadPath/upload/";
|
|
822
|
|
- String saveName = fileName;
|
|
823
|
|
- String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
824
|
|
-
|
|
825
|
|
- // 创建日期目录
|
|
826
|
|
- File saveFolder = new File(saveFolderPath);
|
|
827
|
|
- if (!saveFolder.exists()) {
|
|
828
|
|
- saveFolder.mkdirs();
|
|
829
|
|
- }
|
|
830
|
|
- String resultFilePath = saveFolderPath + "/" + fileName;
|
|
831
|
|
- File resultFilePathFile = new File(resultFilePath);
|
|
832
|
|
- if (!resultFilePathFile.exists()) {
|
|
833
|
|
- resultFilePathFile.createNewFile();
|
|
834
|
|
- }
|
|
835
|
|
-
|
|
836
|
|
- String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
837
|
|
- boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
838
|
|
- if (downLoadFile) {
|
|
839
|
|
- // 先删除已经存在的调解书
|
|
840
|
|
- if(StrUtil.isEmpty(application.getCaseSource())){
|
|
841
|
|
- List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
842
|
|
- if(CollectionUtil.isNotEmpty(existAttach)){
|
|
843
|
|
- // todo 对接北明,同步案件状态,删除
|
|
844
|
|
- for (MsCaseAttach msCaseAttach : existAttach) {
|
|
845
|
|
- if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
846
|
|
- continue;
|
|
847
|
|
- }
|
|
848
|
|
- beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
849
|
|
- }
|
|
850
|
|
- }
|
|
851
|
|
- }
|
|
852
|
|
- msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
853
|
|
- MsCaseAttach caseAttach = new MsCaseAttach();
|
|
854
|
|
- caseAttach.setCaseAppliId(caseAppliId);
|
|
855
|
|
- caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
856
|
|
- caseAttach.setAnnexPath(savePath);
|
|
857
|
|
- caseAttach.setAnnexName(saveName);
|
|
858
|
|
- caseAttachMapper.save(caseAttach);
|
|
859
|
|
- // todo 对接北明,调用上传附件接口
|
|
860
|
|
- if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
|
|
861
|
|
- String templatePath = "/home/ruoyi" + savePath;
|
|
862
|
|
- File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
|
863
|
|
- MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
|
|
864
|
|
- // 更新附件表
|
|
865
|
|
- if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
|
|
866
|
|
- caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
|
867
|
|
- msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
868
|
|
- }
|
|
|
842
|
+ downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
|
|
869
|
843
|
|
|
870
|
|
- }
|
|
871
|
|
- }
|
|
872
|
|
-
|
|
873
|
|
- }
|
|
874
|
844
|
}
|
|
875
|
845
|
|
|
876
|
846
|
}else if(mediaResult.intValue()==5){
|
|
|
@@ -932,7 +902,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
932
|
902
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
933
|
903
|
if (downLoadFile) {
|
|
934
|
904
|
// 先删除已经存在的调解书
|
|
935
|
|
- if(StrUtil.isEmpty(application.getCaseSource())){
|
|
|
905
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
|
|
936
|
906
|
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
937
|
907
|
if(CollectionUtil.isNotEmpty(existAttach)){
|
|
938
|
908
|
// todo 对接北明,同步案件状态,删除
|
|
|
@@ -940,7 +910,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
940
|
910
|
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
941
|
911
|
continue;
|
|
942
|
912
|
}
|
|
943
|
|
- beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
913
|
+ beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
944
|
914
|
}
|
|
945
|
915
|
}
|
|
946
|
916
|
}
|
|
|
@@ -1024,7 +994,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1024
|
994
|
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
1025
|
995
|
if (downLoadFile) {
|
|
1026
|
996
|
// 先删除已经存在的调解书
|
|
1027
|
|
- if(StrUtil.isEmpty(application.getCaseSource())){
|
|
|
997
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
|
|
1028
|
998
|
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1029
|
999
|
if(CollectionUtil.isNotEmpty(existAttach)){
|
|
1030
|
1000
|
// todo 对接北明,同步案件状态,删除
|
|
|
@@ -1032,7 +1002,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1032
|
1002
|
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
1033
|
1003
|
continue;
|
|
1034
|
1004
|
}
|
|
1035
|
|
- beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
1005
|
+ beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
1036
|
1006
|
}
|
|
1037
|
1007
|
}
|
|
1038
|
1008
|
}
|
|
|
@@ -1069,6 +1039,77 @@ public class MsSignSealServiceImpl implements MsSignSealService {
|
|
1069
|
1039
|
return AjaxResult.success("success");
|
|
1070
|
1040
|
}
|
|
1071
|
1041
|
|
|
|
1042
|
+ private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException {
|
|
|
1043
|
+ EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
|
|
|
1044
|
+ JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
|
|
|
1045
|
+ JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
|
|
|
1046
|
+ JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
|
|
|
1047
|
+ if (filesArray != null && filesArray.size() > 0) {
|
|
|
1048
|
+ JsonObject fileObject = (JsonObject) filesArray.get(0);
|
|
|
1049
|
+ String fileDownloadUrl = fileObject.get("downloadUrl").toString();
|
|
|
1050
|
+ LocalDate now = LocalDate.now();
|
|
|
1051
|
+ String year = Integer.toString(now.getYear());
|
|
|
1052
|
+ String month = String.format("%02d", now.getMonthValue());
|
|
|
1053
|
+ String day = String.format("%02d", now.getDayOfMonth());
|
|
|
1054
|
+ String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
1055
|
+ String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
|
|
1056
|
+// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
1057
|
+// String savePath = "/home/ruoyi/uploadPath/upload/";
|
|
|
1058
|
+ String saveName = fileName;
|
|
|
1059
|
+ String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
1060
|
+
|
|
|
1061
|
+ // 创建日期目录
|
|
|
1062
|
+ File saveFolder = new File(saveFolderPath);
|
|
|
1063
|
+ if (!saveFolder.exists()) {
|
|
|
1064
|
+ saveFolder.mkdirs();
|
|
|
1065
|
+ }
|
|
|
1066
|
+ String resultFilePath = saveFolderPath + "/" + fileName;
|
|
|
1067
|
+ File resultFilePathFile = new File(resultFilePath);
|
|
|
1068
|
+ if (!resultFilePathFile.exists()) {
|
|
|
1069
|
+ resultFilePathFile.createNewFile();
|
|
|
1070
|
+ }
|
|
|
1071
|
+
|
|
|
1072
|
+ String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
|
|
|
1073
|
+ boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
|
|
|
1074
|
+ if (downLoadFile) {
|
|
|
1075
|
+ // 先删除已经存在的调解书
|
|
|
1076
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
|
|
|
1077
|
+ List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
1078
|
+ if(CollectionUtil.isNotEmpty(existAttach)){
|
|
|
1079
|
+ // todo 对接北明,同步案件状态,删除
|
|
|
1080
|
+ for (MsCaseAttach msCaseAttach : existAttach) {
|
|
|
1081
|
+ if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
|
|
|
1082
|
+ continue;
|
|
|
1083
|
+ }
|
|
|
1084
|
+ beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
|
|
|
1085
|
+ }
|
|
|
1086
|
+ }
|
|
|
1087
|
+ }
|
|
|
1088
|
+ msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
1089
|
+ MsCaseAttach caseAttach = new MsCaseAttach();
|
|
|
1090
|
+ caseAttach.setCaseAppliId(caseAppliId);
|
|
|
1091
|
+ caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
|
1092
|
+ caseAttach.setAnnexPath(savePath);
|
|
|
1093
|
+ caseAttach.setAnnexName(saveName);
|
|
|
1094
|
+ caseAttachMapper.save(caseAttach);
|
|
|
1095
|
+ // todo 对接北明,调用上传附件接口
|
|
|
1096
|
+ if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
|
|
|
1097
|
+ String templatePath = "/home/ruoyi" + savePath;
|
|
|
1098
|
+ File file = new File(templatePath.replace("/profile", "/uploadPath"));
|
|
|
1099
|
+ MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
|
|
|
1100
|
+ // 更新附件表
|
|
|
1101
|
+ if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
|
|
|
1102
|
+ caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
|
|
|
1103
|
+ msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
|
|
1104
|
+ }
|
|
|
1105
|
+
|
|
|
1106
|
+ }
|
|
|
1107
|
+ }
|
|
|
1108
|
+
|
|
|
1109
|
+ }
|
|
|
1110
|
+ }
|
|
|
1111
|
+
|
|
|
1112
|
+
|
|
1072
|
1113
|
@Override
|
|
1073
|
1114
|
@Transactional(rollbackFor = Exception.class)
|
|
1074
|
1115
|
public AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException {
|