|
@@ -14,13 +14,17 @@ import com.xy.enums.FileExportType;
|
|
|
import com.xy.mapper.FileExportMapper;
|
|
|
import com.xy.util.ExcelUtils;
|
|
|
import com.xy.util.FileUtils;
|
|
|
-import com.xy.utils.*;
|
|
|
+import com.xy.utils.AliOssUtil;
|
|
|
+import com.xy.utils.MybatisPlusQuery;
|
|
|
+import com.xy.utils.PageBean;
|
|
|
+import com.xy.utils.R;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.Cleanup;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
@@ -48,25 +52,7 @@ public class FileExportServiceImpl extends ServiceImpl<FileExportMapper, FileExp
|
|
|
|
|
|
private final FileUtils fileUtils;
|
|
|
|
|
|
- @Override
|
|
|
- @ApiOperation("对象查询")
|
|
|
- public R<FileExportDto.Vo> obj(FileExportDto.Vo vo) {
|
|
|
- FileExportDto.SelectList selectList = copy(FileExportDto.SelectList.class, vo);
|
|
|
- List<FileExportDto.Vo> list = list(selectList).getData();
|
|
|
- if (Emptys.check(list)) {
|
|
|
- return R.ok(list.get(0));
|
|
|
- }
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @ApiOperation("集合查询")
|
|
|
- public R<List<FileExportDto.Vo>> list(FileExportDto.SelectList selectList) {
|
|
|
- LambdaQueryWrapper<FileExport> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(selectList, FileExport.class).build();
|
|
|
- List<FileExport> list = list(lambdaQueryWrapper);
|
|
|
- return R.ok(copy(FileExportDto.Vo.class, list));
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
@ApiOperation("分页查询")
|
|
|
public R<PageBean<FileExportDto.Vo>> page(FileExportDto.Page page) {
|
|
@@ -84,13 +70,6 @@ public class FileExportServiceImpl extends ServiceImpl<FileExportMapper, FileExp
|
|
|
return R.ok(BeanUtil.copyProperties(saveInfo, FileExportDto.Vo.class));
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- @ApiOperation("修改")
|
|
|
- public R update(@Validated FileExportDto.Update update) {
|
|
|
- FileExport updateInfo = copy(FileExport.class, update);
|
|
|
- updateById(updateInfo);
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
@ApiOperation("更新文件导出状态")
|
|
@@ -151,4 +130,14 @@ public class FileExportServiceImpl extends ServiceImpl<FileExportMapper, FileExp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("删除excel")
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R<Boolean> del(FileExportDto.Del del) {
|
|
|
+ List<Long> ids = del.getIds();
|
|
|
+ List<FileExport> fileExports = this.listByIds(ids);
|
|
|
+ fileExports.forEach(f -> AliOssUtil.delete(f.getFileName()));
|
|
|
+ return R.ok(this.removeBatchByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
}
|