|
|
@@ -532,12 +532,12 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
;
|
|
|
List<TextbookWarehouseRecord> textbookWarehouseRecords = textbookWarehouseRecordMapper.selectList(textbookWarehouseRecordLambdaQueryWrapper);
|
|
|
|
|
|
- // 因为入库的时候可以修改定价,不同定价应该对应不同的入库记录
|
|
|
- Map<Long, Map<BigDecimal, TextbookWarehouseRecord>> textbookWarehouseRecordByItemIdByPriceMap = textbookWarehouseRecords.stream()
|
|
|
+ // 因为入库的时候可以修改定价和折扣,不同定价和折扣应该对应不同的入库记录
|
|
|
+ Map<Long, Map<String, TextbookWarehouseRecord>> textbookWarehouseRecordByItemIdByPriceMap = textbookWarehouseRecords.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
TextbookWarehouseRecord::getDataItemId, // 第一层分组:按征订项 ID 分组
|
|
|
Collectors.toMap(
|
|
|
- TextbookWarehouseRecord::getPrice, // 第二层映射:按入库定价作为键
|
|
|
+ p -> p.getPrice().toString() + "-" + p.getDiscount().toString(), // 第二层映射:按入库定价作为键
|
|
|
wr -> wr, // 值为 TextbookStudentClaim 对象本身
|
|
|
(existing, replacement) -> existing // 如果有重复键,保留现有的值
|
|
|
)
|
|
|
@@ -576,20 +576,30 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
TextbookSubscriptionItem old = null;
|
|
|
TextbookSubscriptionItem updateItem;
|
|
|
TextbookWarehouseRecord textbookWarehouseRecord;
|
|
|
- Map<BigDecimal, TextbookWarehouseRecord> oldTextbookWarehouseRecordByPrice = null;
|
|
|
+ Map<String, TextbookWarehouseRecord> oldTextbookWarehouseRecordByPrice = null;
|
|
|
TextbookWarehouseRecord oldTextbookWarehouseRecord = null;
|
|
|
TextbookWarehouseRecordDetail textbookWarehouseRecordDetail;
|
|
|
- for (TextbookInstockroomDto dto : dtos) {
|
|
|
+ for (int i = 0; i < dtos.size(); i++) {
|
|
|
+ TextbookInstockroomDto dto = dtos.get(i);
|
|
|
if (ObjectUtils.isNotEmpty(dto.getTextbookSubscriptionItemId())) {
|
|
|
old = itemByIdMap.get(dto.getTextbookSubscriptionItemId());
|
|
|
oldTextbookWarehouseRecordByPrice = textbookWarehouseRecordByItemIdByPriceMap.get(dto.getTextbookSubscriptionItemId());
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(dto.getPrice())){
|
|
|
+ throw new MyException("第" + (i+1) + "本教材价格为空,请填写。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(dto.getDiscount())){
|
|
|
+ throw new MyException("第" + (i+1) + "本教材折扣为空,请填写。");
|
|
|
+ }
|
|
|
+
|
|
|
if(MapUtils.isNotEmpty(oldTextbookWarehouseRecordByPrice)){
|
|
|
- oldTextbookWarehouseRecord = oldTextbookWarehouseRecordByPrice.get(dto.getPrice());
|
|
|
+ oldTextbookWarehouseRecord = oldTextbookWarehouseRecordByPrice.get(dto.getPrice().toString() + dto.getDiscount().toString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ObjectUtils.isEmpty(old)) {
|
|
|
- continue;
|
|
|
+ if(ObjectUtils.isEmpty(old)){
|
|
|
+ throw new MyException("第" + (i+1) + "本教材征订信息被修改,请刷新重试");
|
|
|
}
|
|
|
|
|
|
// 现在入库价格改动不影响征订项的价格相关属性
|
|
|
@@ -694,11 +704,11 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
// Map<Long, TextbookWarehouseRecord> textbookWarehouseRecordByItemIdMap = textbookWarehouseRecords.stream()
|
|
|
// .collect(Collectors.toMap(TextbookWarehouseRecord::getDataItemId, t -> t, (t1, t2) -> t2));
|
|
|
// 因为入库的时候可以修改定价,不同定价应该对应不同的入库记录
|
|
|
- Map<Long, Map<BigDecimal, TextbookWarehouseRecord>> textbookWarehouseRecordByItemIdByPriceMap = textbookWarehouseRecords.stream()
|
|
|
+ Map<Long, Map<String, TextbookWarehouseRecord>> textbookWarehouseRecordByItemIdByPriceMap = textbookWarehouseRecords.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
TextbookWarehouseRecord::getDataItemId, // 第一层分组:按征订项 ID 分组
|
|
|
Collectors.toMap(
|
|
|
- TextbookWarehouseRecord::getPrice, // 第二层映射:按入库定价作为键
|
|
|
+ p -> p.getPrice().toString() + "-" + p.getDiscount().toString(), // 第二层映射:按入库定价作为键
|
|
|
wr -> wr, // 值为 TextbookStudentClaim 对象本身
|
|
|
(existing, replacement) -> existing // 如果有重复键,保留现有的值
|
|
|
)
|
|
|
@@ -733,7 +743,7 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
// 处理入库细节
|
|
|
TextbookSubscriptionItem oldItem;
|
|
|
TextbookSubscriptionItem updateItem;
|
|
|
- Map<BigDecimal, TextbookWarehouseRecord> oldTextbookWarehouseRecordByPrice;
|
|
|
+ Map<String, TextbookWarehouseRecord> oldTextbookWarehouseRecordByPrice;
|
|
|
TextbookWarehouseRecord oldTextbookWarehouseRecord = null;
|
|
|
TextbookWarehouseRecord textbookWarehouseRecord;
|
|
|
TextbookWarehouseRecordDetail textbookWarehouseRecordDetail;
|
|
|
@@ -759,9 +769,17 @@ public class TextbookSubscriptionServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
throw new MyException("第" + (i + 4) + "行数据主键被修改,请重新下载模板");
|
|
|
}
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(vo.getPrice())) {
|
|
|
+ throw new MyException("第" + (i + 4) + "行数据定价为空,请填写");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtils.isEmpty(vo.getDiscount())) {
|
|
|
+ throw new MyException("第" + (i + 4) + "行数据折扣为空,请填写");
|
|
|
+ }
|
|
|
+
|
|
|
oldTextbookWarehouseRecordByPrice = textbookWarehouseRecordByItemIdByPriceMap.get(Long.parseLong(vo.getTextbookSubscriptionItemId()));
|
|
|
if(MapUtils.isNotEmpty(oldTextbookWarehouseRecordByPrice)){
|
|
|
- oldTextbookWarehouseRecord = oldTextbookWarehouseRecordByPrice.get(vo.getPrice());
|
|
|
+ oldTextbookWarehouseRecord = oldTextbookWarehouseRecordByPrice.get(vo.getPrice().toString() + vo.getDiscount().toString());
|
|
|
}
|
|
|
|
|
|
updateItem = new TextbookSubscriptionItem();
|