|
@@ -20,6 +20,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -116,26 +117,6 @@ import com.ym.mec.biz.dal.page.MusicGroupRecordStudentQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.NoClassMusicStudentQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.RegistrationOrPreQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ClassGroupService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupStudentMapperService;
|
|
|
-import com.ym.mec.biz.service.CloudTeacherOrderService;
|
|
|
-import com.ym.mec.biz.service.ContractService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
-import com.ym.mec.biz.service.ImGroupMemberService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
|
|
|
-import com.ym.mec.biz.service.SellOrderService;
|
|
|
-import com.ym.mec.biz.service.StudentInstrumentService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
-import com.ym.mec.biz.service.StudentService;
|
|
|
-import com.ym.mec.biz.service.SubjectService;
|
|
|
-import com.ym.mec.biz.service.SysConfigService;
|
|
|
-import com.ym.mec.biz.service.SysMessageService;
|
|
|
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
|
|
|
-import com.ym.mec.biz.service.SysUserCashAccountService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.entity.ImResult;
|
|
@@ -240,6 +221,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private OrganizationCloudTeacherFeeDao organizationCloudTeacherFeeDao;
|
|
|
@Autowired
|
|
|
private CloudTeacherOrderService cloudTeacherOrderService;
|
|
|
+ @Autowired
|
|
|
+ private SysCouponCodeService sysCouponCodeService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentRegistration> getDAO() {
|
|
@@ -618,15 +601,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel,
|
|
|
- BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, BigDecimal remitFee, BigDecimal courseRemitFee, List<MusicGroupPaymentCalenderCourseSettings> newCourses, Boolean buyMaintenance, Boolean buyCloudTeacher, Boolean buyCloudTeacherPlus) throws Exception {
|
|
|
+ BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, BigDecimal remitFee, BigDecimal courseRemitFee,
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> newCourses, Boolean buyMaintenance, Boolean buyCloudTeacher, Boolean buyCloudTeacherPlus,List<Integer> couponIdList) throws Exception {
|
|
|
Date date = new Date();
|
|
|
- StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(couponIdList,amount,true);
|
|
|
studentPaymentOrder.setUserId(studentRegistration.getUserId());
|
|
|
studentPaymentOrder.setGroupType(GroupType.MUSIC);
|
|
|
studentPaymentOrder.setOrderNo(orderNo);
|
|
|
studentPaymentOrder.setType(OrderTypeEnum.APPLY);
|
|
|
- studentPaymentOrder.setExpectAmount(amount);
|
|
|
- studentPaymentOrder.setActualAmount(amount);
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
studentPaymentOrder.setPaymentChannel(paymentChannel);
|
|
|
studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId());
|
|
@@ -1234,7 +1216,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentInstrumentService.addOrderDetail2Instrument(studentPaymentOrder);
|
|
|
|
|
|
//学生云教练处理
|
|
|
- cloudTeacherOrderService.addOrderDetail2CloudTeacher(studentPaymentOrder);
|
|
|
+ BigDecimal cloudTeacherFee = allDetails.stream() .filter(o -> o.getType().getCode().equals("CLOUD_TEACHER"))
|
|
|
+ .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ cloudTeacherOrderService.addOrderDetail2CloudTeacher(studentPaymentOrder,cloudTeacherFee);
|
|
|
|
|
|
//合并学员处理
|
|
|
if (studentRegistration.getIsMerge().equals(1) && studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
|
@@ -1293,6 +1278,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "报名缴费失败");
|
|
|
}
|
|
|
+ sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
|
|
|
//三方乐团不发送缴费通知
|
|
|
if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
|
|
@@ -1302,9 +1288,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, null, "",
|
|
|
HttpUtil.getSortUrl(studentApplyUrl));
|
|
|
}
|
|
|
-// sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
-// MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
|
|
|
-// studentApplyUrl);
|
|
|
}
|
|
|
|
|
|
return studentPaymentOrder;
|