|
@@ -83,8 +83,8 @@ import com.ym.mec.util.http.HttpUtil;
|
|
|
@Service
|
|
|
public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, StudentRegistration> implements StudentRegistrationService {
|
|
|
|
|
|
- private static final Logger LOGGER = LoggerFactory.getLogger(StudentRegistrationServiceImpl.class);
|
|
|
-
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(StudentRegistrationServiceImpl.class);
|
|
|
+
|
|
|
@Resource
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
@Autowired
|
|
@@ -152,11 +152,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
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()));
|
|
|
- dataList.forEach(e->{
|
|
|
- if(StringUtils.isNotBlank(subjectMap.get(e.getActualSubjectId()))){
|
|
|
- e.setKitGroupPurchaseTypeEnum(KitGroupPurchaseTypeEnum.valueOf(subjectMap.get(e.getActualSubjectId())));
|
|
|
- }
|
|
|
+ Map<Integer, String> subjectMap = MapUtil.convertIntegerMap(musicGroupSubjectPlanDao.findSubjectMap(subjectIds, queryInfo.getMusicGroupId()));
|
|
|
+ dataList.forEach(e -> {
|
|
|
+ if (StringUtils.isNotBlank(subjectMap.get(e.getActualSubjectId()))) {
|
|
|
+ e.setKitGroupPurchaseTypeEnum(KitGroupPurchaseTypeEnum.valueOf(subjectMap.get(e.getActualSubjectId())));
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
if (count == 0) {
|
|
@@ -235,78 +235,78 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public StudentRegistration addStudent(StudentRegistration studentRegistration) throws Exception {
|
|
|
- String key = "_student_registration";
|
|
|
- long threadId = Thread.currentThread().getId();
|
|
|
- if (!redisCache.getLocked(key, threadId, 10)) {
|
|
|
- throw new BizException("系统繁忙,请稍后再试");
|
|
|
- }
|
|
|
- try {
|
|
|
- Date date = new Date();
|
|
|
- Integer userId = 0;
|
|
|
- SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
|
|
|
- if (sysUser == null) {
|
|
|
- sysUser = new SysUser();
|
|
|
- sysUser.setPhone(studentRegistration.getParentsPhone());
|
|
|
- sysUser.setCreateTime(date);
|
|
|
- sysUser.setUpdateTime(date);
|
|
|
- sysUser.setLockFlag(0);
|
|
|
- sysUser.setDelFlag(com.ym.mec.auth.api.enums.YesOrNoEnum.NO);
|
|
|
- sysUser.setUserType("STUDENT");
|
|
|
- sysUser.setGender(studentRegistration.getGender());
|
|
|
+ public StudentRegistration addStudent(StudentRegistration studentRegistration) throws Exception {
|
|
|
+ String key = "_student_registration";
|
|
|
+ long threadId = Thread.currentThread().getId();
|
|
|
+ if (!redisCache.getLocked(key, threadId, 10)) {
|
|
|
+ throw new BizException("系统繁忙,请稍后再试");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Date date = new Date();
|
|
|
+ Integer userId = 0;
|
|
|
+ SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
|
|
|
+ if (sysUser == null) {
|
|
|
+ sysUser = new SysUser();
|
|
|
+ sysUser.setPhone(studentRegistration.getParentsPhone());
|
|
|
+ sysUser.setCreateTime(date);
|
|
|
+ sysUser.setUpdateTime(date);
|
|
|
+ sysUser.setLockFlag(0);
|
|
|
+ sysUser.setDelFlag(com.ym.mec.auth.api.enums.YesOrNoEnum.NO);
|
|
|
+ sysUser.setUserType("STUDENT");
|
|
|
+ sysUser.setGender(studentRegistration.getGender());
|
|
|
sysUser.setOrganId(studentRegistration.getOrganId());
|
|
|
- sysUser.setRealName(studentRegistration.getParentsName());
|
|
|
- sysUser.setUsername(studentRegistration.getName());
|
|
|
- sysUser.setIdCardNo(studentRegistration.getIdCardNo());
|
|
|
- sysUser.setBirthdate(studentRegistration.getBirthdate());
|
|
|
- teacherDao.addSysUser(sysUser);
|
|
|
- userId = sysUser.getId();
|
|
|
- // 添加用户现金账户
|
|
|
- sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
- // 注册到融云
|
|
|
- if (StringUtils.isEmpty(sysUser.getAvatar())) {
|
|
|
- sysUser.setAvatar(sysConfigDao.findConfigValue(SysConfigService.USER_DEFAULT_HEAD_URL));
|
|
|
- }
|
|
|
- ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
|
|
|
- sysUser.setImToken(register.getToken());
|
|
|
- } else {
|
|
|
- if (!sysUser.getUserType().contains("STUDENT")) {
|
|
|
+ sysUser.setRealName(studentRegistration.getParentsName());
|
|
|
+ sysUser.setUsername(studentRegistration.getName());
|
|
|
+ sysUser.setIdCardNo(studentRegistration.getIdCardNo());
|
|
|
+ sysUser.setBirthdate(studentRegistration.getBirthdate());
|
|
|
+ teacherDao.addSysUser(sysUser);
|
|
|
+ userId = sysUser.getId();
|
|
|
+ // 添加用户现金账户
|
|
|
+ sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
+ // 注册到融云
|
|
|
+ if (StringUtils.isEmpty(sysUser.getAvatar())) {
|
|
|
+ sysUser.setAvatar(sysConfigDao.findConfigValue(SysConfigService.USER_DEFAULT_HEAD_URL));
|
|
|
+ }
|
|
|
+ ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
|
|
|
+ sysUser.setImToken(register.getToken());
|
|
|
+ } else {
|
|
|
+ if (!sysUser.getUserType().contains("STUDENT")) {
|
|
|
sysUser.setUserType(sysUser.getUserType() + ",STUDENT");
|
|
|
- }
|
|
|
- sysUser.setPhone(studentRegistration.getParentsPhone());
|
|
|
- sysUser.setOrganId(studentRegistration.getOrganId());
|
|
|
- sysUser.setRealName(studentRegistration.getParentsName());
|
|
|
- sysUser.setUsername(studentRegistration.getName());
|
|
|
- sysUser.setGender(studentRegistration.getGender());
|
|
|
- sysUser.setBirthdate(studentRegistration.getBirthdate());
|
|
|
- sysUser.setCreateTime(date);
|
|
|
- sysUser.setUpdateTime(date);
|
|
|
- teacherDao.updateUser(sysUser);
|
|
|
- }
|
|
|
-
|
|
|
- studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
|
|
|
- studentRegistration.setCreateTime(date);
|
|
|
- studentRegistration.setUpdateTime(date);
|
|
|
- studentRegistration.setUserId(sysUser.getId());
|
|
|
- studentRegistrationDao.insert(studentRegistration);
|
|
|
- studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
|
- // 增加报名学生数
|
|
|
- musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
|
|
|
- // 报名成功后,发送短信
|
|
|
- // String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
|
|
|
- String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
- Subject subject = subjectDao.get(studentRegistration.getActualSubjectId());
|
|
|
- // MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
-
|
|
|
- Map<Integer, String> map = new HashMap<>(1);
|
|
|
- map.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_APPLY_MESSAGE, map, null, 0, "",
|
|
|
- studentRegistration.getParentsName(), subject.getName(), serverPhone);
|
|
|
- } finally {
|
|
|
- redisCache.releaseLocked(key, threadId);
|
|
|
- }
|
|
|
- return studentRegistration;
|
|
|
- }
|
|
|
+ }
|
|
|
+ sysUser.setPhone(studentRegistration.getParentsPhone());
|
|
|
+ sysUser.setOrganId(studentRegistration.getOrganId());
|
|
|
+ sysUser.setRealName(studentRegistration.getParentsName());
|
|
|
+ sysUser.setUsername(studentRegistration.getName());
|
|
|
+ sysUser.setGender(studentRegistration.getGender());
|
|
|
+ sysUser.setBirthdate(studentRegistration.getBirthdate());
|
|
|
+ sysUser.setCreateTime(date);
|
|
|
+ sysUser.setUpdateTime(date);
|
|
|
+ teacherDao.updateUser(sysUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
|
|
|
+ studentRegistration.setCreateTime(date);
|
|
|
+ studentRegistration.setUpdateTime(date);
|
|
|
+ studentRegistration.setUserId(sysUser.getId());
|
|
|
+ studentRegistrationDao.insert(studentRegistration);
|
|
|
+ studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
|
+ // 增加报名学生数
|
|
|
+ musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
|
|
|
+ // 报名成功后,发送短信
|
|
|
+ // String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
|
|
|
+ String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
+ Subject subject = subjectDao.get(studentRegistration.getActualSubjectId());
|
|
|
+ // MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
+
|
|
|
+ Map<Integer, String> map = new HashMap<>(1);
|
|
|
+ map.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_APPLY_MESSAGE, map, null, 0, "",
|
|
|
+ studentRegistration.getParentsName(), subject.getName(), serverPhone);
|
|
|
+ } finally {
|
|
|
+ redisCache.releaseLocked(key, threadId);
|
|
|
+ }
|
|
|
+ return studentRegistration;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public StudentInfo queryStudentInfo(Integer userId) {
|
|
@@ -392,7 +392,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//增加缴费学生数
|
|
|
boolean updateFlag = false;
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
- if(amount.compareTo(BigDecimal.ZERO)==0){ //0元订单不增加报名人数
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) == 0) { //0元订单不增加报名人数
|
|
|
updateFlag = true;
|
|
|
break;
|
|
|
}
|
|
@@ -421,8 +421,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//关闭老订单
|
|
|
oldOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
studentPaymentOrderService.update(oldOrder);
|
|
|
- if(oldOrder.getBalancePaymentAmount() != null && oldOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) >0 ){
|
|
|
- sysUserCashAccountService.updateBalance(oldOrder.getUserId(), oldOrder.getBalancePaymentAmount(),PlatformCashAccountDetailTypeEnum.REFUNDS,"关闭订单");
|
|
|
+ if (oldOrder.getBalancePaymentAmount() != null && oldOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(oldOrder.getUserId(), oldOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
|
|
|
}
|
|
|
Date date = new Date();
|
|
|
StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
@@ -505,7 +505,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
|
|
|
StudentRegistration registration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
- if(registration == null){
|
|
|
+ if (registration == null) {
|
|
|
return null;
|
|
|
}
|
|
|
SysUserCashAccount account = sysUserCashAccountDao.getLocked(userId);
|
|
@@ -559,7 +559,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
sysUser.setImToken(register.getToken());
|
|
|
teacherDao.updateUser(sysUser);
|
|
|
} else {
|
|
|
- if(!sysUser.getUserType().contains("STUDENT")){
|
|
|
+ if (!sysUser.getUserType().contains("STUDENT")) {
|
|
|
sysUser.setUserType(sysUser.getUserType() + ",STUDENT");
|
|
|
}
|
|
|
sysUser.setPhone(studentRegistration.getParentsPhone());
|
|
@@ -591,11 +591,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
|
|
|
studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
|
|
|
}
|
|
|
- Date nextPaymentDate = musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null,null);
|
|
|
+ Date nextPaymentDate = musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null, null);
|
|
|
|
|
|
StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
|
|
|
|
|
|
- if(waitPayOrder != null){
|
|
|
+ if (waitPayOrder != null) {
|
|
|
waitPayOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
studentPaymentOrderService.update(waitPayOrder);
|
|
|
}
|
|
@@ -612,9 +612,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
|
|
|
if (studentPaymentOrderDetails == null) {
|
|
|
studentPaymentOrderDetails = new ArrayList<>();
|
|
|
- }else {
|
|
|
- studentPaymentOrderDetails.forEach(e->{
|
|
|
- if(e.getPrice() == null){
|
|
|
+ } else {
|
|
|
+ studentPaymentOrderDetails.forEach(e -> {
|
|
|
+ if (e.getPrice() == null) {
|
|
|
throw new BizException("请补全订单信息");
|
|
|
}
|
|
|
});
|
|
@@ -636,14 +636,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
|
|
|
userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
|
|
|
- nextPaymentDate, studentAddDto.getTemporaryCourseFee(),paymentStatus));
|
|
|
- musicGroupStudentFeeDao.updateCalender(userId,musicGroupId);
|
|
|
+ nextPaymentDate, studentAddDto.getTemporaryCourseFee(), paymentStatus));
|
|
|
+ musicGroupStudentFeeDao.updateCalender(userId, musicGroupId);
|
|
|
studentPaymentOrder.setExpectAmount(reduce);
|
|
|
//当前学员是否以前存在过当前乐团
|
|
|
- if(phoneAndMusicGroupId != null){
|
|
|
+ if (phoneAndMusicGroupId != null) {
|
|
|
studentRegistration.setId(phoneAndMusicGroupId.getId());
|
|
|
studentRegistrationDao.update(studentRegistration);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
studentRegistrationDao.insertBasic(studentRegistration);
|
|
|
}
|
|
|
studentRegistrationDao.updateCurrentClass(studentRegistration);
|
|
@@ -652,29 +652,29 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
e.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
});
|
|
|
studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
|
|
|
+ if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
Map<Integer, String> receivers = new HashMap<>(1);
|
|
|
receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
|
|
|
if (reduce == BigDecimal.ZERO) {
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
|
|
|
receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT, receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(), HttpUtil.getSortUrl(studentApplyUrl));
|
|
|
}
|
|
|
}
|
|
|
return userId;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<CourseSchedule> addStudent(Integer classGroupId,Integer userId,Date date,List<CourseSchedule> courseScheduleList){
|
|
|
+ private List<CourseSchedule> addStudent(Integer classGroupId, Integer userId, Date date, List<CourseSchedule> courseScheduleList) {
|
|
|
ClassGroup classGroup = classGroupDao.get(classGroupId);
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId,null);
|
|
|
- if(classGroupStudentMapper != null){
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId, null);
|
|
|
+ if (classGroupStudentMapper != null) {
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
classGroupStudentMapperDao.update(classGroupStudentMapper);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
classGroupStudentMapper.setClassGroupId(classGroupId);
|
|
@@ -690,7 +690,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
// classGroupDao.updateClassStudentNum(classGroupId.longValue(), 1);
|
|
|
//3、学生加入新班级未开始课程
|
|
|
List<CourseSchedule> noStartCoursesByClassGroupId = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
|
|
|
- if(noStartCoursesByClassGroupId != null && noStartCoursesByClassGroupId.size() > 0){
|
|
|
+ if (noStartCoursesByClassGroupId != null && noStartCoursesByClassGroupId.size() > 0) {
|
|
|
courseScheduleList.addAll(noStartCoursesByClassGroupId);
|
|
|
}
|
|
|
return courseScheduleList;
|
|
@@ -702,22 +702,22 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
String musicGroupId = studentAddDto.getStudentRegistration().getMusicGroupId();
|
|
|
Integer signClassId = studentAddDto.getSignClassId();
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
- if(signClassId != null){
|
|
|
- addStudent(signClassId,userId,nowDate,courseScheduleList);
|
|
|
+ if (signClassId != null) {
|
|
|
+ addStudent(signClassId, userId, nowDate, courseScheduleList);
|
|
|
}
|
|
|
Integer mixClassId = studentAddDto.getMixClassId();
|
|
|
- if(mixClassId != null){
|
|
|
- addStudent(mixClassId,userId,nowDate,courseScheduleList);
|
|
|
+ if (mixClassId != null) {
|
|
|
+ addStudent(mixClassId, userId, nowDate, courseScheduleList);
|
|
|
}
|
|
|
Integer highClassId = studentAddDto.getHighClassId();
|
|
|
- if(highClassId != null){
|
|
|
- addStudent(highClassId,userId,nowDate,courseScheduleList);
|
|
|
+ if (highClassId != null) {
|
|
|
+ addStudent(highClassId, userId, nowDate, courseScheduleList);
|
|
|
}
|
|
|
String snapClassIds = studentAddDto.getSnapClassIds();
|
|
|
- if(StringUtils.isNotEmpty(snapClassIds)){
|
|
|
+ if (StringUtils.isNotEmpty(snapClassIds)) {
|
|
|
String[] split = snapClassIds.split(",");
|
|
|
- for (int i = 0;i < split.length;i++){
|
|
|
- addStudent(Integer.parseInt(split[i]),userId,nowDate,courseScheduleList);
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ addStudent(Integer.parseInt(split[i]), userId, nowDate, courseScheduleList);
|
|
|
}
|
|
|
}
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
@@ -761,7 +761,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
public StudentPaymentOrder updateApplyOrder(StudentPaymentOrder studentPaymentOrder) throws Exception {
|
|
|
//更新订单状态
|
|
|
int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
- if(updateCount <=0 ){
|
|
|
+ if (updateCount <= 0) {
|
|
|
throw new BizException("订单更新失败");
|
|
|
}
|
|
|
Date nowDate = new Date();
|
|
@@ -771,7 +771,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
|
|
|
|
|
|
if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
|
|
|
- if(studentRegistration.getTemporaryCourseFee() != null){
|
|
|
+ if (studentRegistration.getTemporaryCourseFee() != null) {
|
|
|
studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
}
|
|
|
studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
|
|
@@ -795,8 +795,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
//插入交易明细
|
|
|
- SysUserCashAccount cashAccount = sysUserCashAccountService.get(studentRegistration.getUserId());
|
|
|
BigDecimal amount = studentPaymentOrder.getActualAmount();
|
|
|
+ SysUserCashAccount cashAccount = sysUserCashAccountService.get(studentRegistration.getUserId());
|
|
|
//充值
|
|
|
SysUserCashAccountDetail rechargeDetail = new SysUserCashAccountDetail();
|
|
|
rechargeDetail.setAmount(amount);
|
|
@@ -825,7 +825,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
paymentDetail.setUpdateTime(nowDate);
|
|
|
paymentDetail.setUserId(studentRegistration.getUserId());
|
|
|
rechargeDetail.setChannel(studentPaymentOrder.getPaymentChannel());
|
|
|
- if(studentPaymentOrder.getComAmount() != null){
|
|
|
+ if (studentPaymentOrder.getComAmount() != null) {
|
|
|
rechargeDetail.setComAmount(studentPaymentOrder.getComAmount().negate());
|
|
|
rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
|
|
|
}
|
|
@@ -834,7 +834,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
//三方乐团不发送缴费通知
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
|
|
|
+ if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
//发送缴费成功通知(短信 + push)
|
|
|
Map<Integer, String> map = new HashMap<>(1);
|
|
|
map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
|
|
@@ -849,37 +849,37 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
|
|
|
}
|
|
|
// //生成课程协议
|
|
|
- try {
|
|
|
- contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
|
|
|
- // 商品协议(租赁时候有)
|
|
|
- if (musicOneSubjectClassPlan.getKitGroupPurchaseType()!= null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
- StudentPaymentOrderDetail applyOrderMusical = studentPaymentOrderDetailService.findApplyOrderMusical(studentPaymentOrder.getId());
|
|
|
- if (applyOrderMusical != null && applyOrderMusical.getGoodsIdList() != null && !applyOrderMusical.getGoodsIdList().equals("")) {
|
|
|
- contractService.transferGoodsContract(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId(),
|
|
|
- applyOrderMusical.getGoodsIdList(), musicOneSubjectClassPlan.getKitGroupPurchaseType());
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- LOGGER.error("协议生成失败",e);
|
|
|
- }
|
|
|
+ try {
|
|
|
+ contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
|
|
|
+ // 商品协议(租赁时候有)
|
|
|
+ if (musicOneSubjectClassPlan.getKitGroupPurchaseType() != null && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
+ StudentPaymentOrderDetail applyOrderMusical = studentPaymentOrderDetailService.findApplyOrderMusical(studentPaymentOrder.getId());
|
|
|
+ if (applyOrderMusical != null && applyOrderMusical.getGoodsIdList() != null && !applyOrderMusical.getGoodsIdList().equals("")) {
|
|
|
+ contractService.transferGoodsContract(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId(),
|
|
|
+ applyOrderMusical.getGoodsIdList(), musicOneSubjectClassPlan.getKitGroupPurchaseType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOGGER.error("协议生成失败", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
//减去缴费人数
|
|
|
if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED)) {
|
|
|
- if(studentPaymentOrder.getActualAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ if (studentPaymentOrder.getActualAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
musicOneSubjectClassPlan.setPaidStudentNum(musicOneSubjectClassPlan.getPaidStudentNum() - 1);
|
|
|
updateCount = musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
|
|
|
if (updateCount <= 0) {
|
|
|
throw new BizException("减去缴费人数失败");
|
|
|
}
|
|
|
}
|
|
|
- if(studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) >0 ){
|
|
|
- sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(),PlatformCashAccountDetailTypeEnum.REFUNDS,"报名缴费失败");
|
|
|
+ if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "报名缴费失败");
|
|
|
}
|
|
|
MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
//三方乐团不发送缴费通知
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
|
|
|
+ if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
|
|
|
Map<Integer, String> map = new HashMap<>(1);
|
|
|
map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
|
|
@@ -947,21 +947,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
public int openPayment(String ids) throws IOException {
|
|
|
- if(StringUtils.isNotEmpty(ids)){
|
|
|
+ if (StringUtils.isNotEmpty(ids)) {
|
|
|
//发送短信通知
|
|
|
- List<Long> list = JSONObject.parseArray(JSONObject.toJSONString(Arrays.asList(ids.split(","))),Long.class);
|
|
|
+ List<Long> list = JSONObject.parseArray(JSONObject.toJSONString(Arrays.asList(ids.split(","))), Long.class);
|
|
|
MusicGroup musicGroup = musicGroupDao.findMusicGroup(list);
|
|
|
//三方乐团不发送缴费通知
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
|
|
|
+ if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
|
|
|
List<StudentRegistration> registrations = studentRegistrationDao.findStudentListByIdList(list);
|
|
|
String configValue = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL);
|
|
|
- HashMap<Integer,String> receivers = new HashMap<>(registrations.size());
|
|
|
- registrations.forEach(e->{
|
|
|
- receivers.put(e.getUserId(),e.getParentsPhone());
|
|
|
+ HashMap<Integer, String> receivers = new HashMap<>(registrations.size());
|
|
|
+ registrations.forEach(e -> {
|
|
|
+ receivers.put(e.getUserId(), e.getParentsPhone());
|
|
|
});
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
|
|
|
- MessageTypeEnum.SMS_STUDENT_OPEN_PAYMENT,receivers,null,0,null,
|
|
|
- musicGroup.getName(),HttpUtil.getSortUrl(configValue + musicGroup.getId()));
|
|
|
+ MessageTypeEnum.SMS_STUDENT_OPEN_PAYMENT, receivers, null, 0, null,
|
|
|
+ musicGroup.getName(), HttpUtil.getSortUrl(configValue + musicGroup.getId()));
|
|
|
}
|
|
|
}
|
|
|
return studentRegistrationDao.batchOpenPay(ids, PaymentStatusEnum.OPEN);
|