From 07e29058d17133262a710c7118383e946a5ba4f2 Mon Sep 17 00:00:00 2001 From: "LAPTOP-0SF788NU\\admin" <3306174053@qq.com> Date: Thu, 2 Nov 2023 14:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=A1=E8=B4=A6=E7=B0=BF,=E4=BC=9A?= =?UTF-8?q?=E8=AE=A1=E6=8A=A5=E8=A1=A8,=E4=B8=8A=E4=BC=A0=E4=BC=98?= =?UTF-8?q?=E5=8C=96,=E5=80=9F=E9=98=85=E6=96=B0=E5=A2=9E=E6=A1=88?= =?UTF-8?q?=E5=8D=B7=E5=8F=B7=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD,?= =?UTF-8?q?=E5=BA=93=E6=88=BF=E4=BF=AE=E6=94=B9=E5=8F=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BA=93=E6=88=BF=E7=BC=96=E7=A0=81=E5=92=8C=E5=AE=A2=E6=88=BF?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AccountingBookController.java | 30 ++++++---------- .../vo/AccountingBookBaseVO.java | 6 ++++ .../AccountingReportController.java | 36 +++++++------------ .../AccountingBookServiceImpl.java | 18 ---------- .../AccountingReportServiceImpl.java | 8 ----- .../borrowapply/BorrowApplyServiceImpl.java | 3 ++ .../admin/depot/DepotController.java | 28 +++++++-------- 7 files changed, 47 insertions(+), 82 deletions(-) diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java index f785d744..8352339f 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/AccountingBookController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.accounting.controller.admin.accountingbook; +import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; @@ -75,30 +76,21 @@ public class AccountingBookController { @PostMapping("/upload") @Operation(summary = "上传会计账簿") @PreAuthorize("@ss.hasPermission('archives:accounting-book:create')") - public String uploadAccountingBook(@RequestPart("file") MultipartFile multipartFile,@RequestParam("type") String type) { + public String uploadAccountingBook(@RequestPart("file") MultipartFile multipartFile,@RequestParam("type") String type, + @RequestParam("companyId") Long companyId, + @RequestParam("company") String company, + @RequestParam("year") String year, + @RequestParam("period") String period) { try { - //TODO minio配置 后续修改 - S3FileClientConfig config = new S3FileClientConfig(); - // 配置成你自己的 - config.setAccessKey("minioadmin"); - config.setAccessSecret("minioadmin"); - config.setBucket("ktg-mes"); - config.setDomain(null); - // 默认 9000 endpoint - config.setEndpoint("https://www.lyrfp.com"); - - // 执行上传 - String uri = testExecuteUpload(config, multipartFile); -// String uri = fileService.createFile(multipartFile.getOriginalFilename(), multipartFile.getOriginalFilename(), multipartFile.getBytes()); - //加入redis缓存 - redisTemplate.boundValueOps("fileUrlKey").set(uri); - redisTemplate.boundValueOps("fileKeyName").set(multipartFile.getOriginalFilename()); - redisTemplate.boundValueOps("fileKeyType").set(type); + String uri = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream())); + AccountingBookCreateReqVO vo = new AccountingBookCreateReqVO(); + vo.setCompany(company).setCompanyId(companyId).setType(type).setYear(year).setPeriod(period).setUri(uri).setName(multipartFile.getOriginalFilename()); + this.createAccountingBook(vo); return uri; } catch (Exception e){ e.printStackTrace(); } - return "vo"; + return "上传失败"; } //TODO minio上传函数 后续封装为公用方法 diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/vo/AccountingBookBaseVO.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/vo/AccountingBookBaseVO.java index eb5eaee5..5cb7dfbb 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/vo/AccountingBookBaseVO.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingbook/vo/AccountingBookBaseVO.java @@ -53,4 +53,10 @@ public class AccountingBookBaseVO { @Schema(description = "密码区") private String password; + + @Schema(description = "文件地址") + private String Uri; + + @Schema(description = "文件名称") + private String name; } diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java index 35f83c7c..bc95a9c0 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/controller/admin/accountingreport/AccountingReportController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport; +import cn.hutool.core.io.IoUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.file.core.client.s3.S3FileClient; @@ -12,6 +13,7 @@ import cn.iocoder.yudao.module.accounting.convert.accountingreport.AccountingRep import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingbook.AccountingBookDO; import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO; import cn.iocoder.yudao.module.accounting.service.accountingreport.AccountingReportService; +import cn.iocoder.yudao.module.infra.service.file.FileService; import cn.iocoder.yudao.module.setting.service.passwords.PasswordsService; import com.alibaba.fastjson.JSONObject; import org.springframework.data.redis.core.RedisTemplate; @@ -45,12 +47,10 @@ public class AccountingReportController { @Resource private AccountingReportService accountingReportService; - - @Resource - private RedisTemplate redisTemplate; - @Resource private PasswordsService passwordsService; + @Resource + private FileService fileService; @PostMapping("/create") @Operation(summary = "创建会计报表") @@ -65,30 +65,20 @@ public class AccountingReportController { @PostMapping("/upload") @Operation(summary = "上传会计报表") @PreAuthorize("@ss.hasPermission('archives:accounting-report:create')") - public String uploadAccountingBook(@RequestPart("file") MultipartFile multipartFile, @RequestParam("type") String type) { + public String uploadAccountingBook(@RequestPart("file") MultipartFile multipartFile, @RequestParam("type") String type, + @RequestParam("companyId") Long companyId, + @RequestParam("company") String company, + @RequestParam("year") String year, + @RequestParam("period") String period) { try { - //TODO minio配置 后续修改 - S3FileClientConfig config = new S3FileClientConfig(); - // 配置成你自己的 - config.setAccessKey("minioadmin"); - config.setAccessSecret("minioadmin"); - config.setBucket("ktg-mes"); - config.setDomain(null); - // 默认 9000 endpoint - config.setEndpoint("https://www.lyrfp.com"); - - // 执行上传 - String uri = testExecuteUpload(config, multipartFile); -// String uri = fileService.createFile(multipartFile.getOriginalFilename(), multipartFile.getOriginalFilename(), multipartFile.getBytes()); - //加入redis缓存 - redisTemplate.boundValueOps("reportFileUrlKey").set(uri); - redisTemplate.boundValueOps("reportFileKeyName").set(multipartFile.getOriginalFilename()); - redisTemplate.boundValueOps("reportFileKeyType").set(type); + String uri = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream())); + AccountingReportCreateReqVO vo = new AccountingReportCreateReqVO(); + vo.setCompany(company).setCompanyId(companyId).setType(type).setYear(year).setPeriod(period).setUrl(uri).setName(multipartFile.getOriginalFilename()); return uri; } catch (Exception e){ e.printStackTrace(); } - return "vo"; + return "上传失败"; } //TODO minio上传函数 后续封装为公用方法 diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingbook/AccountingBookServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingbook/AccountingBookServiceImpl.java index 707fc113..01bff390 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingbook/AccountingBookServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingbook/AccountingBookServiceImpl.java @@ -42,24 +42,6 @@ public class AccountingBookServiceImpl implements AccountingBookService { public AccountingBookDO createAccountingBook(AccountingBookCreateReqVO createReqVO) { // 插入 AccountingBookDO accountingBook = AccountingBookConvert.INSTANCE.convert(createReqVO); -// if (ObjectUtil.isNotNull(accountingBook)){ -// redisTemplate.boundValueOps("Company").set(createReqVO.getCompany()); -// redisTemplate.boundValueOps("Year").set(createReqVO.getYear()); -// redisTemplate.boundValueOps("Period").set(createReqVO.getPeriod()); -// } -// accountingBook.setCompany((String) redisTemplate.boundValueOps("Company").get()); -// accountingBook.setYear((String) redisTemplate.boundValueOps("Year").get()); -// accountingBook.setPeriod((String) redisTemplate.boundValueOps("Period").get()); - //如果要优化可以改成redis存储一个包含 uri name type字段的对象 也可以查询 infra_file 表获得 uri地址和文件名称 redis只缓存type字段 - String uri =(String) redisTemplate.boundValueOps("fileUrlKey").get(); - String name =(String) redisTemplate.boundValueOps("fileKeyName").get(); - String type =(String) redisTemplate.boundValueOps("fileKeyType").get(); - if (ObjectUtil.isNotNull(uri) && ObjectUtil.isNotNull(name) && ObjectUtil.isNotNull(type)){ - accountingBook.setUri(uri); - accountingBook.setName(name); - accountingBook.setType(type); - - } accountingBookMapper.insert(accountingBook); // 返回 return accountingBook; diff --git a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingreport/AccountingReportServiceImpl.java b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingreport/AccountingReportServiceImpl.java index b48a2ef0..5785108c 100644 --- a/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingreport/AccountingReportServiceImpl.java +++ b/yudao-module-accounting/yudao-module-accounting-biz/src/main/java/cn/iocoder/yudao/module/accounting/service/accountingreport/AccountingReportServiceImpl.java @@ -37,14 +37,6 @@ public class AccountingReportServiceImpl implements AccountingReportService { public Long createAccountingReport(AccountingReportCreateReqVO createReqVO) { // 插入 AccountingReportDO accountingReport = AccountingReportConvert.INSTANCE.convert(createReqVO); - String uri =(String) redisTemplate.boundValueOps("reportFileUrlKey").get(); - String name =(String) redisTemplate.boundValueOps("reportFileKeyName").get(); - String type =(String) redisTemplate.boundValueOps("reportFileKeyType").get(); - if (ObjectUtil.isNotNull(uri) && ObjectUtil.isNotNull(name) && ObjectUtil.isNotNull(type)){ - accountingReport.setUrl(uri); - accountingReport.setName(name); - accountingReport.setType(type); - } accountingReportMapper.insert(accountingReport); // 返回 return accountingReport.getId(); diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java index 12e42f32..7d9b55db 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java @@ -39,6 +39,9 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { @Override @Transactional public CommonResult createBorrowApply(BorrowApplyCreateReqVO createReqVO) { + if (StringUtils.isNull(createReqVO.getRecordId())){ + return CommonResult.error("案卷号不能为空"); + } // 插入 BorrowApplyDO borrowApply = BorrowApplyConvert.INSTANCE.convert(createReqVO); //修改借阅状态 diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/depot/DepotController.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/depot/DepotController.java index e54d8e56..3cfc54e5 100644 --- a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/depot/DepotController.java +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/controller/admin/depot/DepotController.java @@ -67,20 +67,20 @@ public class DepotController { @Operation(summary = "更新库房管理") @PreAuthorize("@ss.hasPermission('setting:depot:update')") public CommonResult updateDepot(@Valid @RequestBody DepotUpdateReqVO updateReqVO) { - DepotExportReqVO depotExportReqVO = new DepotExportReqVO(); - //不能重复 - depotExportReqVO.setCode(updateReqVO.getCode()); - List depotList = depotService.getDepotList(depotExportReqVO); - if (depotList.size()>0){ - return error("库房编码不能重复!"); - } - //不能重复 - depotExportReqVO.setCode(null); - depotExportReqVO.setName(updateReqVO.getName()); - List organizationList2 = depotService.getDepotList(depotExportReqVO); - if (organizationList2.size()>0){ - return error("库房名称不能重复!"); - } +// DepotExportReqVO depotExportReqVO = new DepotExportReqVO(); +// //不能重复 +// depotExportReqVO.setCode(updateReqVO.getCode()); +// List depotList = depotService.getDepotList(depotExportReqVO); +// if (depotList.size()>0){ +// return error("库房编码不能重复!"); +// } +// //不能重复 +// depotExportReqVO.setCode(null); +// depotExportReqVO.setName(updateReqVO.getName()); +// List organizationList2 = depotService.getDepotList(depotExportReqVO); +// if (organizationList2.size()>0){ +// return error("库房名称不能重复!"); +// } depotService.updateDepot(updateReqVO); return success(true); }