Commit 390a7182c825edea8b3395a3d318e880f34ef833
1 parent
5cf654e4c7
Exists in
dev
#fix:新增课程视频删除功能,优化分片上传逻辑
Showing 5 changed files with 78 additions and 2 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/FileUtils.java
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
390a718
... | ... | @@ -498,6 +498,45 @@ |
498 | 498 | //his病人ID |
499 | 499 | private String patientHId; |
500 | 500 | |
501 | + //血糖筛查结果 | |
502 | + private String glucm;//空腹 | |
503 | + private String gluthree;//60分钟血糖 | |
504 | + private String glufour;//120分钟血糖 | |
505 | + //产筛结果 | |
506 | + private String nipt;//唐氏筛查/无创DNA检测 | |
507 | + | |
508 | + public String getGlucm() { | |
509 | + return glucm; | |
510 | + } | |
511 | + | |
512 | + public void setGlucm(String glucm) { | |
513 | + this.glucm = glucm; | |
514 | + } | |
515 | + | |
516 | + public String getGluthree() { | |
517 | + return gluthree; | |
518 | + } | |
519 | + | |
520 | + public void setGluthree(String gluthree) { | |
521 | + this.gluthree = gluthree; | |
522 | + } | |
523 | + | |
524 | + public String getGlufour() { | |
525 | + return glufour; | |
526 | + } | |
527 | + | |
528 | + public void setGlufour(String glufour) { | |
529 | + this.glufour = glufour; | |
530 | + } | |
531 | + | |
532 | + public String getNipt() { | |
533 | + return nipt; | |
534 | + } | |
535 | + | |
536 | + public void setNipt(String nipt) { | |
537 | + this.nipt = nipt; | |
538 | + } | |
539 | + | |
501 | 540 | public String getVillageId() { |
502 | 541 | return villageId; |
503 | 542 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
View file @
390a718
... | ... | @@ -662,6 +662,14 @@ |
662 | 662 | } |
663 | 663 | |
664 | 664 | |
665 | + @RequestMapping(value = "/deleteVideo", method = RequestMethod.POST) | |
666 | + @ResponseBody | |
667 | + public BaseResponse deleteVideo(@RequestParam(value="fileName") String fileName){ | |
668 | + return bookbuildingFacade.deleteVideo(fileName); | |
669 | + | |
670 | + } | |
671 | + | |
672 | + | |
665 | 673 | /** |
666 | 674 | * 图片上次 |
667 | 675 | * |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
390a718
... | ... | @@ -3463,6 +3463,30 @@ |
3463 | 3463 | return patientId; |
3464 | 3464 | } |
3465 | 3465 | |
3466 | + public BaseResponse deleteVideo(String fileName){ | |
3467 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
3468 | + try { | |
3469 | + String arrays[]= fileName.split("/id_photo"); | |
3470 | + if (arrays.length>1){ | |
3471 | + File file = new File(BASE_IMG_PATH +arrays[1]); | |
3472 | + file.delete(); | |
3473 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
3474 | + objectResponse.setErrormsg("成功"); | |
3475 | + return objectResponse; | |
3476 | + }else { | |
3477 | + objectResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
3478 | + objectResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
3479 | + return objectResponse; | |
3480 | + } | |
3481 | + }catch (Exception e){ | |
3482 | + ExceptionUtils.catchException(e, "上传文件发生异常"); | |
3483 | + objectResponse.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
3484 | + objectResponse.setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
3485 | + return objectResponse; | |
3486 | + } | |
3487 | + | |
3488 | + } | |
3489 | + | |
3466 | 3490 | public BaseResponse uploadVideo(String fileName, |
3467 | 3491 | MultipartFile file, |
3468 | 3492 | int chunk, int chunks) { |
... | ... | @@ -3477,6 +3501,7 @@ |
3477 | 3501 | tempsDir.mkdirs(); |
3478 | 3502 | } |
3479 | 3503 | //储存为临时文件 |
3504 | + System.out.println(tempsDir.getAbsolutePath()+"/"+fileName+".part"+ chunk); | |
3480 | 3505 | File tempFile = new File(tempsDir.getAbsolutePath()+"/"+fileName+".part"+ chunk); |
3481 | 3506 | file.transferTo(tempFile); |
3482 | 3507 | //检查分片是否下载完成 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
390a718
... | ... | @@ -213,6 +213,7 @@ |
213 | 213 | Map<String,String> result = getWeightRangeIsNormal(patients, pw); |
214 | 214 | pw.setIsNormal(result.get("isNormal")); |
215 | 215 | pw.setIsUp(Integer.parseInt(result.get("isUp"))); |
216 | + pw.setType(patients.getType()); | |
216 | 217 | if(null!=patientWeight.getIsPrint()){ |
217 | 218 | pw.setIsPrint(patientWeight.getIsPrint()); |
218 | 219 | } |
... | ... | @@ -256,6 +257,7 @@ |
256 | 257 | } else { |
257 | 258 | patientWeight.setOperaterId(userId.toString()); |
258 | 259 | patientWeight.setModified(new Date()); |
260 | + patientWeight.setType(patients.getType()); | |
259 | 261 | patientWeightService2.update(Query.query(Criteria.where("id").is(patientWeight.getId())), patientWeight); |
260 | 262 | return RespBuilder.buildSuccess(patientWeight.getId()); |
261 | 263 | } |
... | ... | @@ -1405,6 +1407,7 @@ |
1405 | 1407 | dayWeights2.add(m); |
1406 | 1408 | } |
1407 | 1409 | pw.setDayWeights2(dayWeights2); |
1410 | + pw.setType(patients.getType()); | |
1408 | 1411 | pw.setModified(new Date()); |
1409 | 1412 | patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); |
1410 | 1413 | return RespBuilder.buildSuccess(pw); |
... | ... | @@ -1427,6 +1430,7 @@ |
1427 | 1430 | patientWeight.setBmi(getBmi(patientWeight.getBeforeWeight(), patientWeight.getBeforeHeight())); |
1428 | 1431 | } |
1429 | 1432 | patientWeight.setYn("1"); |
1433 | + patientWeight.setType(patients.getType()); | |
1430 | 1434 | patientWeight.setPid(patients.getPid()); |
1431 | 1435 | patientWeight.setDayWeights(dayWeights); |
1432 | 1436 | patientWeight.setId(null); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/FileUtils.java
View file @
390a718
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | * @param chunks |
20 | 20 | * @return |
21 | 21 | */ |
22 | - public int successChunks(String fileName,int chunks){ | |
22 | + public synchronized int successChunks(String fileName,int chunks){ | |
23 | 23 | int chunksNow = successChunksCount.get(fileName)==null ? 0 : successChunksCount.get(fileName); |
24 | 24 | chunksNow ++; |
25 | 25 | if(chunks==chunksNow){ |
... | ... | @@ -41,6 +41,7 @@ |
41 | 41 | */ |
42 | 42 | public boolean mergeChunks(String sourceDirPath, |
43 | 43 | String destDirPath,String fileName,int chunks) throws Exception{ |
44 | + | |
44 | 45 | //创建目标目录 |
45 | 46 | File destDir = new File(destDirPath); |
46 | 47 | if(!destDir.exists()){ |
... | ... | @@ -53,7 +54,6 @@ |
53 | 54 | //循环将每个分片的数据写入目标文件 |
54 | 55 | byte[] fileBuffer = new byte[1024];//文件读写缓存 |
55 | 56 | int readBytesLength = 0;//每次读取字节数 |
56 | - System.out.println(("开始合并文件="+fileName)); | |
57 | 57 | for(int i=0; i<chunks; i++){ |
58 | 58 | File sourceFile = new File(sourceDirPath+"/"+fileName+".part"+i); |
59 | 59 | BufferedInputStream sourceInputStream = |