会计账簿,会计报表,上传优化,借阅新增案卷号非空判断,库房修改可修改库房编码和客房名称

new
parent 337f88cc81
commit 07e29058d1

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.accounting.controller.admin.accountingbook; package cn.iocoder.yudao.module.accounting.controller.admin.accountingbook;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
@ -75,30 +76,21 @@ public class AccountingBookController {
@PostMapping("/upload") @PostMapping("/upload")
@Operation(summary = "上传会计账簿") @Operation(summary = "上传会计账簿")
@PreAuthorize("@ss.hasPermission('archives:accounting-book:create')") @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 { try {
//TODO minio配置 后续修改 String uri = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
S3FileClientConfig config = new S3FileClientConfig(); AccountingBookCreateReqVO vo = new AccountingBookCreateReqVO();
// 配置成你自己的 vo.setCompany(company).setCompanyId(companyId).setType(type).setYear(year).setPeriod(period).setUri(uri).setName(multipartFile.getOriginalFilename());
config.setAccessKey("minioadmin"); this.createAccountingBook(vo);
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);
return uri; return uri;
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
return "vo"; return "上传失败";
} }
//TODO minio上传函数 后续封装为公用方法 //TODO minio上传函数 后续封装为公用方法

@ -53,4 +53,10 @@ public class AccountingBookBaseVO {
@Schema(description = "密码区") @Schema(description = "密码区")
private String password; private String password;
@Schema(description = "文件地址")
private String Uri;
@Schema(description = "文件名称")
private String name;
} }

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport; 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.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.file.core.client.s3.S3FileClient; 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.accountingbook.AccountingBookDO;
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO; import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
import cn.iocoder.yudao.module.accounting.service.accountingreport.AccountingReportService; 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 cn.iocoder.yudao.module.setting.service.passwords.PasswordsService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -45,12 +47,10 @@ public class AccountingReportController {
@Resource @Resource
private AccountingReportService accountingReportService; private AccountingReportService accountingReportService;
@Resource
private RedisTemplate redisTemplate;
@Resource @Resource
private PasswordsService passwordsService; private PasswordsService passwordsService;
@Resource
private FileService fileService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建会计报表") @Operation(summary = "创建会计报表")
@ -65,30 +65,20 @@ public class AccountingReportController {
@PostMapping("/upload") @PostMapping("/upload")
@Operation(summary = "上传会计报表") @Operation(summary = "上传会计报表")
@PreAuthorize("@ss.hasPermission('archives:accounting-report:create')") @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 { try {
//TODO minio配置 后续修改 String uri = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
S3FileClientConfig config = new S3FileClientConfig(); AccountingReportCreateReqVO vo = new AccountingReportCreateReqVO();
// 配置成你自己的 vo.setCompany(company).setCompanyId(companyId).setType(type).setYear(year).setPeriod(period).setUrl(uri).setName(multipartFile.getOriginalFilename());
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);
return uri; return uri;
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
return "vo"; return "上传失败";
} }
//TODO minio上传函数 后续封装为公用方法 //TODO minio上传函数 后续封装为公用方法

@ -42,24 +42,6 @@ public class AccountingBookServiceImpl implements AccountingBookService {
public AccountingBookDO createAccountingBook(AccountingBookCreateReqVO createReqVO) { public AccountingBookDO createAccountingBook(AccountingBookCreateReqVO createReqVO) {
// 插入 // 插入
AccountingBookDO accountingBook = AccountingBookConvert.INSTANCE.convert(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); accountingBookMapper.insert(accountingBook);
// 返回 // 返回
return accountingBook; return accountingBook;

@ -37,14 +37,6 @@ public class AccountingReportServiceImpl implements AccountingReportService {
public Long createAccountingReport(AccountingReportCreateReqVO createReqVO) { public Long createAccountingReport(AccountingReportCreateReqVO createReqVO) {
// 插入 // 插入
AccountingReportDO accountingReport = AccountingReportConvert.INSTANCE.convert(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); accountingReportMapper.insert(accountingReport);
// 返回 // 返回
return accountingReport.getId(); return accountingReport.getId();

@ -39,6 +39,9 @@ public class BorrowApplyServiceImpl implements BorrowApplyService {
@Override @Override
@Transactional @Transactional
public CommonResult<BorrowApplyDO> createBorrowApply(BorrowApplyCreateReqVO createReqVO) { public CommonResult<BorrowApplyDO> createBorrowApply(BorrowApplyCreateReqVO createReqVO) {
if (StringUtils.isNull(createReqVO.getRecordId())){
return CommonResult.error("案卷号不能为空");
}
// 插入 // 插入
BorrowApplyDO borrowApply = BorrowApplyConvert.INSTANCE.convert(createReqVO); BorrowApplyDO borrowApply = BorrowApplyConvert.INSTANCE.convert(createReqVO);
//修改借阅状态 //修改借阅状态

@ -67,20 +67,20 @@ public class DepotController {
@Operation(summary = "更新库房管理") @Operation(summary = "更新库房管理")
@PreAuthorize("@ss.hasPermission('setting:depot:update')") @PreAuthorize("@ss.hasPermission('setting:depot:update')")
public CommonResult<Boolean> updateDepot(@Valid @RequestBody DepotUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateDepot(@Valid @RequestBody DepotUpdateReqVO updateReqVO) {
DepotExportReqVO depotExportReqVO = new DepotExportReqVO(); // DepotExportReqVO depotExportReqVO = new DepotExportReqVO();
//不能重复 // //不能重复
depotExportReqVO.setCode(updateReqVO.getCode()); // depotExportReqVO.setCode(updateReqVO.getCode());
List<DepotDO> depotList = depotService.getDepotList(depotExportReqVO); // List<DepotDO> depotList = depotService.getDepotList(depotExportReqVO);
if (depotList.size()>0){ // if (depotList.size()>0){
return error("库房编码不能重复!"); // return error("库房编码不能重复!");
} // }
//不能重复 // //不能重复
depotExportReqVO.setCode(null); // depotExportReqVO.setCode(null);
depotExportReqVO.setName(updateReqVO.getName()); // depotExportReqVO.setName(updateReqVO.getName());
List<DepotDO> organizationList2 = depotService.getDepotList(depotExportReqVO); // List<DepotDO> organizationList2 = depotService.getDepotList(depotExportReqVO);
if (organizationList2.size()>0){ // if (organizationList2.size()>0){
return error("库房名称不能重复!"); // return error("库房名称不能重复!");
} // }
depotService.updateDepot(updateReqVO); depotService.updateDepot(updateReqVO);
return success(true); return success(true);
} }

Loading…
Cancel
Save