|
|
@@ -20,6 +20,7 @@ import com.ruoyi.common.core.domain.entity.SysDept;
|
|
20
|
20
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
21
|
21
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
22
|
22
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
23
|
+import com.ruoyi.common.utils.WordUtil;
|
|
23
|
24
|
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
|
|
24
|
25
|
|
|
25
|
26
|
|
|
|
@@ -44,8 +45,14 @@ import org.springframework.stereotype.Service;
|
|
44
|
45
|
import org.springframework.transaction.annotation.Transactional;
|
|
45
|
46
|
|
|
46
|
47
|
import java.io.File;
|
|
|
48
|
+import java.io.IOException;
|
|
47
|
49
|
import java.math.BigDecimal;
|
|
|
50
|
+import java.nio.file.Files;
|
|
|
51
|
+import java.nio.file.Path;
|
|
|
52
|
+import java.nio.file.StandardCopyOption;
|
|
48
|
53
|
import java.text.SimpleDateFormat;
|
|
|
54
|
+import java.time.LocalDate;
|
|
|
55
|
+import java.time.ZoneId;
|
|
49
|
56
|
import java.util.*;
|
|
50
|
57
|
import java.util.regex.Pattern;
|
|
51
|
58
|
import java.util.stream.Collectors;
|
|
|
@@ -75,6 +82,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
75
|
82
|
private SysUserMapper sysUserMapper;
|
|
76
|
83
|
@Autowired
|
|
77
|
84
|
private SealSignRecordMapper sealSignRecordMapper;
|
|
|
85
|
+ @Autowired
|
|
|
86
|
+ private CaseLogRecordMapper caseLogRecordMapper;
|
|
78
|
87
|
// 手机号正则
|
|
79
|
88
|
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
|
|
80
|
89
|
|
|
|
@@ -968,6 +977,171 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
968
|
977
|
return sealSignRecordReslt;
|
|
969
|
978
|
}
|
|
970
|
979
|
|
|
|
980
|
+ @Override
|
|
|
981
|
+ @Transactional
|
|
|
982
|
+ public AjaxResult creatTrialRecord(ArbitrateRecord arbitrateRecordselect) {
|
|
|
983
|
+ //生成仲裁结果
|
|
|
984
|
+ CaseApplication caseApplicationselect = new CaseApplication();
|
|
|
985
|
+ caseApplicationselect.setId(arbitrateRecordselect.getCaseAppliId());
|
|
|
986
|
+ CaseApplication caseApplication = caseApplicationMapper.selectCaseApplication(caseApplicationselect);
|
|
|
987
|
+ String createBy = caseApplication.getCreateBy();
|
|
|
988
|
+ if (createBy!=null){
|
|
|
989
|
+ arbitrateRecordselect.setCreateBy(createBy);
|
|
|
990
|
+ }
|
|
|
991
|
+ //先判断案件是否已经提交过仲裁结果
|
|
|
992
|
+ ArbitrateRecord arbitrateRecordsele = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecordselect);
|
|
|
993
|
+ if (arbitrateRecordsele!=null){
|
|
|
994
|
+ int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordselect);
|
|
|
995
|
+ if (i>0){
|
|
|
996
|
+ //案件日志表里添加数据
|
|
|
997
|
+ CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
|
998
|
+ caseLogRecord.setCaseAppliId(caseApplication.getId());
|
|
|
999
|
+ caseLogRecord.setCaseNode(caseApplication.getCaseStatus());
|
|
|
1000
|
+ if (createBy!=null){
|
|
|
1001
|
+ caseLogRecord.setCreateBy(createBy);
|
|
|
1002
|
+ }
|
|
|
1003
|
+ caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
|
1004
|
+
|
|
|
1005
|
+ // 新增日志
|
|
|
1006
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
|
|
1007
|
+
|
|
|
1008
|
+
|
|
|
1009
|
+ }
|
|
|
1010
|
+ }else {
|
|
|
1011
|
+ //提交仲裁结果
|
|
|
1012
|
+ int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecordselect);
|
|
|
1013
|
+
|
|
|
1014
|
+ if (i>0){
|
|
|
1015
|
+ //案件日志表里添加数据
|
|
|
1016
|
+ CaseLogRecord caseLogRecord = new CaseLogRecord();
|
|
|
1017
|
+ caseLogRecord.setCaseAppliId(caseApplication.getId());
|
|
|
1018
|
+ caseLogRecord.setCaseNode(caseApplication.getCaseStatus());
|
|
|
1019
|
+ if (createBy!=null){
|
|
|
1020
|
+ caseLogRecord.setCreateBy(createBy);
|
|
|
1021
|
+ }
|
|
|
1022
|
+ caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
|
|
1023
|
+
|
|
|
1024
|
+ // 新增日志
|
|
|
1025
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,"");
|
|
|
1026
|
+
|
|
|
1027
|
+ }
|
|
|
1028
|
+ }
|
|
|
1029
|
+
|
|
|
1030
|
+ //生成庭审笔录
|
|
|
1031
|
+ try {
|
|
|
1032
|
+ Map<String, Object> datas = new HashMap<>();
|
|
|
1033
|
+ Long id = caseApplication.getId();
|
|
|
1034
|
+ if (id == null) {
|
|
|
1035
|
+ return null;
|
|
|
1036
|
+ }
|
|
|
1037
|
+
|
|
|
1038
|
+ //获取仲裁记录表里的相关信息
|
|
|
1039
|
+ ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
|
|
1040
|
+ arbitrateRecord.setCaseAppliId(id);
|
|
|
1041
|
+ ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
|
|
1042
|
+
|
|
|
1043
|
+ //获取案件关联人信息
|
|
|
1044
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
1045
|
+ caseAffiliate.setCaseAppliId(id);
|
|
|
1046
|
+ List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
|
|
1047
|
+ if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
|
1048
|
+ for (CaseAffiliate affiliate : caseAffiliates) {
|
|
|
1049
|
+ //获取身份类型
|
|
|
1050
|
+ int identityType = affiliate.getIdentityType();
|
|
|
1051
|
+ if (identityType == 1) { //申请人
|
|
|
1052
|
+ datas.put("appName", affiliate.getName());
|
|
|
1053
|
+ datas.put("appIDNo", affiliate.getIdentityNum());
|
|
|
1054
|
+ datas.put("appAddress", affiliate.getContactAddress());
|
|
|
1055
|
+ datas.put("appAgentName", affiliate.getNameAgent());
|
|
|
1056
|
+ datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
|
|
|
1057
|
+ } else if (identityType == 2) { //被申请人
|
|
|
1058
|
+ datas.put("resName", affiliate.getName());
|
|
|
1059
|
+ datas.put("resIDNo", affiliate.getIdentityNum());
|
|
|
1060
|
+ datas.put("resAddress", affiliate.getContactAddress());
|
|
|
1061
|
+ datas.put("resAgentName", affiliate.getNameAgent());
|
|
|
1062
|
+ datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
|
|
|
1063
|
+ }
|
|
|
1064
|
+ }
|
|
|
1065
|
+ }
|
|
|
1066
|
+ String arbitratorName = caseApplication.getArbitratorName();
|
|
|
1067
|
+ datas.put("caseName", caseApplication.getCaseName());
|
|
|
1068
|
+ datas.put("arbitratorName", arbitratorName);
|
|
|
1069
|
+ Date hearDate = caseApplication.getHearDate();
|
|
|
1070
|
+ if (hearDate != null) {
|
|
|
1071
|
+ LocalDate localDate = hearDate.toInstant()
|
|
|
1072
|
+ .atZone(ZoneId.systemDefault())
|
|
|
1073
|
+ .toLocalDate();
|
|
|
1074
|
+ datas.put("hearYear", localDate.getYear());
|
|
|
1075
|
+ datas.put("hearMonths", localDate.getMonthValue());
|
|
|
1076
|
+ datas.put("hearDay", localDate.getDayOfMonth());
|
|
|
1077
|
+ } else {
|
|
|
1078
|
+ datas.put("hearYear", null);
|
|
|
1079
|
+ datas.put("hearMonths", null);
|
|
|
1080
|
+ datas.put("hearDay", null);
|
|
|
1081
|
+ }
|
|
|
1082
|
+ datas.put("appArbitrationClaims", caseApplication.getArbitratClaims());
|
|
|
1083
|
+ if (arbitrateRecord1 != null) {
|
|
|
1084
|
+ datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
|
|
|
1085
|
+ datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
|
|
1086
|
+ datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
|
|
|
1087
|
+ datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
|
|
|
1088
|
+ datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
|
|
|
1089
|
+ }
|
|
|
1090
|
+ datas.put("legalProvisions", "仲裁法");
|
|
|
1091
|
+ LocalDate now = LocalDate.now();
|
|
|
1092
|
+ String year = Integer.toString(now.getYear());
|
|
|
1093
|
+ String month = String.format("%02d", now.getMonthValue());
|
|
|
1094
|
+ String day = String.format("%02d", now.getDayOfMonth());
|
|
|
1095
|
+ datas.put("year", year);
|
|
|
1096
|
+ datas.put("months", month);
|
|
|
1097
|
+ datas.put("day", day);
|
|
|
1098
|
+ String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
|
|
|
1099
|
+// String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
|
|
|
1100
|
+ String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
|
|
1101
|
+// String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
|
|
|
1102
|
+ String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
|
|
1103
|
+ String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
|
|
1104
|
+ String resultFilePath = saveFolderPath + "/" + fileName;
|
|
|
1105
|
+ // 创建日期目录
|
|
|
1106
|
+ File saveFolder = new File(saveFolderPath);
|
|
|
1107
|
+ if (!saveFolder.exists()) {
|
|
|
1108
|
+ saveFolder.mkdirs();
|
|
|
1109
|
+ }
|
|
|
1110
|
+ Path sourcePath = new File(modalFilePath).toPath();
|
|
|
1111
|
+ Path destinationPath = new File(resultFilePath).toPath();
|
|
|
1112
|
+ Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
1113
|
+ String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
|
|
|
1114
|
+ String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
|
|
|
1115
|
+
|
|
|
1116
|
+// String savePath = saveFolderPath;
|
|
|
1117
|
+// saveName = fileName;
|
|
|
1118
|
+
|
|
|
1119
|
+ //将庭审笔录保存到附件表里
|
|
|
1120
|
+ CaseAttach caseAttach = CaseAttach.builder()
|
|
|
1121
|
+ .caseAppliId(id)
|
|
|
1122
|
+ .annexName(saveName)
|
|
|
1123
|
+ .annexPath(savePath)
|
|
|
1124
|
+ .annexType(7)
|
|
|
1125
|
+ .build();
|
|
|
1126
|
+ int i = caseAttachMapper.save(caseAttach);
|
|
|
1127
|
+ if (i > 0) {
|
|
|
1128
|
+ if (arbitrateRecord1 != null) {
|
|
|
1129
|
+ Integer annexId = caseAttach.getAnnexId();
|
|
|
1130
|
+ //将附件id保存到仲裁记录表里面
|
|
|
1131
|
+ arbitrateRecord1.setAnnexId(annexId);
|
|
|
1132
|
+ arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
|
|
|
1133
|
+ }
|
|
|
1134
|
+ }
|
|
|
1135
|
+ //获取案件详细信息
|
|
|
1136
|
+ CaseApplication caseApplicationSelct = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
1137
|
+ return AjaxResult.success(caseApplicationSelct);
|
|
|
1138
|
+ } catch (IOException e) {
|
|
|
1139
|
+ e.printStackTrace();
|
|
|
1140
|
+ return AjaxResult.error("生成庭审笔录异常");
|
|
|
1141
|
+ }
|
|
|
1142
|
+
|
|
|
1143
|
+ }
|
|
|
1144
|
+
|
|
971
|
1145
|
@Override
|
|
972
|
1146
|
@Transactional
|
|
973
|
1147
|
public int pendTralSure(CaseApplication caseApplication) {
|