|
@@ -108,7 +108,83 @@ ArchiveFileAutoController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- archive.setAutoFileSort(l + archive.getAutoFileSort());
|
|
|
+ //新增不排序
|
|
|
+ //archive.setAutoFileSort(archive.getAutoFileSort());
|
|
|
+ //待修改
|
|
|
+ archive.setIsDeleted(0);
|
|
|
+ archive.setIsArchive(1);
|
|
|
+ archive.setIsAutoFile(1);
|
|
|
+ if(saveVos.getList() != null && saveVos.getList().size()>0 && saveVos.getList().get(0).getFileSize() != null) {
|
|
|
+ archive.setFileSize(saveVos.getList().get(0).getFileSize());
|
|
|
+ }
|
|
|
+ archivesAutoService.save(archive);
|
|
|
+ } else {
|
|
|
+ archivesAutoService.updateById(archive);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+ return R.data(true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量新增
|
|
|
+ */
|
|
|
+ @PostMapping("/batchSortSave")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "批量新增")
|
|
|
+ public R<Boolean> batchSortSave(@RequestBody ArchivesAutoVO archiveList) {
|
|
|
+ try {
|
|
|
+ for (ArchivesAutoVO archive : archiveList.getList()) {
|
|
|
+ if (archive.getId() == null) {
|
|
|
+
|
|
|
+ archive.setId(SnowFlakeUtil.getId());
|
|
|
+ int l = (int) System.currentTimeMillis();
|
|
|
+ List<ArchivesAutoVO.ApprovalFile> saveList = archive.getApprovalFileList();
|
|
|
+ ArchiveFileVO saveVos = new ArchiveFileVO();
|
|
|
+ Integer pageN = 0;
|
|
|
+ if (saveList != null && saveList.size() > 0) {
|
|
|
+ int i = 1;
|
|
|
+ List<ArchiveFileVO> list = new ArrayList<>();
|
|
|
+ for (ArchivesAutoVO.ApprovalFile approvalFile : saveList) {
|
|
|
+ ArchiveFileVO saveVo = BeanUtil.copy(approvalFile, ArchiveFileVO.class);
|
|
|
+ saveVo.setSort(l + i);
|
|
|
+ saveVo.setIsAutoFile(1);
|
|
|
+ saveVo.setStatus(new Integer("0").equals(saveVo.getIsApproval()) ? 2 : 0);
|
|
|
+ saveVo.setIsCertification(new Integer("0").equals(saveVo.getIsNeedCertification()) ? 1 : 0);
|
|
|
+ saveVo.setArchiveId(archive.getId());
|
|
|
+ saveVo.setOriginId(archive.getId());
|
|
|
+ if (saveVo.getFileUrl() != null && saveVo.getFileUrl().lastIndexOf(".") > -1
|
|
|
+ && (saveVo.getFileUrl().lastIndexOf(".") + 1) < saveVo.getFileUrl().length()) {
|
|
|
+ String name = saveVo.getFileUrl().substring(saveVo.getFileUrl().lastIndexOf(".") + 1);
|
|
|
+ saveVo.setFileType((long) FileUtils.getFileType(name));
|
|
|
+ }
|
|
|
+ saveVo.setSourceType(2);
|
|
|
+ saveVo.setProjectId(archive.getProjectId() == null ? "" : archive.getProjectId().toString());
|
|
|
+ saveVo.setContractId(archive.getContractId() == null ? "" : archive.getContractId().toString());
|
|
|
+ list.add(saveVo);
|
|
|
+ if (saveVo.getFilePage() != null && !saveVo.getFilePage().equals("")) {
|
|
|
+ pageN = pageN + saveVo.getFilePage();
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ saveVos.setList(list);
|
|
|
+ }
|
|
|
+ this.archiveFileClient.saveArchiveFile(saveVos);
|
|
|
+ archive.setFileN(saveVos.getSize());
|
|
|
+ archive.setPageN(pageN);
|
|
|
+ List<ArchiveTreeContract> archiveTreeContracts = this.archiveTreeContractClient.queryAllChildByAncestors(archive.getNodeId()+"", archive.getContractId() == null ? null : archive.getContractId());
|
|
|
+ if (archiveTreeContracts != null && archiveTreeContracts.size() > 0) {
|
|
|
+ archive.setTreeSort(archiveTreeContracts.get(0).getTreeSort());
|
|
|
+ if (archiveTreeContracts.get(0).getStorageType() != null) {
|
|
|
+ archive.setCarrierType(archiveTreeContracts.get(0).getStorageType().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ archive.setAutoFileSort(archive.getAutoFileSort());
|
|
|
//待修改
|
|
|
archive.setIsDeleted(0);
|
|
|
archive.setIsArchive(1);
|