|
@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
import com.ym.mec.auth.api.enums.SysUserType;
|
|
|
import com.ym.mec.auth.api.enums.UserLockFlag;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.StudentAddDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentInfo;
|
|
@@ -15,6 +16,7 @@ import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.ImResult;
|
|
|
import com.ym.mec.common.entity.ImUserModel;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
@@ -51,7 +53,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Autowired
|
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
|
@Autowired
|
|
|
- private SysMessageConfigDao sysMessageConfigDao;
|
|
|
+ private ClassGroupRelationDao classGroupRelationDao;
|
|
|
@Autowired
|
|
|
private SysMessageService sysMessageService;
|
|
|
@Autowired
|
|
@@ -109,20 +111,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
public Integer batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
|
|
|
//获取当前学员的当前声部
|
|
|
StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
- if(studentRegistration == null){
|
|
|
+ if (studentRegistration == null) {
|
|
|
throw new Exception("学员信息不存在");
|
|
|
}
|
|
|
//当前专业报名人数减一
|
|
|
- musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
|
|
|
+ musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getActualSubjectId(), -1);
|
|
|
//批量调剂(未缴费学员)
|
|
|
int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
|
|
|
//修改专业已报名人数
|
|
|
- musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
|
|
|
+ musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, subId, 1);
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
Set<Integer> roleIds = new HashSet<>(2);
|
|
|
roleIds.add(SysUserRole.SECTION_MANAGER);
|
|
|
roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
|
|
|
- sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.BACKSTAGE_STUDENT_SUBJECT_CHANGE,"",musicGroup.getName());
|
|
|
+ sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_STUDENT_SUBJECT_CHANGE, "", musicGroup.getName());
|
|
|
return studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
|
|
|
}
|
|
|
|
|
@@ -187,10 +189,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
userId = sysUser.getId();
|
|
|
//添加用户现金账户
|
|
|
sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
- // 添加用户电子签章账户
|
|
|
- //contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
|
|
|
+ // 添加用户电子签章账户
|
|
|
+ //contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
|
|
|
//注册到融云
|
|
|
- if(StringUtils.isEmpty(sysUser.getAvatar())){
|
|
|
+ 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()));
|
|
@@ -203,19 +205,19 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentRegistration.setUserId(sysUser.getId());
|
|
|
studentRegistrationDao.insert(studentRegistration);
|
|
|
//增加报名学生数
|
|
|
- musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
|
|
|
+ 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());
|
|
|
+ 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(), HttpUtil.getSortUrl(studentApplyUrl),
|
|
|
- DateUtil.format(musicGroup.getApplyExpireDate(),DateUtil.DATE_FORMAT_MIN),serverPhone);
|
|
|
+ MessageTypeEnum.SMS_APPLY_MESSAGE, map, null, 0, "",
|
|
|
+ studentRegistration.getParentsName(), subject.getName(), HttpUtil.getSortUrl(studentApplyUrl),
|
|
|
+ DateUtil.format(musicGroup.getApplyExpireDate(), DateUtil.DATE_FORMAT_MIN), serverPhone);
|
|
|
return studentRegistration;
|
|
|
}
|
|
|
|
|
@@ -273,14 +275,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (goodsList != null) {
|
|
|
for (Goods goods : goodsList) {
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
|
|
|
- studentPaymentOrderDetail4goods.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
+ OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
|
|
|
+ studentPaymentOrderDetail4goods.setType(orderDetailType);
|
|
|
studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
|
|
|
studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
|
|
|
studentPaymentOrderDetail4goods.setCreateTime(date);
|
|
|
studentPaymentOrderDetail4goods.setUpdateTime(date);
|
|
|
studentPaymentOrderDetail4goods.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goods);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
//单独教谱
|
|
@@ -303,8 +305,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
|
|
|
int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
|
|
|
musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
|
|
|
- if(musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()){
|
|
|
- throw new Exception("乐团人数已满");
|
|
|
+ if (studentRegistration.getTemporaryCourseFee() == null && musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()) {
|
|
|
+ throw new BizException("乐团人数已满");
|
|
|
}
|
|
|
musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
|
|
|
return studentPaymentOrder;
|
|
@@ -362,7 +364,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (goodsList != null) {
|
|
|
for (Goods goods : goodsList) {
|
|
|
StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
|
|
|
- studentPaymentOrderDetail4goods.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
+ OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
|
|
|
+ studentPaymentOrderDetail4goods.setType(orderDetailType);
|
|
|
studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
|
|
|
studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
|
|
|
studentPaymentOrderDetail4goods.setCreateTime(date);
|
|
@@ -403,8 +406,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Integer insertStudent(StudentRegistration studentRegistration) throws Exception {
|
|
|
- StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
|
|
|
+ public Integer insertStudent(StudentAddDto studentAddDto) throws Exception {
|
|
|
+ StudentRegistration studentRegistration = studentAddDto.getStudentRegistration();
|
|
|
+ if (studentRegistration == null) {
|
|
|
+ throw new Exception("参数校验失败");
|
|
|
+ }
|
|
|
+ String musicGroupId = studentRegistration.getMusicGroupId();
|
|
|
+ StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone());
|
|
|
if (phoneAndMusicGroupId != null) {
|
|
|
throw new Exception("该学员已存在");
|
|
|
} else {
|
|
@@ -425,7 +433,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//添加用户电子签章账户
|
|
|
contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
|
|
|
//注册到融云
|
|
|
- if(StringUtils.isEmpty(sysUser.getAvatar())){
|
|
|
+ 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()));
|
|
@@ -436,20 +444,22 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
|
|
|
studentRegistration.setUserId(userId);
|
|
|
- studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
|
|
|
+ studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
|
|
|
studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ studentRegistration.setTemporaryCourseFee(studentAddDto.getTemporaryCourseFee());
|
|
|
//学生报名表
|
|
|
studentRegistrationDao.insertBasic(studentRegistration);
|
|
|
- MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
Set<Integer> roleIds = new HashSet<>(1);
|
|
|
roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
|
|
|
- sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT,"",musicGroup.getName(),studentRegistration.getName());
|
|
|
+ sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
|
|
|
//增加报名学生数
|
|
|
-// musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
|
|
|
- if (studentRegistration.getClassGroupId() != null) {
|
|
|
- ClassGroup classGroup = classGroupDao.get(studentRegistration.getClassGroupId());
|
|
|
+ musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getSubjectId(), 1);
|
|
|
+ Integer classGroupId = studentRegistration.getClassGroupId();
|
|
|
+ if (classGroupId != null) {
|
|
|
+ ClassGroup classGroup = classGroupDao.get(classGroupId);
|
|
|
if (classGroup != null) {
|
|
|
- if (!classGroup.getMusicGroupId().equals(studentRegistration.getMusicGroupId())) {
|
|
|
+ if (!classGroup.getMusicGroupId().equals(musicGroupId)) {
|
|
|
throw new Exception("班级录入错误");
|
|
|
} else {
|
|
|
//修改实际学生人数
|
|
@@ -460,13 +470,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
} else {
|
|
|
throw new Exception("班级不存在");
|
|
|
}
|
|
|
- //新增班级学生关系
|
|
|
- classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(studentRegistration.getClassGroupId(), userId));
|
|
|
- MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
|
|
|
+ //新增班级学生关系(单技班)
|
|
|
+ classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupId, userId));
|
|
|
+ //新增班级学生关系(合奏班)
|
|
|
+ ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
|
|
|
+ classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupRelation.getClassGroupId(), userId));
|
|
|
+
|
|
|
//获取当前月
|
|
|
Integer month = Integer.parseInt(DateUtil.getMonth(new Date()));
|
|
|
//获取下次缴费月份
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
+ List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
|
|
|
for (int i = 0; i < months.size(); i++) {
|
|
|
if (months.get(i).equals(month)) {
|
|
@@ -477,9 +490,27 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
calendar.add(Calendar.MONTH, month);
|
|
|
DateUtil.getFirstDayOfMonth(calendar.getTime());
|
|
|
//保存乐团学生费用表
|
|
|
- musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(studentRegistration.getMusicGroupId(),
|
|
|
- userId, studentRegistration.getSubjectId(), musicOneSubjectClassPlan.getFee(),
|
|
|
- DateUtil.getFirstDayOfMonth(calendar.getTime()), 0, studentRegistration.getTemporaryCourseFee()));
|
|
|
+ if (studentAddDto.getCourseFee() == null) {
|
|
|
+ MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
|
|
|
+ studentAddDto.setCourseFee(musicOneSubjectClassPlan.getFee());
|
|
|
+ }
|
|
|
+ musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
|
|
|
+ userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
|
|
|
+ DateUtil.getFirstDayOfMonth(calendar.getTime()), null));
|
|
|
+ //生成订单
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ studentPaymentOrder.setUserId(userId);
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.APPLY);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
+ studentPaymentOrder.setMusicGroupId(musicGroupId);
|
|
|
+ studentPaymentOrder.setClassGroupId(classGroupId);
|
|
|
+ studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
+ //生成订单明细
|
|
|
+ List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
|
|
|
+ studentPaymentOrderDetails.forEach(e -> {
|
|
|
+ e.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ });
|
|
|
+ studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
|
|
|
}
|
|
|
return userId;
|
|
|
}
|
|
@@ -513,35 +544,39 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
|
|
|
|
|
|
if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
|
|
|
- studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
|
|
|
- studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- studentRegistrationDao.update(studentRegistration);
|
|
|
|
|
|
- //获取当前月
|
|
|
- Integer month = Integer.parseInt(DateUtil.getMonth(nowDate));
|
|
|
- //获取下次缴费月份
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
- List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
|
|
|
- for (int i = 0; i < months.size(); i++) {
|
|
|
- if (months.get(i).equals(month)) {
|
|
|
- month = i == months.size() - 1 ? months.get(0) : months.get(i + 1);
|
|
|
+ if (studentRegistration.getTemporaryCourseFee() == null) {
|
|
|
+ //获取当前月
|
|
|
+ Integer month = Integer.parseInt(DateUtil.getMonth(nowDate));
|
|
|
+ //获取下次缴费月份
|
|
|
+ List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
+ List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
|
|
|
+ for (int i = 0; i < months.size(); i++) {
|
|
|
+ if (months.get(i).equals(month)) {
|
|
|
+ month = i == months.size() - 1 ? months.get(0) : months.get(i + 1);
|
|
|
+ }
|
|
|
}
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.add(Calendar.MONTH, month);
|
|
|
+
|
|
|
+ //加入缴费周期
|
|
|
+ MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee();
|
|
|
+ musicGroupStudentFee.setMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
+ musicGroupStudentFee.setUserId(studentRegistration.getUserId());
|
|
|
+ musicGroupStudentFee.setCourseFee(musicOneSubjectClassPlan.getFee());
|
|
|
+ musicGroupStudentFee.setCreateTime(nowDate);
|
|
|
+ musicGroupStudentFee.setUpdateTime(nowDate);
|
|
|
+ musicGroupStudentFee.setNextPaymentDate(DateUtil.getFirstDayOfMonth(calendar.getTime()));
|
|
|
+ musicGroupStudentFee.setLatestPaidTime(nowDate);
|
|
|
+ musicGroupStudentFee.setSubjectId(studentRegistration.getActualSubjectId());
|
|
|
+ musicGroupStudentFee.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
|
|
|
+ musicGroupStudentFeeDao.insert(musicGroupStudentFee);
|
|
|
+ studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
}
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.add(Calendar.MONTH, month);
|
|
|
-
|
|
|
- //加入缴费周期
|
|
|
- MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee();
|
|
|
- musicGroupStudentFee.setMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
- musicGroupStudentFee.setUserId(studentRegistration.getUserId());
|
|
|
- musicGroupStudentFee.setCourseFee(musicOneSubjectClassPlan.getFee());
|
|
|
- musicGroupStudentFee.setCreateTime(nowDate);
|
|
|
- musicGroupStudentFee.setUpdateTime(nowDate);
|
|
|
- musicGroupStudentFee.setNextPaymentDate(DateUtil.getFirstDayOfMonth(calendar.getTime()));
|
|
|
- musicGroupStudentFee.setLatestPaidTime(nowDate);
|
|
|
- musicGroupStudentFee.setSubjectId(studentRegistration.getActualSubjectId());
|
|
|
- musicGroupStudentFee.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
|
|
|
- musicGroupStudentFeeDao.insert(musicGroupStudentFee);
|
|
|
+
|
|
|
+ studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
|
|
|
+ studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ studentRegistrationDao.update(studentRegistration);
|
|
|
|
|
|
//插入交易明细
|
|
|
SysUserCashAccount cashAccount = sysUserCashAccountService.get(studentRegistration.getUserId());
|
|
@@ -575,15 +610,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
sysUserCashAccountDetailService.insert(paymentDetail);
|
|
|
|
|
|
//发送缴费成功通知(短信 + push)
|
|
|
- Map<Integer,String> map = new HashMap<>(1);
|
|
|
- map.put(studentPaymentOrder.getUserId(),studentRegistration.getParentsPhone());
|
|
|
+ Map<Integer, String> map = new HashMap<>(1);
|
|
|
+ map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
|
|
|
- MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS,map,null,0,"1",
|
|
|
- studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|
|
|
+ MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
|
|
|
+ studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
|
|
|
//push
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
- MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS,map,null,0,"1",
|
|
|
- studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|
|
|
+ MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
|
|
|
+ studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
|
|
|
}
|
|
|
|
|
|
//失败减去已收款金额
|
|
@@ -595,10 +630,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//发送缴费成功通知(短信 + push)
|
|
|
String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL + studentRegistration.getMusicGroupId());
|
|
|
|
|
|
- Map<Integer,String> map = new HashMap<>(1);
|
|
|
- map.put(studentPaymentOrder.getUserId(),studentRegistration.getParentsPhone());
|
|
|
+ Map<Integer, String> map = new HashMap<>(1);
|
|
|
+ map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
|
|
|
- MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
|
|
|
+ MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, "1",
|
|
|
studentApplyUrl);
|
|
|
// sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
// MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
|
|
@@ -672,4 +707,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
public List<Map<Integer, String>> findParentId(String parentPhones) {
|
|
|
return studentRegistrationDao.findParentId(parentPhones);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
|
|
|
+ StudentRegistration student = get(studentRegistration.getId());
|
|
|
+ if (student == null) {
|
|
|
+ throw new BizException("用户注册信息不存在,无法更新");
|
|
|
+ }
|
|
|
+ student.setParentsName(studentRegistration.getParentsName());
|
|
|
+ student.setIdCardNo(studentRegistration.getIdCardNo());
|
|
|
+ update(student);
|
|
|
+ studentRegistrationDao.updateUser(student.getUserId(), student.getParentsName(), student.getIdCardNo());
|
|
|
+ return student;
|
|
|
+ }
|
|
|
}
|