yonge 3 years ago
parent
commit
5b8e080aca

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -380,9 +380,12 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         	String goodsIdsStr = StringUtils.removeEnd(sb.toString(), ",");
         	
         	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
-        	BigDecimal totalGroupPurchasePrice = goodsList.stream().map(t -> t.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
-        	
         	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
+        	BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
+        	
+        	for(String goodsIdStr : goodsIdsStr.split(",")){
+        		totalGroupPurchasePrice = totalGroupPurchasePrice.add(goodsMap.get(goodsIdStr).getGroupPurchasePrice());
+        	}
         	
         	Goods goods = null;
         	for(String goodsIdStr : goodsIdsStr.split(",")){

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -362,7 +362,15 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
         	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
         	Goods goods = null;
-        	BigDecimal goodsTotalGroupPurchasePrice = goodsList.stream().map(t -> t.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+        	BigDecimal goodsTotalGroupPurchasePrice = BigDecimal.ZERO;
+        	
+        	for(String goodsIdStr : goodsIdsStr.split(",")){
+        		if(StringUtils.isBlank(goodsIdStr)){
+					continue;
+				}
+				goods = goodsMap.get(Integer.parseInt(goodsIdStr));
+				goodsTotalGroupPurchasePrice = goodsTotalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
+        	}
         	
         	for(String goodsIdStr : goodsIdsStr.split(",")){
         		if(StringUtils.isBlank(goodsIdStr)){