From 81f7d381c300f6b0a22c00f98517b2619d0094f4 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期三, 23 七月 2025 16:00:27 +0800 Subject: [PATCH] yys 释放javaWork资源路径 --- src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java index a85755e..b6c43ed 100644 --- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java +++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java @@ -10,11 +10,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.mapper.CustomerMapper; import com.ruoyi.basic.pojo.Customer; +import com.ruoyi.common.enums.FileNameType; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.other.mapper.TempFileMapper; import com.ruoyi.other.pojo.TempFile; +import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper; +import com.ruoyi.production.pojo.SalesLedgerScheduling; import com.ruoyi.project.system.domain.SysDept; import com.ruoyi.project.system.mapper.SysDeptMapper; import com.ruoyi.sales.dto.MonthlyAmountDto; @@ -74,6 +77,8 @@ private final InvoiceLedgerMapper invoiceLedgerMapper; + private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; + @Autowired private SysDeptMapper sysDeptMapper; @@ -102,6 +107,7 @@ // 2. 鏌ヨ瀛愯〃 LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()); + productWrapper.eq(SalesLedgerProduct::getType, 1); List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper); for (SalesLedgerProduct product : products) { product.setOriginalNoInvoiceNum(product.getNoInvoiceNum()); @@ -109,7 +115,7 @@ product.setTempnoInvoiceAmount(product.getNoInvoiceAmount()); product.setTempNoInvoiceNum(product.getNoInvoiceNum()); product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName()); - product.setRegisterDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + product.setRegisterDate(LocalDateTime.now()); } // 3.鏌ヨ涓婁紶鏂囦欢 @@ -310,15 +316,23 @@ List<Long> idList = Arrays.stream(ids) .filter(Objects::nonNull) .collect(Collectors.toList()); - if (CollectionUtils.isEmpty(idList)) { return 0; + } + // 鐢熶骇璁㈠崟鏈夊緟鎺掍骇鏁版嵁锛屽彴璐︿笉鍙垹闄� + LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerScheduling>() + .in(SalesLedgerScheduling::getSalesLedgerId, idList); + if (salesLedgerSchedulingMapper.selectCount(salesLedgerSchedulingLambdaQueryWrapper) > 0) { + throw new BaseException("鏈夋帓浜ф暟鎹紝涓嶅彲鍒犻櫎"); } // 1. 鍏堝垹闄ゅ瓙琛ㄦ暟鎹� LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList); salesLedgerProductMapper.delete(productWrapper); - + // 鍒犻櫎鐢熶骇璁㈠崟鏁版嵁 + LambdaQueryWrapper<SalesLedgerScheduling> in = new LambdaQueryWrapper<SalesLedgerScheduling>() + .in(SalesLedgerScheduling::getSalesLedgerId, idList); + salesLedgerSchedulingMapper.delete(in); // 2. 鍐嶅垹闄や富琛ㄦ暟鎹� return salesLedgerMapper.deleteBatchIds(idList); } @@ -428,7 +442,8 @@ fileRecord.setName(originalFilename); fileRecord.setUrl(formalFilePath.toString()); fileRecord.setCreateTime(LocalDateTime.now()); - fileRecord.setType("1"); + //閿�鍞� + fileRecord.setType(FileNameType.SALE.getValue()); commonFileMapper.insert(fileRecord); // 鍒犻櫎涓存椂鏂囦欢璁板綍 -- Gitblit v1.9.3