Pārlūkot izejas kodu

乐团退团课程费用,已上课 * 0.995 未上课 * 0.8
乐器 * 0.995

zouxuan 3 gadi atpakaļ
vecāks
revīzija
0d84a97fa4

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
@@ -407,7 +408,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
 
             //2、金额退到余额
             if (reBackFee && sellOrder.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
-                sysUserCashAccountService.updateBalance(sellOrder.getUserId(), sellOrder.getExpectAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "订单:" + sellOrder.getOrderId() + " 商品id:" + sellOrder.getGoodsId() + "退货");
+                sysUserCashAccountService.updateBalance(sellOrder.getUserId(), sellOrder.getExpectAmount().multiply(new BigDecimal(0.995)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP), PlatformCashAccountDetailTypeEnum.REFUNDS, "订单:" + sellOrder.getOrderId() + " 商品id:" + sellOrder.getGoodsId() + "退货");
             }
         }
         //3、退货

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

@@ -20,7 +20,9 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.constant.CommonConstants;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,16 +62,6 @@ import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dto.NoClassMusicStudentDto;
-import com.ym.mec.biz.dal.dto.PageInfoReg;
-import com.ym.mec.biz.dal.dto.RegisterDto;
-import com.ym.mec.biz.dal.dto.StudentAddDto;
-import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentApplyInstrumentDto;
-import com.ym.mec.biz.dal.dto.StudentInfo;
-import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
-import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
-import com.ym.mec.biz.dal.dto.StudentRegisterInstrumentsDetailDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
@@ -329,7 +321,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 		}
 
 		SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(studentId, musicGroupId);
-		
+
 		if (studentLastChange != null) {
 			Iterator<StudentPaymentOrderDetail> iterator = studentPaymentOrderDetailList.iterator();
 			StudentPaymentOrderDetail spod = null;
@@ -392,12 +384,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 			if (detailList == null) {
 				detailList = new ArrayList<StudentPaymentOrderDetail>();
 			}
-			map.put(OrderDetailTypeEnum.MUSICAL.getCode(), detailList.stream().map(StudentPaymentOrderDetail::getPrice)
-					.reduce(BigDecimal.ZERO, BigDecimal::add));
+            BigDecimal reduce = detailList.stream().map(StudentPaymentOrderDetail::getPrice)
+                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            map.put(OrderDetailTypeEnum.MUSICAL.getCode(),reduce.multiply(new BigDecimal(0.995)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP));
 		} else {
 			map.put(OrderDetailTypeEnum.MUSICAL.getCode(), BigDecimal.ZERO);
 		}
-		
+
 		if (detailMap.containsKey(OrderDetailTypeEnum.MAINTENANCE)) {
 
 			BigDecimal totalAmount = BigDecimal.ZERO;
@@ -409,11 +402,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 					DealStatusEnum.SUCCESS);
 
 			if (studentPaymentOrderDetailList != null && studentPaymentOrderDetailList.size() > 0) {
-				
+
 				Map<Long, StudentPaymentOrderDetail> maintenanceMap = studentPaymentOrderDetailList.stream()
 						.filter(t -> (t.getType() == OrderDetailTypeEnum.MAINTENANCE))
 						.collect(Collectors.toMap(t -> t.getStudentInstrumentId(), StudentPaymentOrderDetail -> StudentPaymentOrderDetail));
-				
+
 				List<Long> instrumentIdList = new ArrayList<Long>(maintenanceMap.keySet());
 				if (instrumentIdList != null && instrumentIdList.size() > 0) {
 					List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
@@ -439,8 +432,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 			if (detailList == null) {
 				detailList = new ArrayList<StudentPaymentOrderDetail>();
 			}
-			map.put(OrderDetailTypeEnum.ACCESSORIES.getCode(),
-					detailList.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
+            BigDecimal reduce = detailList.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+            map.put(OrderDetailTypeEnum.ACCESSORIES.getCode(),
+                    reduce.multiply(new BigDecimal(0.995)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP));
 		} else {
 			map.put(OrderDetailTypeEnum.ACCESSORIES.getCode(), BigDecimal.ZERO);
 		}
@@ -449,7 +443,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 		if (studentRegistration == null) {
 			throw new BizException("学生报名信息查询失败");
 		}
-		map.put(OrderDetailTypeEnum.COURSE.getCode(), studentRegistration.getSurplusCourseFee());
+		//未上课*0995手续费、以上课*0.98
+        List<StudentCourseInfoDto> history = courseScheduleDao.findUserCourseInfos(GroupType.MUSIC, musicGroupId, studentId, "history");
+		if(history == null || history.size() == 0){
+            map.put(OrderDetailTypeEnum.COURSE.getCode(), studentRegistration.getSurplusCourseFee().multiply(new BigDecimal(0.995)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP));
+        }else {
+            map.put(OrderDetailTypeEnum.COURSE.getCode(), studentRegistration.getSurplusCourseFee().multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP));
+        }
 
 		// 查询云教练订单
 		BigDecimal cloudAmount = BigDecimal.ZERO;