|
@@ -10,6 +10,7 @@ import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
@@ -26,6 +27,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -60,6 +62,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
private MusicGroupOrganizationCourseSettingsDao musicGroupOrganizationCourseSettingsDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
|
|
|
@Autowired
|
|
@@ -83,20 +88,27 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Long create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
|
|
|
-
|
|
|
+
|
|
|
String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
|
|
|
|
|
|
MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
|
|
|
-
|
|
|
- if(musicGroup == null){
|
|
|
+
|
|
|
+ if (musicGroup == null) {
|
|
|
throw new BizException("乐团查询失败,请检查参数");
|
|
|
}
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if(sysUser == null){
|
|
|
+ if (sysUser == null) {
|
|
|
throw new BizException("请登录");
|
|
|
}
|
|
|
+ //不是进行中,只能创建一次缴费
|
|
|
+ if(musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS){
|
|
|
+ List<MusicGroupPaymentCalender> list = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
+ if(list.size() > 0){
|
|
|
+ throw new BizException("创建失败,已经存在缴费信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Date date = new Date();
|
|
|
- Map<Integer, String> pushUserMap = new HashMap<>();
|
|
|
List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
|
|
|
musicGroupPaymentCalender.setOperator(sysUser.getId());
|
|
|
musicGroupPaymentCalender.setCreateTime(date);
|
|
@@ -111,29 +123,52 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (count > 0) {
|
|
|
throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
|
|
|
}
|
|
|
- //获取设置的课程
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
- if(musicGroupPaymentCalenderCourseSettingsList == null){
|
|
|
+ // 获取设置的课程
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender
|
|
|
+ .getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+ if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
}
|
|
|
- //当前缴费的课程费用
|
|
|
- Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().
|
|
|
- collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
|
|
|
-
|
|
|
- if(musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentCalender.getPaymentType() == MUSIC_RENEW){
|
|
|
- //查询默认课程费用
|
|
|
- Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
|
|
|
- Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().
|
|
|
- collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
|
|
|
-
|
|
|
- //相同类型的课程如果修改了课程费用,需要走审批
|
|
|
- for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
|
|
|
- if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ if (musicGroupPaymentCalender.getPayUserType() == PayUserType.SCHOOL) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ } else {
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentCalender.getPaymentType() == MUSIC_RENEW) {
|
|
|
+ // 当前缴费的课程费用
|
|
|
+ Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
+ Collectors
|
|
|
+ .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 查询默认课程费用
|
|
|
+ Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
|
|
|
+ Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
+ .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
+ MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
+ for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
+ if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_COURSE) {
|
|
|
+ // 如果是临时加课,是否审核是根据单价判断
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
+ musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
+ if (defaultUnitPrice == null) {
|
|
|
+ throw new BizException("请先设置分部课程类型单价");
|
|
|
+ }
|
|
|
+ if (courseSettings.getCourseCurrentPrice().divide(new BigDecimal(courseSettings.getCourseTotalMinuties()))
|
|
|
+ .compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
}
|
|
|
|
|
|
if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
@@ -144,28 +179,29 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
} else {
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
}
|
|
|
-
|
|
|
- //如果是报名,需要修改乐团状态
|
|
|
+
|
|
|
+ // 如果是报名,需要修改乐团状态
|
|
|
if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
|
|
|
- if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT){
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
|
|
|
throw new BizException("创建失败:缴费项目类型不匹配");
|
|
|
}
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
|
|
|
musicGroup.setUpdateTime(date);
|
|
|
- //记录操作日志
|
|
|
+ // 记录操作日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
musicGroupPaymentCalender.setExpectNum(0);
|
|
|
- //设置批次号
|
|
|
- musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId()+"");
|
|
|
+ // 设置批次号
|
|
|
+ musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId() + "");
|
|
|
musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
|
|
|
- if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
|
|
|
- MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId());
|
|
|
- for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
|
|
|
+ if (musicGroupPaymentCalenderCourseSettingsList.size() > 0) {
|
|
|
+ MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender
|
|
|
+ .getMusicGroupOrganizationCourseSettingId());
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
|
|
|
}
|
|
@@ -175,14 +211,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
|
|
|
}
|
|
|
- // 发送续费通知
|
|
|
- if (pushUserMap.size() > 0) {
|
|
|
- String configValue = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
|
- String memo = "4?" + configValue + "/#/renew?musicGroupId=" + musicGroup.getId();
|
|
|
-
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE,
|
|
|
- pushUserMap, null, 0, memo, "STUDENT", musicGroup.getName());
|
|
|
- }
|
|
|
return musicGroupPaymentCalender.getId();
|
|
|
}
|
|
|
|
|
@@ -202,14 +230,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int update(MusicGroupPaymentCalender musicGroupPaymentCalender) {
|
|
|
+ public Long merge(MusicGroupPaymentCalender musicGroupPaymentCalender) {
|
|
|
|
|
|
- MusicGroupPaymentCalender orginMusicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalender.getId());
|
|
|
- if(orginMusicGroupPaymentCalender == null){
|
|
|
+ MusicGroupPaymentCalender originMusicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalender.getId());
|
|
|
+ if(originMusicGroupPaymentCalender == null){
|
|
|
throw new BizException("查询不到缴费记录");
|
|
|
}
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("请登录");
|
|
|
+ }
|
|
|
//只有“拒绝”才能修改
|
|
|
- if(orginMusicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.REJECT){
|
|
|
+ if(originMusicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.REJECT){
|
|
|
throw new BizException("缴费记录只有被“审核拒绝”才能修改");
|
|
|
}
|
|
|
|
|
@@ -224,7 +256,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
Date date = new Date();
|
|
|
|
|
|
musicGroupPaymentCalender.setUpdateTime(date);
|
|
|
- if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null) {
|
|
|
+ if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
|
|
|
musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
|
|
|
}
|
|
|
int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
|
|
@@ -234,27 +266,53 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
}
|
|
|
|
|
|
//获取设置的课程
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
- if(musicGroupPaymentCalenderCourseSettingsList == null){
|
|
|
- musicGroupPaymentCalenderCourseSettingsList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>();
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender
|
|
|
+ .getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+ if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
+ musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
}
|
|
|
-
|
|
|
- //查询默认课程费用
|
|
|
- Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
|
|
|
- Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId).stream().collect(Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail :: getCourseType, MusicGroupOrganizationCourseSettingsDetail :: getCourseCurrentPrice));
|
|
|
-
|
|
|
- //当前缴费的课程费用
|
|
|
- Map<CourseScheduleType,BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderCourseSettings :: getCourseType, MusicGroupPaymentCalenderCourseSettings :: getCourseCurrentPrice));
|
|
|
-
|
|
|
- BigDecimal totalPrice = new BigDecimal(0);
|
|
|
- //相同类型的课程如果修改了课程费用,需要走审批
|
|
|
- for(Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()){
|
|
|
- if(defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0){
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ if (musicGroupPaymentCalender.getPayUserType() == PayUserType.SCHOOL) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ } else {
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentCalender.getPaymentType() == MUSIC_RENEW) {
|
|
|
+ // 当前缴费的课程费用
|
|
|
+ Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
+ Collectors
|
|
|
+ .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 查询默认课程费用
|
|
|
+ Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
|
|
|
+ Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
+ .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
+ MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
+ for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
+ if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_COURSE) {
|
|
|
+ // 如果是临时加课,是否审核是根据单价判断
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
+ musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
+ if (defaultUnitPrice == null) {
|
|
|
+ throw new BizException("请先设置分部课程类型单价");
|
|
|
+ }
|
|
|
+ if (courseSettings.getCourseCurrentPrice().divide(new BigDecimal(courseSettings.getCourseTotalMinuties()))
|
|
|
+ .compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- totalPrice.add(entry.getValue());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
|
|
@@ -263,70 +321,29 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
} else {
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
}
|
|
|
-
|
|
|
- //如果是报名,需要修改乐团状态
|
|
|
+
|
|
|
+ // 如果是报名,需要修改乐团状态
|
|
|
if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
|
|
|
+ throw new BizException("创建失败:缴费项目类型不匹配");
|
|
|
+ }
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
|
|
|
musicGroup.setUpdateTime(date);
|
|
|
+ // 记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 审核中)", sysUser.getId(), ""));
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
}
|
|
|
}
|
|
|
- List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
|
|
|
- Map<Integer, String> pushUserMap = new HashMap<Integer, String>();
|
|
|
-
|
|
|
- musicGroupPaymentCalender.setExpectNum(0);
|
|
|
- if(StringUtils.isNoneBlank(musicGroupPaymentCalender.getStudentIds())){
|
|
|
- String[] sutdentIdList = musicGroupPaymentCalender.getStudentIds().split(",");
|
|
|
- musicGroupPaymentCalender.setExpectNum(sutdentIdList.length);
|
|
|
-
|
|
|
- if (musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
|
|
|
- for(String studentId : sutdentIdList){
|
|
|
- pushUserMap.put(Integer.parseInt(studentId), studentId);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //删除历史数据
|
|
|
- musicGroupPaymentCalenderDetailDao.deleteByCalenderId(musicGroupPaymentCalender.getId());
|
|
|
-
|
|
|
- //创建缴费明细
|
|
|
- MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
|
|
|
- for(String studentId : sutdentIdList){
|
|
|
- musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
|
|
|
- musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
- musicGroupPaymentCalenderDetail.setCreateTime(date);
|
|
|
- musicGroupPaymentCalenderDetail.setExpectAmount(totalPrice);
|
|
|
- musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT);
|
|
|
- musicGroupPaymentCalenderDetail.setUpdateTime(date);
|
|
|
- musicGroupPaymentCalenderDetail.setUserId(Integer.parseInt(studentId));
|
|
|
- musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
|
|
|
- musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
|
|
|
-
|
|
|
- musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
|
|
|
|
|
|
- if (musicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
- musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
|
|
|
- }
|
|
|
-
|
|
|
musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
|
|
|
if(musicGroupPaymentCalenderCourseSettingsList.size() > 0){
|
|
|
musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
|
|
|
}
|
|
|
|
|
|
- // 发送续费通知
|
|
|
- if (pushUserMap.size() > 0) {
|
|
|
- String configValue = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
|
- String memo = "4?" + configValue + "/#/renew?musicGroupId=" + musicGroup.getId();
|
|
|
-
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE,
|
|
|
- pushUserMap, null, 0, memo, "STUDENT", musicGroup.getName());
|
|
|
- }
|
|
|
-
|
|
|
- return 1;
|
|
|
+ return musicGroupPaymentCalender.getId();
|
|
|
}
|
|
|
|
|
|
@Override
|