|
@@ -19,6 +19,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+import com.ym.mec.util.string.MessageFormatter;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -110,6 +111,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private SysMessageConfigDao sysMessageConfigDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysConfigDao sysConfigDao;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<String, MusicGroup> getDAO() {
|
|
|
return musicGroupDao;
|
|
@@ -195,7 +199,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//乐团状态是否正确
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
if(musicGroup != null){
|
|
|
- if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT || musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
|
|
|
+ if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT && musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
|
|
|
throw new Exception("当前乐团状态不支持此操作");
|
|
|
}
|
|
|
//记录日志信息
|
|
@@ -363,7 +367,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
//获取当前乐团所有已报名学员
|
|
|
List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
|
|
|
-
|
|
|
+ Map<Integer,String> map = new HashMap<>(registrations.size());
|
|
|
+ registrations.forEach(e->{
|
|
|
+ map.put(e.getUserId(),e.getParentsPhone());
|
|
|
+ });
|
|
|
+ String content = sysMessageConfigDao.findContent(MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_CLOSE.getCode());
|
|
|
+ content = MessageFormatter.arrayFormat(content,sysConfigDao.findConfigValue(SysConfigService.REFUND_PERIOD));
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.JIGUANG,"",content,map,new Date(),0,"");
|
|
|
//记录建团日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"取消乐团",sysUser.getId(),""));
|
|
|
return true;
|
|
@@ -633,26 +643,34 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(musicGroupStudentFee == null){
|
|
|
throw new BizException("系统数据异常,找不到学员预缴费信息");
|
|
|
}
|
|
|
-
|
|
|
Date date = new Date();
|
|
|
-
|
|
|
- musicGroupStudentFee.setUpdateTime(date);
|
|
|
- musicGroupStudentFee.setLatestPaidTime(date);
|
|
|
- musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
|
|
|
- musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
- musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
-
|
|
|
- musicGroupStudentFeeDao.update(musicGroupStudentFee);
|
|
|
-
|
|
|
- SysUser user = sysUserFeignService.queryUserById(userId);
|
|
|
- Map<Integer, String> receivers = new HashMap<Integer, String>();
|
|
|
- receivers.put(user.getId(), userId + "");
|
|
|
-
|
|
|
- // 发送续费结果通知
|
|
|
- sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_RENEW_RESULT, receivers, null, 0, "",
|
|
|
- user.getRealName());
|
|
|
-
|
|
|
- return true;
|
|
|
+ Map<Integer, String> receivers = new HashMap<Integer, String>(1);
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ receivers.put(userId, studentRegistration.getParentsPhone());
|
|
|
+ if(studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS){
|
|
|
+ musicGroupStudentFee.setUpdateTime(date);
|
|
|
+ musicGroupStudentFee.setLatestPaidTime(date);
|
|
|
+ musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
|
|
|
+ musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
+ musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
+ musicGroupStudentFeeDao.update(musicGroupStudentFee);
|
|
|
+ // 发送续费结果通知
|
|
|
+
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, receivers, null, 0, "",
|
|
|
+ studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, receivers, null, 0, "",
|
|
|
+ studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAilED){
|
|
|
+ String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL + musicGroupId);
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED, receivers, null, 0, "",
|
|
|
+ studentApplyUrl);
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED, receivers, null, 0, "",
|
|
|
+ studentApplyUrl);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -743,9 +761,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new Exception("用户信息获取失败");
|
|
|
}
|
|
|
String musicGroupId = subFeeSettingDto.getMusicGroup().getId();
|
|
|
- MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.DRAFT);
|
|
|
- if(musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
|
|
|
- throw new Exception("当前乐团状态不支持此操作");
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
+ if(musicGroup == null){
|
|
|
+ throw new Exception("乐团信息不存在");
|
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
@@ -902,8 +920,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//获取所有家长电话
|
|
|
Set<String> parentsPhones = students.stream().map(StudentRegistration::getParentsPhone).collect(Collectors.toSet());
|
|
|
//获取对应家长的用户编号
|
|
|
-// Map<Integer,String> userIds = MapUtil.convertMybatisMap(studentRegistrationService.findParentId(StringUtils.join(parentsPhones,",")));
|
|
|
-// String content = sysMessageConfigDao.findContent(MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE.getCode());
|
|
|
-// sysMessageService.batchSendMessage(MessageSender.YIMEI,"",content,userIds,date,0,"");
|
|
|
+ Map<Integer,String> userIds = MapUtil.convertMybatisMap(studentRegistrationDao.findParentId(StringUtils.join(parentsPhones,",")));
|
|
|
+ userIds = JSONObject.parseObject(JSONObject.toJSONString(userIds),HashMap.class);
|
|
|
+ String content = sysMessageConfigDao.findContent(MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE.getCode());
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.YIMEI,"",content,userIds,new Date(),0,"");
|
|
|
}
|
|
|
}
|