|
|
@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
|
|
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 org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -65,30 +66,6 @@ import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
|
import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
|
|
|
import com.ym.mec.biz.event.source.GroupEventSource;
|
|
|
-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.CourseScheduleStudentPaymentService;
|
|
|
-import com.ym.mec.biz.service.GoodsService;
|
|
|
-import com.ym.mec.biz.service.ImGroupMemberService;
|
|
|
-import com.ym.mec.biz.service.ImGroupService;
|
|
|
-import com.ym.mec.biz.service.ImUserFriendService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
|
|
|
-import com.ym.mec.biz.service.PayService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
-import com.ym.mec.biz.service.StudentService;
|
|
|
-import com.ym.mec.biz.service.SysConfigService;
|
|
|
-import com.ym.mec.biz.service.SysCouponCodeService;
|
|
|
-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.ImGroupMember;
|
|
|
@@ -134,79 +111,54 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
private MusicGroupPurchaseListDao musicGroupPurchaseListDao;
|
|
|
@Autowired
|
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private MusicGroupQuitDao musicGroupQuitDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ClassGroupDao classGroupDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private OrganizationDao organizationDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CooperationOrganDao cooperationOrganDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private TeacherAttendanceDao teacherAttendanceDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private PayService payService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysMessageService sysMessageService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
- private SysTenantConfigDao sysTenantConfigDao;
|
|
|
-
|
|
|
+ private SysTenantConfigService sysTenantConfigService;
|
|
|
@Autowired
|
|
|
private ClassGroupService classGroupService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
|
|
|
@Autowired
|
|
|
@@ -527,7 +479,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("操作失败:只有乐团在[{}]状态才能操作", MusicGroupStatusEnum.PRE_APPLY.getMsg());
|
|
|
}
|
|
|
if (isCheckStudentNum) {
|
|
|
- String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.MUSIC_MIN_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
+ String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.MUSIC_MIN_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
if(StringUtils.isNotEmpty(configValue)){
|
|
|
Integer minStudentNum = Integer.parseInt(configValue);
|
|
|
// 查询乐团已报名人数
|
|
|
@@ -720,7 +672,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("报名信息有误,请核查");
|
|
|
}
|
|
|
|
|
|
- MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
|
|
|
+ MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(studentRegistration.getMusicGroupId());
|
|
|
if(musicGroupRegCalender == null){
|
|
|
throw new BizException("缴费信息不存在");
|
|
|
}
|
|
|
@@ -792,7 +744,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
//新课程形态
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCourses = new ArrayList<>();
|
|
|
- if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
|
|
|
+ if (musicGroupRegCalender.getPayUserType() == PayUserType.STUDENT && registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
|
|
|
newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
|
|
|
for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
|
|
|
if (remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()) {
|
|
|
@@ -993,12 +945,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(payStatus != PayStatus.FAILED){
|
|
|
if(payStatus == PayStatus.SUCCESSED){
|
|
|
throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
- MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
|
|
|
+ MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(studentRegistration.getMusicGroupId());
|
|
|
if(musicGroupRegCalender == null){
|
|
|
throw new BizException("缴费信息不存在");
|
|
|
}
|
|
|
@@ -1072,7 +1024,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
//新课程形态
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> newCourses = new ArrayList<>();
|
|
|
- if (registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
|
|
|
+ if (musicGroupRegCalender.getPayUserType() == PayUserType.STUDENT && registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
|
|
|
newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
|
|
|
for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
|
|
|
if (remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()) {
|
|
|
@@ -1461,7 +1413,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("乐团机构信息异常,请联系管理员");
|
|
|
}
|
|
|
//预报名开关
|
|
|
- String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.MUSIC_PRE_APPLY_OPEN_FLAG, musicGroup.getTenantId());
|
|
|
+ String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.MUSIC_PRE_APPLY_OPEN_FLAG, musicGroup.getTenantId());
|
|
|
if(StringUtils.isNotEmpty(configValue) && configValue.equals(1)){
|
|
|
//记录操作日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 预报名)", sysUser.getId(), ""));
|
|
|
@@ -1686,14 +1638,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}*/
|
|
|
//获取当前乐团所有已报名学员
|
|
|
List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
|
|
|
- if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
+ String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.REFUND_PERIOD, musicGroup.getTenantId());
|
|
|
+ if (StringUtils.isNotEmpty(configValue) && musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
if (registrations != null && registrations.size() > 0) {
|
|
|
Map<Integer, String> map = new HashMap<>(registrations.size());
|
|
|
registrations.forEach(e -> {
|
|
|
map.put(e.getUserId(), e.getUserId().toString());
|
|
|
});
|
|
|
sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_CLOSE,
|
|
|
- map, null, 0, "1", "STUDENT", musicGroup.getName(), sysConfigDao.findConfigValue(SysConfigService.REFUND_PERIOD));
|
|
|
+ map, null, 0, "1", "STUDENT", musicGroup.getName(), configValue);
|
|
|
}
|
|
|
}
|
|
|
//将学生退团
|
|
|
@@ -2767,6 +2720,255 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
+ public void directQuitMusicGroupOa(String musicGroupId, Integer userId, String reason, boolean isRefundInstrumentFee,
|
|
|
+ boolean isRefundTeachingAssistantsFee, boolean maintenanceFee,BigDecimal amount) {
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ if (musicGroup == null) {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ if (studentRegistration == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
|
|
|
+ if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL && currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.APPLY) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 有进行中的课程不能退团
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
|
|
|
+ "UNDERWAY", userId);
|
|
|
+ if (courseScheduleList != null && courseScheduleList.size() > 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean hasPaid = studentRegistration.getMusicGroupStatus().equals(StudentMusicGroupStatusEnum.NORMAL);
|
|
|
+
|
|
|
+ //如果是会员团,并且有预排课计划
|
|
|
+ MusicGroupSchoolTermCourseDetail termCourseDetail = musicGroupSchoolTermCourseDetailDao.findByCourseDateAndMusicGroupId(musicGroupId, null, 0);
|
|
|
+ if(termCourseDetail != null){
|
|
|
+ //是否已经预排部分课程
|
|
|
+ List<CourseSchedule> courseSchedules = courseScheduleDao.queryPreCourseListByMusicGroupId(musicGroup.getId());
|
|
|
+ if(courseSchedules.size() > 0){
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+ musicGroupSchoolTermStudentCourseDetailDao.deleteByDetailId(termCourseDetail.getId(),userId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), Arrays.asList(userId), GroupType.MUSIC);
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+
|
|
|
+ MusicGroupQuit musicGroupQuit = new MusicGroupQuit();
|
|
|
+ musicGroupQuit.setCreateTime(date);
|
|
|
+ musicGroupQuit.setJoinDate(studentRegistration.getCreateTime());
|
|
|
+ musicGroupQuit.setMusicGroupId(musicGroupId);
|
|
|
+ musicGroupQuit.setUserId(userId);
|
|
|
+ musicGroupQuit.setStatus(ApprovalStatus.APPROVED);
|
|
|
+ musicGroupQuit.setReason(reason);
|
|
|
+ musicGroupQuit.setQuitDate(date);
|
|
|
+ musicGroupQuitDao.insert(musicGroupQuit);
|
|
|
+
|
|
|
+ List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
|
|
|
+ for (Integer classGroupId : classGroupIdList) {
|
|
|
+ ClassGroup classGroup = classGroupService.get(classGroupId);
|
|
|
+ if (classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
|
|
|
+ classGroupService.delSingle(classGroupId);
|
|
|
+ } else {
|
|
|
+ classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除续费周期
|
|
|
+ musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+
|
|
|
+ // 退团
|
|
|
+ studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
|
|
|
+ studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
|
|
|
+ studentRegistration.setHasCloudTeacher(0);
|
|
|
+ studentRegistration.setUpdateTime(date);
|
|
|
+ studentRegistrationDao.update(studentRegistration);
|
|
|
+
|
|
|
+ //删除进行中加学生,且在审批中或拒绝的缴费
|
|
|
+ List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
|
|
|
+ if (paymentCalenderIdList != null && paymentCalenderIdList.size() > 0) {
|
|
|
+ musicGroupPaymentCalenderDao.delByIds(paymentCalenderIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询未交费的项目
|
|
|
+ List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+
|
|
|
+ for (MusicGroupPaymentCalenderDetail mgpcd : musicGroupPaymentCalenderDetailList) {
|
|
|
+ MusicGroupPaymentCalender mgpc = musicGroupPaymentCalenderDao.get(mgpcd.getMusicGroupPaymentCalenderId());
|
|
|
+ if (mgpc != null) {
|
|
|
+ if (mgpc.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
+ musicGroupPaymentCalenderDao.delete(mgpc.getId());
|
|
|
+ } else {
|
|
|
+ // 缴费项目预计人数减一
|
|
|
+ mgpc.setExpectNum(mgpc.getExpectNum() - 1);
|
|
|
+ mgpc.setUpdateTime(date);
|
|
|
+ musicGroupPaymentCalenderDao.update(mgpc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
|
|
|
+ }
|
|
|
+ //删除用户购买的课程记录
|
|
|
+ musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+
|
|
|
+ List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
|
|
|
+
|
|
|
+ if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
|
|
|
+ if(currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.NORMAL || (currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.APPLY && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES)){
|
|
|
+ studentPaymentOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(userId, studentRegistration.getMusicGroupPaymentCalenderId() + "",
|
|
|
+ DealStatusEnum.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断乐器是否是租赁
|
|
|
+ MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
|
|
|
+ if (hasPaid && musicGroupSubjectPlan != null) {
|
|
|
+ musicGroupSubjectPlan.setUpdateTime(date);
|
|
|
+ //减去缴费人数(器乐收费,0元时不减缴费人数)
|
|
|
+ if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
|
|
|
+
|
|
|
+ for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
|
|
|
+ if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
|
|
|
+ musicGroupSubjectPlan.setPaidZeroNum(musicGroupSubjectPlan.getPaidZeroNum() - 1);
|
|
|
+ musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
|
|
|
+ break;
|
|
|
+ } else if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() == null) {
|
|
|
+ musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
|
|
|
+ }
|
|
|
+ musicGroupSubjectPlanDao.update(musicGroupSubjectPlan);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (MusicGroupStatusEnum.PROGRESS.equals(musicGroup.getStatus())) {
|
|
|
+ //统计变更学员数
|
|
|
+ groupEventSource.musicGroupStudentChangeEvent(musicGroupId, StudentMusicGroupStatusEnum.QUIT, new ArrayList<>(Arrays.asList(userId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (studentPaymentOrderList.size() > 0) {
|
|
|
+
|
|
|
+ List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ Long minPaymentOrderId = Collections.min(paymentOrderIdList);
|
|
|
+
|
|
|
+ List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
|
|
|
+
|
|
|
+ SubjectChange studentLastChange = null;
|
|
|
+ if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
|
|
|
+ studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (studentLastChange != null && minPaymentOrderId <= studentLastChange.getOriginalOrderId()) {
|
|
|
+ if (isRefundInstrumentFee) {
|
|
|
+ StudentInstrument studentMaintenance = studentInstrumentDao.getByOrderId(studentLastChange.getOrderId().longValue());
|
|
|
+ if (studentMaintenance != null) {
|
|
|
+ studentMaintenance.setDelFlag(1);
|
|
|
+ studentInstrumentDao.update(studentMaintenance);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (StudentPaymentOrderDetail detail : orderDetailList) {
|
|
|
+ // 退乐器费用
|
|
|
+ if (isRefundInstrumentFee && detail.getType() == MUSICAL) {
|
|
|
+ StudentInstrument studentMaintenance = studentInstrumentDao.getStudentMaintenance(userId, musicGroupId);
|
|
|
+ if (studentMaintenance != null) {
|
|
|
+ studentMaintenance.setDelFlag(1);
|
|
|
+ studentInstrumentDao.update(studentMaintenance);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //退乐保费用
|
|
|
+ if (maintenanceFee) {
|
|
|
+ StudentInstrument studentMaintenance = studentInstrumentDao.getStudentMaintenance(userId, musicGroupId);
|
|
|
+ if (studentMaintenance != null) {
|
|
|
+ studentMaintenance.setStatus(0);
|
|
|
+ studentMaintenance.setStartTime(null);
|
|
|
+ studentMaintenance.setEndTime(null);
|
|
|
+ studentInstrumentDao.update(studentMaintenance);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (amount.doubleValue() > 0) {
|
|
|
+ //这个接口没有退费的操作了
|
|
|
+ SysUserCashAccountLog sysUserCashAccountLog = new SysUserCashAccountLog();
|
|
|
+ sysUserCashAccountLog.setGroupType(GroupType.MUSIC);
|
|
|
+ sysUserCashAccountLog.setUserId(userId);
|
|
|
+ sysUserCashAccountLog.setOrganId(musicGroup.getOrganId());
|
|
|
+ sysUserCashAccountLog.setGroupId(musicGroupId);
|
|
|
+ sysUserCashAccountLog.setAmount(amount);
|
|
|
+ sysUserCashAccountLog.setReturnFeeType(ReturnFeeEnum.MUSIC);
|
|
|
+ sysUserCashAccountLog.setComment("OA审批退团");
|
|
|
+ sysUserCashAccountLogDao.insert(sysUserCashAccountLog);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void checkDirectQuitMusicGroupOa(String musicGroupId, Integer userId) {
|
|
|
+ SysUser user = teacherDao.getUser(userId);
|
|
|
+ if (user == null) {
|
|
|
+ throw new BizException("学员 {} 信息不存在",userId);
|
|
|
+ }
|
|
|
+ Student student = studentDao.get(userId);
|
|
|
+ if(student == null){
|
|
|
+ throw new BizException("学员 {} 信息不存在",userId);
|
|
|
+ }
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ if (musicGroup == null) {
|
|
|
+ throw new BizException("乐团 {} 不存在",musicGroupId);
|
|
|
+ }
|
|
|
+ if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
|
|
|
+ throw new BizException("退团失败,乐团 {} {} 状态[已取消]或[已暂停]",musicGroupId,musicGroup.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ if (studentRegistration == null) {
|
|
|
+ throw new BizException("学员 {} {} 注册信息不存在",userId,user.getUsername());
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
|
|
|
+ if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL && currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.APPLY) {
|
|
|
+ throw new BizException("学员 {} {} 当前在团状态不能退团",userId,user.getUsername());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 有进行中的课程不能退团
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
|
|
|
+ "UNDERWAY", userId);
|
|
|
+ if (courseScheduleList != null && courseScheduleList.size() > 0) {
|
|
|
+ throw new BizException("学员 {} {} 存在[进行中]的课程",userId,user.getUsername());
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果是会员团,并且有预排课计划
|
|
|
+ MusicGroupSchoolTermCourseDetail termCourseDetail = musicGroupSchoolTermCourseDetailDao.findByCourseDateAndMusicGroupId(musicGroupId, null, 0);
|
|
|
+ if(termCourseDetail != null){
|
|
|
+ //是否已经预排部分课程
|
|
|
+ List<CourseSchedule> courseSchedules = courseScheduleDao.queryPreCourseListByMusicGroupId(musicGroup.getId());
|
|
|
+ if(courseSchedules.size() > 0){
|
|
|
+ throw new BizException("乐团 {} {} 存在预排课课程,请优先完成预排课",musicGroupId,musicGroup.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public Map renew(RenewParamDto renewParamDto) throws Exception {
|
|
|
Long calenderId = renewParamDto.getCalenderId();
|
|
|
Integer userId = renewParamDto.getUserId();
|
|
|
@@ -2790,9 +2992,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(payStatus != PayStatus.FAILED){
|
|
|
if(payStatus == PayStatus.SUCCESSED){
|
|
|
throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
oldStudentPaymentOrder.setStatus(CLOSE);
|
|
|
studentPaymentOrderService.update(oldStudentPaymentOrder);
|
|
|
@@ -3668,9 +3870,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
Integer paymentStudentNum = studentRegistrationDao.getPaymentStudentNum(musicGroupId);
|
|
|
|
|
|
//若乐团新建团,则操作【确认开团】时,若【已缴费】学员达到98人,则无需对【未缴费】学员新增回访
|
|
|
- String configValue = sysTenantConfigDao.getConfigValue(SysConfigService.NEW_MUSIC_PAYMENT_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
+ String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.NEW_MUSIC_PAYMENT_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
//若乐团不是新建团,则操作【确认开团】时,若【已缴费】学员达到58人,则无需对【未缴费】学员新增回访
|
|
|
- String configValue1 = sysTenantConfigDao.getConfigValue(SysConfigService.OLD_MUSIC_PAYMENT_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
+ String configValue1 = sysTenantConfigService.getTenantConfigValue(SysConfigService.OLD_MUSIC_PAYMENT_STUDENT_NUM, musicGroup.getTenantId());
|
|
|
if ((StringUtils.isNotEmpty(configValue) && cooperationMusicGroupNum <= 0 && paymentStudentNum < Integer.parseInt(configValue)) ||
|
|
|
(StringUtils.isNotEmpty(configValue1) && cooperationMusicGroupNum > 0 && paymentStudentNum < Integer.parseInt(configValue1))) {
|
|
|
checkStudentVisit(musicGroupId);
|