From 70a56e3ba7596074f11d6b8f406aae0b61ab0152 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 06 一月 2026 18:03:14 +0800
Subject: [PATCH] yys 修改附件问题
---
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java | 153 ++++++++++++++++++++------------------------------
1 files changed, 62 insertions(+), 91 deletions(-)
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
index ab73804..9852170 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
@@ -22,6 +22,7 @@
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -531,34 +532,21 @@
public IPage<ProcurementPageDtoCopy> listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) {
IPage<ProcurementPageDtoCopy> procurementPageDtoCopyIPage = procurementRecordMapper.listPageCopyByProduction(page, procurementDto);
List<ProcurementPageDtoCopy> procurementPageDtoCopyList = procurementPageDtoCopyIPage.getRecords();
- // 璁$畻寰呭叆搴撴暟閲�
- // 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
- List<Integer> collect = procurementPageDtoCopyList.stream().map(ProcurementPageDtoCopy::getId).collect(Collectors.toList());
- if(CollectionUtils.isEmpty( collect)){
- return procurementPageDtoCopyIPage;
- }
- LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
- procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect);
- procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 2);
- List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
- if(CollectionUtils.isEmpty( procurementRecords)){
- return procurementPageDtoCopyIPage;
- }
- for (ProcurementPageDtoCopy dto : procurementPageDtoCopyList) {
- // 鏍规嵁閲囪喘鍙拌处ID绛涢�夊搴旂殑鍑哄簱璁板綍
- List<ProcurementRecordOut> collect1 = procurementRecords.stream()
- .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()))
- .collect(Collectors.toList());
- // 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
- if(CollectionUtils.isEmpty(collect1)){
+ for (ProcurementPageDtoCopy dto : procurementPageDtoCopyList) {
+ List<Long> longs = listCopyIds(dto.getIds());
+ LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, longs);
+ procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 2);
+ List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
+ if(CollectionUtils.isEmpty(procurementRecords)){
dto.setInboundNum0(dto.getInboundNum());
dto.setTotalInboundNum(BigDecimal.ZERO);
- continue;
+ return procurementPageDtoCopyIPage;
}
// 璁$畻宸插嚭搴撴暟閲忔�诲拰锛屽苟璁剧疆寰呭嚭搴撴暟閲�
- BigDecimal totalInboundNum = collect1.stream()
+ BigDecimal totalInboundNum = procurementRecords.stream()
.map(ProcurementRecordOut::getInboundNum)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 鍑哄簱鏁伴噺 = 鎬绘暟閲� - 寰呭嚭搴撴暟閲�
@@ -575,52 +563,24 @@
@Override
public IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage) {
-// LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
-// customStorageLambdaQueryWrapper.groupBy(CustomStorage::getProductCategory, CustomStorage::getSpecificationModel,CustomStorage::getTaxInclusiveUnitPrice);
-// if(customStorage != null){
-// if(!StringUtils.isEmpty(customStorage.getSupplierName())){
-// customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName());
-// }
-// // 绛涢�夊叆搴撴椂闂�
-// if(customStorage.getInboundDate() != null){
-// customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate());
-// }
-// if(!StringUtils.isEmpty(customStorage.getProductCategory())){
-// customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory());
-// }
-// }
-// customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate);
IPage<CustomStorage> pageList = customStorageMapper.listPageCopyByCustom(page, customStorage);
-
List<CustomStorage> procurementPageDtoCopyList = pageList.getRecords();
- // 璁$畻寰呭叆搴撴暟閲�
- // 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
- List<Integer> collect = procurementPageDtoCopyList.stream().map(CustomStorage::getId).collect(Collectors.toList());
- if(CollectionUtils.isEmpty( collect)){
- return pageList;
- }
- LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
- procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect);
- procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 3);
- List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
- if(CollectionUtils.isEmpty( procurementRecords)){
- return pageList;
- }
+
for (CustomStorage dto : procurementPageDtoCopyList) {
// 鏍规嵁閲囪喘鍙拌处ID绛涢�夊搴旂殑鍑哄簱璁板綍
- List<ProcurementRecordOut> collect1 = procurementRecords.stream()
- .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()))
- .collect(Collectors.toList());
-
- // 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
- if(CollectionUtils.isEmpty(collect1)){
+ List<Long> longs = listCopyIds(dto.getIds());
+ LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, longs);
+ procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType, 3);
+ List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
+ if(CollectionUtils.isEmpty(procurementRecords)){
dto.setInboundNum0(dto.getInboundNum());
dto.setTotalInboundNum(BigDecimal.ZERO);
- continue;
+ return pageList;
}
// 璁$畻宸插嚭搴撴暟閲忔�诲拰锛屽苟璁剧疆寰呭嚭搴撴暟閲�
- BigDecimal totalInboundNum = collect1.stream()
+ BigDecimal totalInboundNum = procurementRecords.stream()
.map(ProcurementRecordOut::getInboundNum)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 鍑哄簱鏁伴噺 = 鎬绘暟閲� - 寰呭嚭搴撴暟閲�
@@ -662,6 +622,29 @@
}
@Override
+ public CustomStorage detailManagementByCustom(ProcurementManagementUpdateDto procurementDto) {
+ if(procurementDto == null) return null;
+ return customStorageMapper.selectById(procurementDto.getId());
+ }
+
+ @Override
+ public ProcurementPageDto detail(ProcurementUpdateDto procurementDto) {
+ ProcurementPageDto procurementPageDto = new ProcurementPageDto();
+ if(procurementDto == null) return procurementPageDto;
+ ProcurementRecordStorage procurementRecordStorage = procurementRecordMapper.selectById(procurementDto.getId());
+ if(procurementRecordStorage == null) return procurementPageDto;
+ BeanUtils.copyProperties(procurementRecordStorage, procurementPageDto);
+ SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(procurementRecordStorage.getSalesLedgerProductId());
+ if(salesLedgerProduct != null){
+ procurementPageDto.setProductCategory(salesLedgerProduct.getProductCategory());
+ procurementPageDto.setSpecificationModel(salesLedgerProduct.getSpecificationModel());
+ procurementPageDto.setUnit(salesLedgerProduct.getUnit());
+ procurementPageDto.setTaxInclusiveUnitPrice(salesLedgerProduct.getTaxInclusiveUnitPrice());
+ }
+ return procurementPageDto;
+ }
+
+ @Override
public int add(ProcurementAddDto procurementDto) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 鎵归噺鏂板
@@ -683,18 +666,12 @@
.createTime(LocalDateTime.now())
.createUser(loginUser.getUserId())
.updateTime(LocalDateTime.now())
+ .boxNum(detail.getBoxNum())
+ .cartonSpecifications(detail.getCartonSpecifications())
+ .dollarPrice(detail.getDollarPrice())
.updateUser(loginUser.getUserId())
.createBy(procurementDto.getNickName());
this.save(procurementRecordBuilder.build());
- // 鍏ュ簱鎴愬姛鍑忔帀閲囪喘鏁伴噺
-// LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
-// salesLedgerProductLambdaQueryWrapper.eq(SalesLedgerProduct::getId, detail.getId());
-// SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectOne(salesLedgerProductLambdaQueryWrapper);
-// if(salesLedgerProduct == null){
-// throw new RuntimeException("鏈壘鍒拌鍟嗗搧");
-// }
-// salesLedgerProduct.setQuantity(salesLedgerProduct.getQuantity().subtract(detail.getInboundQuantity()));
-// salesLedgerProductMapper.updateById(salesLedgerProduct);
}
return 1;
}
@@ -739,38 +716,32 @@
return procurementPageDtoIPage;
}
+ public List<Long> listCopyIds(String ids) {
+ List<Long> idsSet = new ArrayList<>();
+ String[] split = ids.split(",");
+ for (String s : split) {
+ idsSet.add(Long.valueOf(s));
+ }
+ return idsSet;
+ }
+
@Override
public IPage<ProcurementPageDtoCopy> listPageCopy(Page page, ProcurementPageDto procurementDto) {
IPage<ProcurementPageDtoCopy> procurementPageDtoCopyIPage = procurementRecordMapper.listPageCopy(page, procurementDto);
List<ProcurementPageDtoCopy> procurementPageDtoCopyList = procurementPageDtoCopyIPage.getRecords();
- // 璁$畻寰呭叆搴撴暟閲�
- // 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
- List<Integer> collect = procurementPageDtoCopyList.stream().map(ProcurementPageDtoCopy::getId).collect(Collectors.toList());
- if(CollectionUtils.isEmpty( collect)){
- return procurementPageDtoCopyIPage;
- }
- LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
- procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect);
- procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType,1);
- List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
- if(CollectionUtils.isEmpty( procurementRecords)){
- return procurementPageDtoCopyIPage;
- }
for (ProcurementPageDtoCopy dto : procurementPageDtoCopyList) {
- // 鏍规嵁閲囪喘鍙拌处ID绛涢�夊搴旂殑鍑哄簱璁板綍
- List<ProcurementRecordOut> collect1 = procurementRecords.stream()
- .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()) && ProcurementRecordOut.getType().equals(1))
- .collect(Collectors.toList());
-
- // 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
- if(CollectionUtils.isEmpty(collect1)){
+ List<Long> longs = listCopyIds(dto.getIds());
+ LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, longs);
+ procurementRecordLambdaQueryWrapper.eq(ProcurementRecordOut::getType,1);
+ List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper);
+ if(CollectionUtils.isEmpty(procurementRecords)){
dto.setInboundNum0(dto.getInboundNum());
dto.setTotalInboundNum(BigDecimal.ZERO);
- continue;
+ return procurementPageDtoCopyIPage;
}
-
// 璁$畻宸插嚭搴撴暟閲忔�诲拰锛屽苟璁剧疆寰呭嚭搴撴暟閲�
- BigDecimal totalInboundNum = collect1.stream()
+ BigDecimal totalInboundNum = procurementRecords.stream()
.map(ProcurementRecordOut::getInboundNum)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 鍑哄簱鏁伴噺 = 鎬绘暟閲� - 寰呭嚭搴撴暟閲�
--
Gitblit v1.9.3