|
@@ -3512,6 +3512,65 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data("成功!");
|
|
|
}
|
|
|
|
|
|
+// @PostMapping("/batchUploadExcelTab")
|
|
|
+// @ApiOperationSupport(order = 39)
|
|
|
+// @ApiOperation(value = "批量上传清表", notes = "传入id、fileList")
|
|
|
+// public R<Object> batchUploadExcelTab(@RequestParam Long id, @RequestPart("file") MultipartFile[] file) throws IOException {
|
|
|
+// if (ObjectUtil.isEmpty(id)) {
|
|
|
+// throw new ServiceException("获取节点信息失败");
|
|
|
+// }
|
|
|
+// if (file.length <= 0) {
|
|
|
+// throw new ServiceException("未获取到需要上传的文件信息");
|
|
|
+// }
|
|
|
+// ExcelTab excelTabParentNode = excelTabService.getBaseMapper().selectById(id);
|
|
|
+// List<ExcelTab> excelTabs = excelTabService.getBaseMapper().selectList(Wrappers.<ExcelTab>lambdaQuery().select(ExcelTab::getSort).eq(ExcelTab::getParentId, excelTabParentNode.getId()));
|
|
|
+// Optional<Integer> maxSort = excelTabs.stream().map(ExcelTab::getSort).max(Integer::compare);
|
|
|
+// int maxValue = 1;
|
|
|
+// if (maxSort.isPresent()) {
|
|
|
+// maxValue = maxSort.get();
|
|
|
+// }
|
|
|
+// for (MultipartFile fileDTO : file) {
|
|
|
+// if (ObjectUtil.isEmpty(fileDTO.getOriginalFilename())) {
|
|
|
+// throw new ServiceException("文件名不能为空");
|
|
|
+// }
|
|
|
+// if (!this.isExcelFormat(fileDTO.getOriginalFilename())) {
|
|
|
+// throw new ServiceException("文件名后缀不是.xlsx或者.xls格式,请重新填写");
|
|
|
+// }
|
|
|
+// if (!this.isExcelFile(fileDTO)) {
|
|
|
+// throw new ServiceException("【" + fileDTO.getOriginalFilename() + "】文件不是excel格式文件,上传终止");
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// R<BladeFile> bladeFile = iossClient.addFileInfo(fileDTO);
|
|
|
+// if (ObjectUtil.isNotEmpty(bladeFile.getData())) {
|
|
|
+// //创建节点,并上传excel文件到节点上
|
|
|
+// ExcelTab excelTabNode = new ExcelTab();
|
|
|
+// excelTabNode.setId(SnowFlakeUtil.getId());
|
|
|
+// excelTabNode.setParentId(excelTabParentNode.getId());
|
|
|
+// excelTabNode.setFileType(3); //不要上传按钮 默认=3
|
|
|
+// excelTabNode.setName(fileDTO.getOriginalFilename().split(".xls")[0]);
|
|
|
+// excelTabNode.setAlias(excelTabParentNode.getAlias() + "," + excelTabParentNode.getId());
|
|
|
+// excelTabNode.setFileUrl(bladeFile.getData().getLink());
|
|
|
+// excelTabNode.setExtension(fileDTO.getOriginalFilename());
|
|
|
+// excelTabNode.setCreateTime(new Date());
|
|
|
+// excelTabNode.setUpdateTime(new Date());
|
|
|
+// excelTabNode.setCreateUser(SecureUtil.getUserId());
|
|
|
+// excelTabNode.setUpdateUser(SecureUtil.getUserId());
|
|
|
+// excelTabNode.setCreateDept(SecureUtil.getUser().getDeptId().contains(",") ? Long.parseLong(SecureUtil.getUser().getDeptId().split(",")[0]) : Long.parseLong(SecureUtil.getUser().getDeptId()));
|
|
|
+// excelTabNode.setStatus(1);
|
|
|
+// excelTabNode.setIsDeleted(0);
|
|
|
+// excelTabNode.setTabType(excelTabParentNode.getTabType());
|
|
|
+// excelTabNode.setTenantId(SecureUtil.getTenantId());
|
|
|
+// excelTabNode.setSort(maxValue++);
|
|
|
+// excelTabService.save(excelTabNode);
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new ServiceException("【" + fileDTO.getOriginalFilename() + "】文件上传失败,上传终止" + e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return R.success("操作成功");
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
@PostMapping("/batchUploadExcelTab")
|
|
|
@ApiOperationSupport(order = 39)
|
|
|
@ApiOperation(value = "批量上传清表", notes = "传入id、fileList")
|
|
@@ -3529,43 +3588,25 @@ public class ExcelTabController extends BladeController {
|
|
|
if (maxSort.isPresent()) {
|
|
|
maxValue = maxSort.get();
|
|
|
}
|
|
|
- for (MultipartFile fileDTO : file) {
|
|
|
- if (ObjectUtil.isEmpty(fileDTO.getOriginalFilename())) {
|
|
|
- throw new ServiceException("文件名不能为空");
|
|
|
- }
|
|
|
- if (!this.isExcelFormat(fileDTO.getOriginalFilename())) {
|
|
|
- throw new ServiceException("文件名后缀不是.xlsx或者.xls格式,请重新填写");
|
|
|
- }
|
|
|
- if (!this.isExcelFile(fileDTO)) {
|
|
|
- throw new ServiceException("【" + fileDTO.getOriginalFilename() + "】文件不是excel格式文件,上传终止");
|
|
|
- }
|
|
|
- try {
|
|
|
- R<BladeFile> bladeFile = iossClient.addFileInfo(fileDTO);
|
|
|
- if (ObjectUtil.isNotEmpty(bladeFile.getData())) {
|
|
|
- //创建节点,并上传excel文件到节点上
|
|
|
- ExcelTab excelTabNode = new ExcelTab();
|
|
|
- excelTabNode.setId(SnowFlakeUtil.getId());
|
|
|
- excelTabNode.setParentId(excelTabParentNode.getId());
|
|
|
- excelTabNode.setFileType(3); //不要上传按钮 默认=3
|
|
|
- excelTabNode.setName(fileDTO.getOriginalFilename().split(".xls")[0]);
|
|
|
- excelTabNode.setAlias(excelTabParentNode.getAlias() + "," + excelTabParentNode.getId());
|
|
|
- excelTabNode.setFileUrl(bladeFile.getData().getLink());
|
|
|
- excelTabNode.setExtension(fileDTO.getOriginalFilename());
|
|
|
- excelTabNode.setCreateTime(new Date());
|
|
|
- excelTabNode.setUpdateTime(new Date());
|
|
|
- excelTabNode.setCreateUser(SecureUtil.getUserId());
|
|
|
- excelTabNode.setUpdateUser(SecureUtil.getUserId());
|
|
|
- excelTabNode.setCreateDept(SecureUtil.getUser().getDeptId().contains(",") ? Long.parseLong(SecureUtil.getUser().getDeptId().split(",")[0]) : Long.parseLong(SecureUtil.getUser().getDeptId()));
|
|
|
- excelTabNode.setStatus(1);
|
|
|
- excelTabNode.setIsDeleted(0);
|
|
|
- excelTabNode.setTabType(excelTabParentNode.getTabType());
|
|
|
- excelTabNode.setTenantId(SecureUtil.getTenantId());
|
|
|
- excelTabNode.setSort(maxValue++);
|
|
|
- excelTabService.save(excelTabNode);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("【" + fileDTO.getOriginalFilename() + "】文件上传失败,上传终止" + e.getMessage());
|
|
|
- }
|
|
|
+ for (MultipartFile fileDTO : file){
|
|
|
+ //创建节点,并上传excel文件到节点上
|
|
|
+ ExcelTab excelTabNode = new ExcelTab();
|
|
|
+ Long aLong = SnowFlakeUtil.getId();
|
|
|
+ excelTabNode.setId(aLong);
|
|
|
+ excelTabNode.setParentId(excelTabParentNode.getId());
|
|
|
+ excelTabNode.setFileType(3); //不要上传按钮 默认=3
|
|
|
+ excelTabNode.setName(fileDTO.getOriginalFilename().split(".xls")[0]);
|
|
|
+ excelTabNode.setAlias(excelTabParentNode.getAlias() + "," + excelTabParentNode.getId());
|
|
|
+ excelTabNode.setTabType(excelTabParentNode.getTabType());
|
|
|
+ excelTabNode.setTenantId(SecureUtil.getTenantId());
|
|
|
+ excelTabNode.setSort(++maxValue);
|
|
|
+ excelTabNode.setCreateTime(new Date());
|
|
|
+ excelTabNode.setUpdateTime(new Date());
|
|
|
+ excelTabNode.setCreateUser(SecureUtil.getUserId());
|
|
|
+ excelTabNode.setUpdateUser(SecureUtil.getUserId());
|
|
|
+ excelTabNode.setStatus(1);
|
|
|
+ excelTabService.save(excelTabNode);
|
|
|
+ this.putFileAttach(fileDTO,aLong);
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|