yonge 3 лет назад
Родитель
Сommit
0a272ea477

+ 27 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -317,11 +317,17 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
 			List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
 			
-			if(paymentOrderIdList == null || paymentOrderIdList.size() == 0){
+			subjectChange = subjectChangeMap.get(studentRegistration.getUserId());
+			
+			if((paymentOrderIdList == null || paymentOrderIdList.size() == 0) && subjectChange == null){
 				continue;
 			}
 			
-			List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
+			List<StudentPaymentOrderDetail> orderDetailList = new ArrayList<StudentPaymentOrderDetail>();
+			
+			if(paymentOrderIdList != null && paymentOrderIdList.size() > 0) {
+				orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
+			}
 			
 			Map<OrderDetailTypeEnum,BigDecimal> userOrderTypeMap = new HashMap<OrderDetailTypeEnum, BigDecimal>();;
 			
@@ -333,9 +339,23 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 			
 			boolean isCalculatedOfAccessories = false;
 			
-			subjectChange = subjectChangeMap.get(studentRegistration.getUserId());
+			if(orderDetailList.size() == 0) {
+				if(subjectChange != null){
+					if(subjectChange.getChangeMusical() != null){
+						kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
+						musicalId = subjectChange.getChangeMusical() + "";
+						userOrderTypeMap.put(OrderDetailTypeEnum.MUSICAL, subjectChange.getChangeMusicalPrice());
+						orderTotalAmount = orderTotalAmount.add(subjectChange.getChangeMusicalPrice());
+					}
+					if(StringUtils.isNotBlank(subjectChange.getChangeAccessories())) {
+						accessoriesId = accessoriesId.append(subjectChange.getChangeAccessories());
+						userOrderTypeMap.put(OrderDetailTypeEnum.ACCESSORIES, subjectChange.getChangeAccessoriesPrice());
+						orderTotalAmount = orderTotalAmount.add(subjectChange.getChangeAccessoriesPrice());
+		        	}
+				}
+			}
 			
-			for(StudentPaymentOrderDetail spod : orderDetailList){
+			for(StudentPaymentOrderDetail spod : orderDetailList) {
 				
 				if (spod.getType() == OrderDetailTypeEnum.COURSE || spod.getType() == OrderDetailTypeEnum.HIGH_ONLINE_COURSE
 						|| spod.getType() == OrderDetailTypeEnum.SINGLE || spod.getType() == OrderDetailTypeEnum.VIP
@@ -354,7 +374,8 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 						kitGroupPurchaseType = subjectChange.getKitGroupPurchaseType();
 						musicalId = subjectChange.getChangeMusical() + "";
 						spod.setPrice(subjectChange.getChangeMusicalPrice());
-		        	}else{
+						spod.setRemitFee(BigDecimal.ZERO);
+		        	} else {
 						kitGroupPurchaseType = spod.getKitGroupPurchaseType();
 						musicalId = spod.getGoodsIdList();
 						//musicalAmount = musicalAmount.add(spod.getPrice());
@@ -368,6 +389,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 						accessoriesId = accessoriesId.append(subjectChange.getChangeAccessories()).append(",");
 						//accessoriesAmount = accessoriesAmount.add(subjectChange.getChangeAccessoriesPrice());
 						spod.setPrice(subjectChange.getChangeAccessoriesPrice());
+						spod.setRemitFee(BigDecimal.ZERO);
 		        	}else{
 						accessoriesId = accessoriesId.append(spod.getGoodsIdList()).append(",");
 						//accessoriesAmount = accessoriesAmount.add(spod.getPrice());

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -364,7 +364,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 				if (goods != null && goods.size() > 0) {
 					detail.setName(goods.stream().map(t -> t.getName()).collect(Collectors.joining(",")));
 				}
-				detail.setPaymentOrderId((long) studentLastChange.getOriginalOrderId());
+				if(studentLastChange.getOriginalOrderId() != null){
+					detail.setPaymentOrderId((long) studentLastChange.getOriginalOrderId());
+				}
 				detail.setPrice(studentLastChange.getChangeAccessoriesPrice());
 				detail.setType(OrderDetailTypeEnum.ACCESSORIES);
 				detail.setCreateTime(studentLastChange.getCreateTime());

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -456,9 +456,11 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         Long paymentOrderId = null;
         		
         for(StudentPaymentOrderDetail detail : details){
-        	if(paymentOrderId == null || paymentOrderId < detail.getPaymentOrderId()){
-    			paymentOrderId = detail.getPaymentOrderId();
-    		}
+        	if(detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.MUSICAL){
+	        	if(paymentOrderId == null || paymentOrderId < detail.getPaymentOrderId()){
+	    			paymentOrderId = detail.getPaymentOrderId();
+	    		}
+        	}
         }
 
 		Set<Integer> refundSellOrderGoodsIds = new HashSet<Integer>();