|
@@ -4,6 +4,7 @@ import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SC
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.REJECT;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_COURSE;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
|
|
|
import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
|
|
@@ -85,7 +86,6 @@ import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
|
|
|
import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
|
|
|
import com.ym.mec.biz.service.SysConfigService;
|
|
|
import com.ym.mec.biz.service.SysMessageService;
|
|
|
-import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
@@ -261,7 +261,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
}
|
|
|
if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
|
|
|
- if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties()))
|
|
|
+ if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
|
|
|
status = AUDITING;
|
|
@@ -366,7 +366,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
|
|
|
musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
|
|
|
}
|
|
|
- if (paymentType != ADD_STUDENT) {
|
|
|
+ if (paymentType != ADD_STUDENT && paymentType != ADD_COURSE) {
|
|
|
int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(),
|
|
|
musicGroupPaymentCalender.getPaymentValidStartDate(), musicGroupPaymentCalender.getPaymentValidEndDate(), null);
|
|
|
if (count > 0) {
|
|
@@ -498,7 +498,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if(status != PaymentCalenderStatusEnum.REJECT){
|
|
|
throw new BizException("只有[拒绝]状态的缴费才能修改");
|
|
|
}
|
|
|
-
|
|
|
String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
|
|
|
|
|
|
PaymentType paymentType = musicGroupPaymentCalenderDto.getPaymentType();
|
|
@@ -571,7 +570,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
throw new BizException("请先设置分部课程类型单价");
|
|
|
}
|
|
|
if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
- if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties()))
|
|
|
+ if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
|
|
|
status = AUDITING;
|
|
@@ -674,7 +673,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
|
|
|
musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
|
|
|
}
|
|
|
- if (paymentType != ADD_STUDENT) {
|
|
|
+ if (paymentType != ADD_STUDENT && paymentType != ADD_COURSE) {
|
|
|
int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(),
|
|
|
musicGroupPaymentCalender.getPaymentValidStartDate(), musicGroupPaymentCalender.getPaymentValidEndDate(), null);
|
|
|
if (count > 0) {
|
|
@@ -860,7 +859,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
maps.get(e));
|
|
|
Map<Integer, String> receivers1 = new HashMap<>(1);
|
|
|
receivers1.put(calenderPushDto.getTeacherId(), calenderPushDto.getTeacherId().toString());
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_DETAIL, receivers, null, 0,
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_DETAIL, receivers1, null, 0,
|
|
|
null, "SYSTEM", calenderPushDto.getMusicGroupName(), calenderPushDto.getPaymentValidStartDate(), calenderPushDto.getPaymentValidEndDate(),
|
|
|
maps.get(e));
|
|
|
});
|
|
@@ -894,7 +893,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
null, null, e.getMusicGroupName(), e.getPaymentValidStartDate(), e.getPaymentValidEndDate());
|
|
|
Map<Integer, String> receivers1 = new HashMap<>(1);
|
|
|
receivers1.put(e.getTeacherId(), e.getTeacherId().toString());
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_CREATE, receivers, null, 0,
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_CREATE, receivers1, null, 0,
|
|
|
null, "SYSTEM", e.getMusicGroupName(), e.getPaymentValidStartDate(), e.getPaymentValidEndDate());
|
|
|
});
|
|
|
}
|
|
@@ -1183,62 +1182,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateStartTime(MusicGroupPaymentCalender paymentCalender) {
|
|
|
- MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(paymentCalender.getId());
|
|
|
- if (calender == null) {
|
|
|
- throw new BizException("缴费信息不存在");
|
|
|
- }
|
|
|
- if (calender.getStatus() == null || calender.getStatus() != PaymentCalenderStatusEnum.NO) {
|
|
|
- throw new BizException("修改失败,缴费状态不匹配");
|
|
|
- }
|
|
|
- Date date = new Date();
|
|
|
- if(paymentCalender.getPaymentType() != ADD_STUDENT){
|
|
|
- int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(paymentCalender.getMusicGroupId(), paymentCalender.getPayUserType(), paymentCalender.getPaymentValidStartDate(),
|
|
|
- paymentCalender.getPaymentValidEndDate(), paymentCalender.getId());
|
|
|
- if (count > 0) {
|
|
|
- throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
|
|
|
- }
|
|
|
- }
|
|
|
- calender.setStartPaymentDate(paymentCalender.getStartPaymentDate());
|
|
|
- calender.setDeadlinePaymentDate(paymentCalender.getDeadlinePaymentDate());
|
|
|
- calender.setPaymentValidStartDate(paymentCalender.getPaymentValidStartDate());
|
|
|
- calender.setPaymentValidEndDate(paymentCalender.getPaymentValidEndDate());
|
|
|
- calender.setPaymentPattern(paymentCalender.getPaymentPattern());
|
|
|
- calender.setUpdateTime(date);
|
|
|
- if (paymentCalender.getDeadlinePaymentDate().before(date) && !DateUtil.isSameDay(date, paymentCalender.getDeadlinePaymentDate())) {
|
|
|
- calender.setStatus(PaymentCalenderStatusEnum.OVER);
|
|
|
- } else if (date.after(paymentCalender.getStartPaymentDate()) || DateUtil.isSameDay(date, paymentCalender.getStartPaymentDate())) {
|
|
|
- calender.setStatus(PaymentCalenderStatusEnum.OPEN);
|
|
|
- // 修改Fee缴费状态为未缴费
|
|
|
- musicGroupStudentFeeDao.updatePaymentStatus(calender.getId(), "NON_PAYMENT");
|
|
|
- List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryByCalenderId(calender.getId(),null);
|
|
|
- Set<Integer> studentIds = details.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
- if (paymentCalender.getPayUserType() == STUDENT && studentIds.size() > 0) {
|
|
|
- Map<Integer, String> push = new HashMap<>();
|
|
|
- for (Integer userId : studentIds) {
|
|
|
- push.put(userId, userId + "");
|
|
|
- }
|
|
|
- MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());
|
|
|
- String configValue = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
|
- String memo = "4?" + configValue + "/#/musicGroupRenew?calenderId="+calender.getId()+"&id=" + calender.getMusicGroupId();
|
|
|
- // 发送续费通知
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
|
|
|
- null, 0, memo, "STUDENT", musicGroup.getName());
|
|
|
- //获取未缴费且不是0元的学员列表
|
|
|
- Map<Integer,String> studentMaps = MapUtil.convertMybatisMap(musicGroupPaymentCalenderDetailDao.queryNoPaymentAndNotZeroStudent(calender.getId(),studentIds));
|
|
|
- if(studentMaps.size() > 0){
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, studentMaps,
|
|
|
- null, 0, memo, null, musicGroup.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- calender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
- }
|
|
|
- musicGroupPaymentCalenderDao.update(calender);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
public void del(Long id) {
|
|
|
if (id == null) {
|
|
|
throw new BizException("参数校验失败");
|