|
|
@@ -35,13 +35,14 @@ import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
|
35
|
35
|
import com.ruoyi.wisdomarbitrate.mapper.*;
|
|
36
|
36
|
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
37
|
37
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
|
|
38
|
+import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
|
38
|
39
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
39
|
40
|
import org.springframework.stereotype.Service;
|
|
40
|
41
|
import org.springframework.transaction.annotation.Transactional;
|
|
41
|
42
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
43
|
+import org.springframework.web.multipart.MultipartFile;
|
|
42
|
44
|
|
|
43
|
|
-import java.io.File;
|
|
44
|
|
-import java.io.IOException;
|
|
|
45
|
+import java.io.*;
|
|
45
|
46
|
import java.math.BigDecimal;
|
|
46
|
47
|
import java.nio.file.Files;
|
|
47
|
48
|
import java.nio.file.Path;
|
|
|
@@ -84,6 +85,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
84
|
85
|
private SealSignRecordMapper sealSignRecordMapper;
|
|
85
|
86
|
@Autowired
|
|
86
|
87
|
private CaseLogRecordMapper caseLogRecordMapper;
|
|
|
88
|
+ @Autowired
|
|
|
89
|
+ private CaseEvidenceDirectoryMapper caseEvidenceDirectoryMapper;
|
|
87
|
90
|
// 手机号正则
|
|
88
|
91
|
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}$");
|
|
89
|
92
|
|
|
|
@@ -247,6 +250,124 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
247
|
250
|
return caseApplicationMapper.updateCaseLockStatus(caseApplication.getId(),caseApplication.getLockStatus());
|
|
248
|
251
|
}
|
|
249
|
252
|
|
|
|
253
|
+ public void inputChangeToFile(InputStream instream, File file) {
|
|
|
254
|
+ try {
|
|
|
255
|
+ OutputStream outStr = new FileOutputStream(file);
|
|
|
256
|
+ int bytesRead = 0;
|
|
|
257
|
+ byte[] buffer = new byte[8192];
|
|
|
258
|
+ while ((bytesRead = instream.read(buffer, 0, 8192)) != -1) {
|
|
|
259
|
+ outStr.write(buffer, 0, bytesRead);
|
|
|
260
|
+ }
|
|
|
261
|
+ outStr.flush();
|
|
|
262
|
+ outStr.close();
|
|
|
263
|
+ instream.close();
|
|
|
264
|
+ } catch (Exception e) {
|
|
|
265
|
+ e.printStackTrace();
|
|
|
266
|
+ }
|
|
|
267
|
+ }
|
|
|
268
|
+
|
|
|
269
|
+ @Override
|
|
|
270
|
+ @Transactional
|
|
|
271
|
+ public AjaxResult uploadZipFile(MultipartFile file, Long id, String username, Long userId) {
|
|
|
272
|
+ if (file.isEmpty()) {
|
|
|
273
|
+ return AjaxResult.error("请选择要上传的文件");
|
|
|
274
|
+ }
|
|
|
275
|
+// String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
|
|
276
|
+ String targetPath = "F:\\testZip\\unzipFile";
|
|
|
277
|
+ File zipFile = null;
|
|
|
278
|
+ InputStream ins = null;
|
|
|
279
|
+ try {
|
|
|
280
|
+ ins = file.getInputStream();
|
|
|
281
|
+ zipFile = new File(file.getOriginalFilename());
|
|
|
282
|
+ inputChangeToFile(ins, zipFile);
|
|
|
283
|
+ } catch (IOException e) {
|
|
|
284
|
+ e.printStackTrace();
|
|
|
285
|
+ }
|
|
|
286
|
+ //解压缩上传的压缩包
|
|
|
287
|
+ UnZipFileUtils.unZipFile(zipFile,targetPath);
|
|
|
288
|
+
|
|
|
289
|
+ //得到解压缩的所有文件
|
|
|
290
|
+ String zipName = file.getOriginalFilename();
|
|
|
291
|
+ String zipPath = "F:\\testZip\\unzipFile\\"+zipName;
|
|
|
292
|
+// String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile"+zipName;
|
|
|
293
|
+ File dirUnzipPath = new File(zipPath);
|
|
|
294
|
+ List<File> allFiles = new ArrayList<>();
|
|
|
295
|
+ List<String> allFilestr = new ArrayList<>();
|
|
|
296
|
+ UnZipFileUtils.getFiles(dirUnzipPath,allFiles);
|
|
|
297
|
+ if(allFiles!=null&&allFiles.size()>0){
|
|
|
298
|
+ for (File fileIter : allFiles) {
|
|
|
299
|
+ System.out.println(fileIter.getAbsolutePath());
|
|
|
300
|
+ allFilestr.add(fileIter.getAbsolutePath());
|
|
|
301
|
+ }
|
|
|
302
|
+ }
|
|
|
303
|
+
|
|
|
304
|
+ if(allFilestr!=null&&allFilestr.size()>0){
|
|
|
305
|
+ for (String filestr : allFilestr) {
|
|
|
306
|
+ List<Integer> allindex = new ArrayList<>();
|
|
|
307
|
+ int indexKey = filestr.indexOf("\\");
|
|
|
308
|
+ allindex.add(indexKey);
|
|
|
309
|
+ while (indexKey != -1) {
|
|
|
310
|
+ indexKey = filestr.indexOf("\\", indexKey + 1);
|
|
|
311
|
+ allindex.add(indexKey);
|
|
|
312
|
+ }
|
|
|
313
|
+ if(allindex!=null&&allindex.size()>0){
|
|
|
314
|
+ for (int i = 0; i < allindex.size()-2; i++) {
|
|
|
315
|
+ //得到第2个 \ 和 第3个 \ 之间的目录 为一级(i+1)目录,
|
|
|
316
|
+ String substr = filestr.substring(allindex.get(i+1)+1,allindex.get(i+2));
|
|
|
317
|
+ Integer series = i + 1;
|
|
|
318
|
+ Integer idcaseEvidenceDirectory = null;
|
|
|
319
|
+ if(series==1){
|
|
|
320
|
+ CaseEvidenceDirectory caseEvidenceDirectory = new CaseEvidenceDirectory();
|
|
|
321
|
+ caseEvidenceDirectory.setEvidenceName(substr);
|
|
|
322
|
+ caseEvidenceDirectory.setSeries(series);
|
|
|
323
|
+
|
|
|
324
|
+ //caseEvidenceDirectory.setCaseid(id);
|
|
|
325
|
+ caseEvidenceDirectory.setCreateBy(username);
|
|
|
326
|
+ caseEvidenceDirectory.setCreateTime(new Date());
|
|
|
327
|
+
|
|
|
328
|
+ caseEvidenceDirectoryMapper.save(caseEvidenceDirectory);
|
|
|
329
|
+ idcaseEvidenceDirectory = caseEvidenceDirectory.getId();
|
|
|
330
|
+
|
|
|
331
|
+ }else {
|
|
|
332
|
+ CaseEvidenceDirectory caseEvidenceDirectory = new CaseEvidenceDirectory();
|
|
|
333
|
+ caseEvidenceDirectory.setEvidenceName(substr);
|
|
|
334
|
+ caseEvidenceDirectory.setSeries(series);
|
|
|
335
|
+
|
|
|
336
|
+ caseEvidenceDirectory.setParentId(idcaseEvidenceDirectory);
|
|
|
337
|
+
|
|
|
338
|
+ caseEvidenceDirectoryMapper.save(caseEvidenceDirectory);
|
|
|
339
|
+
|
|
|
340
|
+
|
|
|
341
|
+
|
|
|
342
|
+ }
|
|
|
343
|
+ //通过 案件id 和 目录表 的各个层级的 级数 和 目录名称 查询目录表
|
|
|
344
|
+ //判断这个级数的目录是否已经在目录表中存在,
|
|
|
345
|
+ //若存在,不用新建这个目录,
|
|
|
346
|
+ //若不存在,则新建这个目录
|
|
|
347
|
+ //保存到目录表
|
|
|
348
|
+
|
|
|
349
|
+
|
|
|
350
|
+
|
|
|
351
|
+ }
|
|
|
352
|
+ int lastIndex = allindex.size();
|
|
|
353
|
+ //得到 最后1个 \ 之后的目录 为文件名,
|
|
|
354
|
+ //保存到目录表
|
|
|
355
|
+ //保存到附件表
|
|
|
356
|
+
|
|
|
357
|
+ }
|
|
|
358
|
+
|
|
|
359
|
+
|
|
|
360
|
+
|
|
|
361
|
+ }
|
|
|
362
|
+
|
|
|
363
|
+
|
|
|
364
|
+
|
|
|
365
|
+ }
|
|
|
366
|
+
|
|
|
367
|
+ return AjaxResult.success();
|
|
|
368
|
+
|
|
|
369
|
+ }
|
|
|
370
|
+
|
|
250
|
371
|
private List<CaseLogRecord> getNofinishCasenode(Integer caseStatus) {
|
|
251
|
372
|
CaseLogRecord caseLogRecord1 = new CaseLogRecord();
|
|
252
|
373
|
caseLogRecord1.setCaseNodeName("立案审查");
|