|
@@ -16,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;
|
|
@@ -110,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);
|
|
|
}
|
|
|
|
|
@@ -188,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()));
|
|
@@ -204,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;
|
|
|
}
|
|
|
|
|
@@ -304,7 +305,7 @@ 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()){
|
|
|
+ if (musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()) {
|
|
|
throw new Exception("乐团人数已满");
|
|
|
}
|
|
|
musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
|
|
@@ -430,7 +431,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()));
|
|
@@ -448,7 +449,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
|
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) {
|
|
@@ -596,15 +597,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());
|
|
|
}
|
|
|
|
|
|
//失败减去已收款金额
|
|
@@ -616,10 +617,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",
|
|
@@ -693,4 +694,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(studentRegistration.getUserId(), studentRegistration.getParentsName(), studentRegistration.getIdCardNo());
|
|
|
+ return student;
|
|
|
+ }
|
|
|
}
|