From 32ddd9d13c53dd7fe5a09120ca59b29e61afc0cc Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期四, 03 四月 2025 16:24:08 +0800
Subject: [PATCH] 标准库中新增区间后,保存提示报错修改
---
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java | 49 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
index f3effad..33a54de 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -12,6 +12,7 @@
import com.ruoyi.basic.mapper.*;
import com.ruoyi.basic.pojo.*;
import com.ruoyi.basic.service.StandardMethodListService;
+import com.ruoyi.basic.service.StandardProductListSupplierAskService;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.common.utils.SecurityUtils;
@@ -68,6 +69,12 @@
@Autowired
private StandardProductListUpdateRecordRelMapper standardProductListUpdateRecordRelMapper;
+ @Autowired
+ private StandardProductListSupplierAskService standardProductListSupplierAskService;
+
+ @Autowired
+ private StandardProductListSupplierAskBackupRelMapper standardProductListSupplierAskBackupRelMapper;
+
@Override
public int upStandardProductList(StandardProductList list) {
@@ -87,6 +94,10 @@
BeanUtils.copyProperties(standardProductList, productListBackupRel);
standardProductListBackupRelMapper.insert(productListBackupRel);
}
+ // 鍏宠仈鍟嗗澶囦唤
+ StandardProductListSupplierAsk standardProductListSupplierAsk = new StandardProductListSupplierAsk();
+ standardProductListSupplierAsk.setProductListId(list.getId());
+ standardProductListSupplierAskService.backupSupplierAsk(standardProductListSupplierAsk);
// 淇敼鐘舵��
list.setCheckStatus(StandardProductListChcekTypeEnums.WAIT_CHECK.getCode());
return standardProductListMapper.updateById(list);
@@ -505,6 +516,10 @@
BeanUtils.copyProperties(standardProductList, productListBackupRel);
standardProductListBackupRelMapper.insert(productListBackupRel);
}
+ // 鍏宠仈鍟嗗澶囦唤
+ StandardProductListSupplierAsk standardProductListSupplierAsk = new StandardProductListSupplierAsk();
+ standardProductListSupplierAsk.setProductListId(list.getId());
+ standardProductListSupplierAskService.backupSupplierAsk(standardProductListSupplierAsk);
// 淇敼鐘舵��
list.setCheckStatus(StandardProductListChcekTypeEnums.WAIT_CHECK.getCode());
standardProductListMapper.updateSection(list);
@@ -670,7 +685,9 @@
QueryWrapper<StandardProductList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.WAIT_CHECK.getCode());
List<StandardProductList> unCheckStandardProductListArray = standardProductListMapper.selectList(queryWrapper);
-
+ if(CollectionUtils.isEmpty(unCheckStandardProductListArray)){
+ throw new RuntimeException("鏆傛棤淇敼鏁版嵁");
+ }
List<Long> standardProductListIds = new ArrayList<>();
// 鎻掑叆淇敼璁板綍
standardProductListUpdateRecordMapper.insert(standardProductListUpdateRecord);
@@ -711,25 +728,41 @@
}
// 瀹℃牳閫氳繃
if(StandardProductListChcekTypeEnums.PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())){
- // 鍒犻櫎澶囦唤鏁版嵁
- standardProductListBackupRelMapper.deleteBatchIds(standardProductListIds);
// 淇敼鐘舵��
standardProductListMapper.updateProductListCheckStatus(standardProductListIds,StandardProductListChcekTypeEnums.PASS_CHECK.getCode());
}
// 瀹℃牳鏈�氳繃
if(StandardProductListChcekTypeEnums.NO_PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())){
- // 鏌ヨ鎵�鏈夌殑澶囦唤鏁版嵁
+ // 鏌ヨ鎵�鏈夋爣鍑嗘爲涓嬬殑妫�楠岄」鐩浠芥暟鎹�
List<StandardProductListBackupRel> standardProductListBackupRelList = standardProductListBackupRelMapper.selectBatchIds(standardProductListIds);
- // 鍥炴粴鏁版嵁
+ // 鍥炴粴鏍囧噯鏍戜笅鐨勬楠岄」鐩暟鎹�
for (StandardProductListBackupRel standardProductListBackupRel : standardProductListBackupRelList) {
StandardProductList standardProductList = new StandardProductList();
BeanUtils.copyProperties(standardProductListBackupRel, standardProductList);
- standardProductList.setCheckStatus("");
standardProductListMapper.updateById(standardProductList);
}
- // 鍒犻櫎澶囦唤鏁版嵁
- standardProductListBackupRelMapper.deleteBatchIds(standardProductListIds);
+ // 鍥炴粴妫�楠岄」鐩巶瀹跺瘑搴︾粦瀹氳〃鏁版嵁
+ QueryWrapper<StandardProductListSupplierAskBackupRel> supplierAskBackupRelQueryWrapper = new QueryWrapper<>();
+ supplierAskBackupRelQueryWrapper.in("product_list_id",standardProductListIds);
+ List<StandardProductListSupplierAskBackupRel> standardProductListSupplierAskBackupRelList = standardProductListSupplierAskBackupRelMapper.selectList(supplierAskBackupRelQueryWrapper);
+ if(!CollectionUtils.isEmpty(standardProductListSupplierAskBackupRelList)){
+ QueryWrapper<StandardProductListSupplierAsk> deleteWrapper = new QueryWrapper<>();
+ deleteWrapper.in("product_list_id",standardProductListIds);
+ standardProductListSupplierAskMapper.delete(deleteWrapper);
+ ArrayList<StandardProductListSupplierAsk> supplierAskRollBackList = new ArrayList<>();
+ for (StandardProductListSupplierAskBackupRel standardProductListSupplierAskBackupRel : standardProductListSupplierAskBackupRelList) {
+ StandardProductListSupplierAsk standardProductListSupplierAsk = new StandardProductListSupplierAsk();
+ BeanUtils.copyProperties(standardProductListSupplierAskBackupRel, standardProductListSupplierAsk);
+ supplierAskRollBackList.add(standardProductListSupplierAsk);
+ }
+ standardProductListSupplierAskMapper.batchInsertSupplierAsk(supplierAskRollBackList);
+ }
+
}
+ // 鍒犻櫎鏍囧噯鏍戜笅鐨勬楠岄」鐩浠芥暟鎹�
+ standardProductListBackupRelMapper.deleteBatchIds(standardProductListIds);
+ // 鍒犻櫎缁戝畾鍘傚澶囦唤鏁版嵁
+ standardProductListSupplierAskBackupRelMapper.batchDeleteByProductIds(standardProductListIds);
standardProductListUpdateRecordMapper.updateById(standardProductListUpdateRecord);
}
--
Gitblit v1.9.3