|
@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.event.source.GroupEventSource;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -80,19 +81,6 @@ import com.ym.mec.biz.dal.entity.Subject;
|
|
|
import com.ym.mec.biz.dal.entity.SubjectChange;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.GoodsType;
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
|
import com.ym.mec.biz.service.ClassGroupService;
|
|
|
import com.ym.mec.biz.service.ClassGroupStudentMapperService;
|
|
@@ -213,14 +201,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
- List<StudentApplyDetailDto> dataList = null;
|
|
|
+ List<StudentApplyDetailDto> dataList = new ArrayList<>();
|
|
|
int count = studentRegistrationDao.queryStudentDetailCount(params);
|
|
|
if (queryInfo.getIsExport() && count > 50000) {
|
|
|
throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
- if (count > 0) {
|
|
|
- pageInfo.setTotal(count);
|
|
|
- params.put("offset", pageInfo.getOffset());
|
|
|
+ pageInfo.setTotal(count);
|
|
|
+ params.put("offset", pageInfo.getOffset());
|
|
|
+ if (queryInfo.getPage() <= pageInfo.getTotalPage()) {
|
|
|
dataList = studentRegistrationDao.queryStudentDetailPage(params);
|
|
|
Set<Integer> subjectIds = dataList.stream().map(e -> e.getActualSubjectId()).collect(Collectors.toSet());
|
|
|
Map<Integer, String> subjectMap = MapUtil.convertIntegerMap(musicGroupSubjectPlanDao.findSubjectMap(subjectIds, queryInfo.getMusicGroupId()));
|
|
@@ -235,9 +223,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if (count == 0) {
|
|
|
- dataList = new ArrayList<>();
|
|
|
- }
|
|
|
pageInfo.setRows(dataList);
|
|
|
return pageInfo;
|
|
|
}
|
|
@@ -275,7 +260,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
public StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId) {
|
|
|
StudentFeeDetailDto studentFeeDetailDto = new StudentFeeDetailDto();
|
|
|
List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, studentId);
|
|
|
- if(musicalList.size() <=0){
|
|
|
+ if (musicalList.size() <= 0) {
|
|
|
return studentFeeDetailDto;
|
|
|
}
|
|
|
MusicalListDetailDto detailDto = musicalList.get(0);
|
|
@@ -383,11 +368,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentRegistration.setUpdateTime(date);
|
|
|
studentRegistration.setUserId(sysUser.getId());
|
|
|
studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
|
|
|
- if(hasReg != null){
|
|
|
+ if (hasReg != null) {
|
|
|
studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
|
|
|
studentRegistration.setId(hasReg.getId());
|
|
|
studentRegistrationDao.update(studentRegistration);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
studentRegistrationDao.insert(studentRegistration);
|
|
|
}
|
|
|
|
|
@@ -677,7 +662,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
return null;
|
|
|
}
|
|
|
SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
|
|
|
- registration.setBalance(account==null?BigDecimal.ZERO : account.getBalance());
|
|
|
+ registration.setBalance(account == null ? BigDecimal.ZERO : account.getBalance());
|
|
|
registration.setTransferStudent(0);
|
|
|
return registration;
|
|
|
}
|
|
@@ -841,30 +826,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
- public void insertStudent(String studentIds,String oldMusicGroupId,String newMusicGroupId,Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect){
|
|
|
+ public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId, Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect) {
|
|
|
SysUser sysUser1 = sysUserFeignService.queryUserInfo();
|
|
|
//获取旧乐团学员注册信息
|
|
|
- List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds,oldMusicGroupId);
|
|
|
+ List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds, oldMusicGroupId);
|
|
|
List<StudentCourseFeeDetail> studentCourseFeeDetails = new ArrayList<>();
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
for (StudentRegistration studentRegistration : studentRegistrations) {
|
|
|
List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
|
|
|
- BigDecimal masterTotalPrice = details.stream().map(e->e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if(masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()){
|
|
|
+ BigDecimal masterTotalPrice = details.stream().map(e -> e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if (masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()) {
|
|
|
throw new BizException("用户信息发生变动,请重新提交");
|
|
|
}
|
|
|
- if(oldMusicGroupId == newMusicGroupId){
|
|
|
+ if (oldMusicGroupId == newMusicGroupId) {
|
|
|
continue;
|
|
|
}
|
|
|
- courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId),null, GroupType.MUSIC);
|
|
|
+ courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId), null, GroupType.MUSIC);
|
|
|
//记录课程余额消费日志
|
|
|
- if(studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d){
|
|
|
+ if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
|
|
|
StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
|
|
|
- if(studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()){
|
|
|
+ if (studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()) {
|
|
|
amount = masterTotalPrice;
|
|
|
studentCourseFeeDetail.setAmount(masterTotalPrice.negate());
|
|
|
studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().subtract(masterTotalPrice));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
amount = studentRegistration.getSurplusCourseFee();
|
|
|
studentCourseFeeDetail.setAmount(studentRegistration.getSurplusCourseFee().negate());
|
|
|
studentCourseFeeDetail.setSurplusCourseFee(BigDecimal.ZERO);
|
|
@@ -881,7 +866,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//用户是否在主乐团
|
|
|
StudentRegistration registration = studentRegistrationDao.getByPhoneAndMusicGroupId(newMusicGroupId, studentRegistration.getParentsPhone());
|
|
|
if (registration != null) {
|
|
|
- if(registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL){
|
|
|
+ if (registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL) {
|
|
|
orderFlag = false;
|
|
|
}
|
|
|
//修改剩余课程余额
|
|
@@ -891,7 +876,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
registration.setUpdateTime(date);
|
|
|
registration.setSurplusCourseFee(registration.getSurplusCourseFee().add(amount));
|
|
|
studentRegistrationDao.update(registration);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//生成学员乐团注册表
|
|
|
studentRegistration.setOrganId(musicGroupDao.get(newMusicGroupId).getOrganId());
|
|
|
studentRegistration.setSurplusCourseFee(amount);
|
|
@@ -902,11 +887,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//增加报名学生数
|
|
|
musicGroupSubjectPlanService.addApplyStudentNum(newMusicGroupId, studentRegistration.getActualSubjectId(), 1);
|
|
|
//新增Fee表
|
|
|
- MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(),newMusicGroupId);
|
|
|
- if(musicGroupStudentFee == null){
|
|
|
+ MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), newMusicGroupId);
|
|
|
+ if (musicGroupStudentFee == null) {
|
|
|
musicGroupStudentFee = new MusicGroupStudentFee(newMusicGroupId,
|
|
|
- studentRegistration.getUserId(), studentRegistration.getSubjectId(),BigDecimal.ZERO,
|
|
|
- null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus()==YES?PAID_COMPLETED:NON_PAYMENT);
|
|
|
+ studentRegistration.getUserId(), studentRegistration.getSubjectId(), BigDecimal.ZERO,
|
|
|
+ null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus() == YES ? PAID_COMPLETED : NON_PAYMENT);
|
|
|
musicGroupStudentFeeDao.insert(musicGroupStudentFee);
|
|
|
}
|
|
|
}
|
|
@@ -916,7 +901,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
waitPayOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
studentPaymentOrderService.update(waitPayOrder);
|
|
|
}
|
|
|
- if(orderFlag){
|
|
|
+ if (orderFlag) {
|
|
|
//生成订单
|
|
|
StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
studentPaymentOrder.setUserId(registration.getUserId());
|
|
@@ -933,7 +918,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
}
|
|
|
//主班新增余额日志
|
|
|
- if(amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d){
|
|
|
+ if (amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d) {
|
|
|
StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
|
|
|
studentCourseFeeDetail.setAmount(amount);
|
|
|
studentCourseFeeDetail.setSurplusCourseFee(registration.getSurplusCourseFee());
|
|
@@ -943,7 +928,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentCourseFeeDetails.add(studentCourseFeeDetail);
|
|
|
}
|
|
|
}
|
|
|
- if(studentCourseFeeDetails.size() > 0){
|
|
|
+ if (studentCourseFeeDetails.size() > 0) {
|
|
|
studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
|
|
|
}
|
|
|
}
|
|
@@ -1435,7 +1420,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
|
|
|
- if(StringUtils.isBlank(studentRegistration.getCertificateType())){
|
|
|
+ if (StringUtils.isBlank(studentRegistration.getCertificateType())) {
|
|
|
studentRegistration.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
|
|
|
}
|
|
|
StudentRegistration student = get(studentRegistration.getId());
|
|
@@ -1447,9 +1432,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
student.setIdCardNo(studentRegistration.getIdCardNo());
|
|
|
student.setGender(studentRegistration.getGender());
|
|
|
update(studentRegistration);
|
|
|
- studentRegistrationDao.updateUser(student.getUserId(),student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(),studentRegistration.getCertificateType());
|
|
|
+ studentRegistrationDao.updateUser(student.getUserId(), student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(), studentRegistration.getCertificateType());
|
|
|
// 添加用户电子签章账户
|
|
|
- if(CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())){
|
|
|
+ if (CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())) {
|
|
|
contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
|
|
|
}
|
|
|
return student;
|
|
@@ -1637,10 +1622,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
return amount;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
|
|
|
- return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
|
|
|
+ return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1661,8 +1646,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
public Boolean batchDelRegs(String musicGroupId, List<Integer> userIds) {
|
|
|
List<StudentRegistration> registrations = studentRegistrationDao.findStudentListByUserIdList(musicGroupId, userIds);
|
|
|
for (StudentRegistration registration : registrations) {
|
|
|
- if(registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN)||registration.getPaymentStatus().equals(PaymentStatusEnum.YES)){
|
|
|
- throw new BizException(registration.getName()+"("+registration.getPaymentStatus().getDesc()+"),不能删除");
|
|
|
+ if (registration.getPaymentStatus().equals(PaymentStatusEnum.OPEN) || registration.getPaymentStatus().equals(PaymentStatusEnum.YES)) {
|
|
|
+ throw new BizException(registration.getName() + "(" + registration.getPaymentStatus().getDesc() + "),不能删除");
|
|
|
}
|
|
|
}
|
|
|
if (registrations.size() <= 0) {
|
|
@@ -1690,6 +1675,65 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Override
|
|
|
public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
|
|
|
courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), null, GroupType.MUSIC);
|
|
|
- return this.findMusicGroupStudent(musicGroupId,null);
|
|
|
+ return this.findMusicGroupStudent(musicGroupId, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String checkRegOrPayStatus(String musicGroupId) {
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ if (musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
|
|
|
+ musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
|
|
|
+ musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
|
|
|
+ Date now = new Date();
|
|
|
+ MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
|
|
|
+ if (regCalender != null && regCalender.getDeadlinePaymentDate() != null) {
|
|
|
+ musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (musicGroup.getPaymentExpireDate() != null && now.compareTo(DateUtil.getLastTimeWithDay(musicGroup.getPaymentExpireDate())) > 0) {
|
|
|
+ return "乐团缴费时间已截止";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //储备中、进行中,乐团没有报名缴费项、有多批次缴费项不能缴费、有已上的课程不能缴费
|
|
|
+ if (musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
|
|
|
+ musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
|
|
|
+ MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroup.getId());
|
|
|
+ if (regCalender == null) {
|
|
|
+ return "乐团没有报名缴费项";
|
|
|
+ }
|
|
|
+ List<MusicGroupPaymentCalender> musicGroupCalenderBatchNoTimes = musicGroupPaymentCalenderDao.getMusicGroupCalenderBatchNoTimes(musicGroup.getId());
|
|
|
+ if (musicGroupCalenderBatchNoTimes.size() > 1) {
|
|
|
+ return "乐团已建多批次缴费";
|
|
|
+ }
|
|
|
+
|
|
|
+// Integer hasStartCourseNum = courseScheduleDao.getMusicGroupHasStartCourseNum(musicGroup.getId());
|
|
|
+// if (hasStartCourseNum != null && hasStartCourseNum > 0) {
|
|
|
+// return "乐团已开课";
|
|
|
+// }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Boolean> checkMusicGroupsRegOrPayStatus(List<String> ids) {
|
|
|
+ Map<String, Boolean> viewMap = new HashMap<>();
|
|
|
+ List<MusicGroupPaymentCalender> regCalenders = musicGroupPaymentCalenderDao.getMusicGroupRegCalenderByIds(ids);
|
|
|
+ for (MusicGroupPaymentCalender regCalender : regCalenders) {
|
|
|
+ viewMap.put(regCalender.getMusicGroupId(), true);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, List<MusicGroupPaymentCalender>> musicGroupBatchNoTimes = musicGroupPaymentCalenderDao.getMusicGroupCalenderBatchNoByIds(ids).stream().collect(Collectors.groupingBy(MusicGroupPaymentCalender::getMusicGroupId));
|
|
|
+ musicGroupBatchNoTimes.forEach((musicGroupId, calenders) -> {
|
|
|
+ if (viewMap.containsKey(musicGroupId) && calenders.size() > 1) {
|
|
|
+ viewMap.remove(musicGroupId);
|
|
|
+ }
|
|
|
+ });
|
|
|
+// List<CourseSchedule> musicGroupsHasStartCourseNums = courseScheduleDao.getMusicGroupsHasStartCourseNum(ids);
|
|
|
+// for (CourseSchedule musicGroupsHasStartCourseNum : musicGroupsHasStartCourseNums) {
|
|
|
+// if(viewMap.containsKey(musicGroupsHasStartCourseNum.getMusicGroupId())){
|
|
|
+// viewMap.remove(musicGroupsHasStartCourseNum.getMusicGroupId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+ return viewMap;
|
|
|
}
|
|
|
}
|