|
@@ -1,48 +1,22 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
|
|
|
-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;
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.SPAN_GROUP_CLASS_ADJUST;
|
|
|
-import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
-import java.util.Map.Entry;
|
|
|
-import java.util.function.Consumer;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.ym.mec.biz.dal.dao.*;
|
|
|
-import com.ym.mec.biz.dal.dto.*;
|
|
|
-import com.ym.mec.biz.dal.entity.*;
|
|
|
-import com.ym.mec.biz.dal.enums.*;
|
|
|
-import com.ym.mec.biz.event.source.GroupEventSource;
|
|
|
-import com.ym.mec.biz.service.*;
|
|
|
-import org.apache.commons.beanutils.BeanUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.BeanFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Isolation;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.MusicGroupPaymentDateRange;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
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.*;
|
|
|
import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
|
|
|
+import com.ym.mec.biz.event.source.GroupEventSource;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
@@ -51,9 +25,25 @@ 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.springframework.util.Assert;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.function.Consumer;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.*;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
|
|
|
+import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
|
|
|
|
|
|
@Service
|
|
|
public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
|
|
@@ -65,7 +55,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
@Autowired
|
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
|
@Autowired
|
|
|
- private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
|
|
|
+ private MusicGroupPaymentCalenderCourseSettingsServiceImpl musicGroupPaymentCalenderCourseSettingsService;
|
|
|
@Autowired
|
|
|
private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
|
|
|
@Autowired
|
|
@@ -125,7 +115,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
@Autowired
|
|
|
private CloudTeacherOrderDao cloudTeacherOrderDao;
|
|
|
@Autowired
|
|
|
- private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
|
|
|
+ private MusicGroupPaymentCalenderActivityServiceImpl musicGroupPaymentCalenderActivityService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderMemberServiceImpl musicGroupPaymentCalenderMemberService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderRepairServiceImpl musicGroupPaymentCalenderRepairService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
|
|
@@ -570,35 +564,33 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentBaseCalender.setMusicGroup(musicGroup);
|
|
|
|
|
|
//检测缴费项目是否有费用变更
|
|
|
- Map<CalenderBaseServiceEnum, MusicGroupPaymentCalenderBaseService> calenderBaseServiceMap = MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap;
|
|
|
+// Map<CalenderBaseServiceEnum, MusicGroupPaymentCalenderBaseService> calenderBaseServiceMap = MusicGroupPaymentCalenderBaseService.calenderBaseServiceMap;
|
|
|
|
|
|
//计算缴费项目总金额
|
|
|
- BigDecimal courseActualAmount = ((MusicGroupPaymentCalenderCourseSettingsServiceImpl) musicGroupPaymentCalenderCourseSettingsService).getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
- BigDecimal currentTotalAmount = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
- currentTotalAmount = currentTotalAmount.add(courseActualAmount);
|
|
|
- currentTotalAmount = currentTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).getActualAmount(musicGroupPaymentBaseCalender));
|
|
|
- currentTotalAmount = currentTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.ACTIVITY).getActualAmount(musicGroupPaymentBaseCalender));
|
|
|
+ BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+
|
|
|
+ BigDecimal currentTotalAmount = courseActualAmount.add(memberActualAmount)
|
|
|
+ .add(repairActualAmount)
|
|
|
+ .add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
//计算缴费项目原价
|
|
|
- BigDecimal memberOriginalAmount = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).getOriginalAmount(musicGroupPaymentBaseCalender);
|
|
|
- BigDecimal originalTotalAmount = memberOriginalAmount;
|
|
|
- originalTotalAmount = originalTotalAmount.add(((MusicGroupPaymentCalenderCourseSettingsServiceImpl)musicGroupPaymentCalenderCourseSettingsService).getOriginalAmount(musicGroupPaymentBaseCalender));
|
|
|
- originalTotalAmount = originalTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).getOriginalAmount(musicGroupPaymentBaseCalender));
|
|
|
- originalTotalAmount = originalTotalAmount.add(calenderBaseServiceMap.get(CalenderBaseServiceEnum.ACTIVITY).getOriginalAmount(musicGroupPaymentBaseCalender));
|
|
|
+ BigDecimal courseOriginalAmount = musicGroupPaymentCalenderCourseSettingsService.getOriginalAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal memberOriginalAmount = musicGroupPaymentCalenderMemberService.getOriginalAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal activityOriginalAmount = musicGroupPaymentCalenderRepairService.getOriginalAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal repairOriginalAmount = musicGroupPaymentCalenderActivityService.getOriginalAmount(musicGroupPaymentBaseCalender);
|
|
|
+
|
|
|
+ BigDecimal originalTotalAmount = courseOriginalAmount.add(memberOriginalAmount)
|
|
|
+ .add(activityOriginalAmount)
|
|
|
+ .add(repairOriginalAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
PaymentCalenderStatusEnum status;
|
|
|
if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
|
|
|
status = AUDITING;
|
|
|
} else {
|
|
|
- int compare = currentTotalAmount.setScale(0, BigDecimal.ROUND_HALF_UP).compareTo(originalTotalAmount.setScale(0, BigDecimal.ROUND_HALF_UP));
|
|
|
- status = compare == 0?NO:AUDITING;
|
|
|
-// status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MEMBER).checkComponentAmount(musicGroupPaymentBaseCalender);
|
|
|
-// if(status != AUDITING){
|
|
|
-// status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.COURSE).checkComponentAmount(musicGroupPaymentBaseCalender);
|
|
|
-// }
|
|
|
-// if(status != AUDITING){
|
|
|
-// status = calenderBaseServiceMap.get(CalenderBaseServiceEnum.MUSIC_REPAIR).checkComponentAmount(musicGroupPaymentBaseCalender);
|
|
|
-// }
|
|
|
+ status = currentTotalAmount.compareTo(originalTotalAmount) == 0 ? NO:AUDITING;
|
|
|
}
|
|
|
|
|
|
Date date = new Date();
|
|
@@ -617,25 +609,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentCalender.setPaymentAmount(courseActualAmount);
|
|
|
musicGroupPaymentCalender.setCurrentTotalAmount(currentTotalAmount);
|
|
|
musicGroupPaymentCalender.setOriginalTotalAmount(originalTotalAmount);
|
|
|
-
|
|
|
- //会员缴费信息
|
|
|
- CalenderMemberDto calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
|
|
|
- if(calenderMember != null){
|
|
|
- //设置会员缴费金额、级别以及有效期
|
|
|
- musicGroupPaymentCalender.setMemberPaymentAmount(calenderMember.getActualAmount());
|
|
|
- musicGroupPaymentCalender.setMemberRankSettingId(calenderMember.getMemberRankSettingId());
|
|
|
- musicGroupPaymentCalender.setMemberValidDate(calenderMember.getMemberNum());
|
|
|
- musicGroupPaymentCalender.setMemberPeriod(calenderMember.getPeriodEnum());
|
|
|
- musicGroupPaymentCalender.setMemberOptionalFlag(calenderMember.getOptionalFlag());
|
|
|
- musicGroupPaymentCalender.setOriginalMemberPaymentAmount(memberOriginalAmount);
|
|
|
- }
|
|
|
- //乐保缴费信息
|
|
|
- MusicRepairDto musicRepair = musicGroupPaymentBaseCalender.getMusicRepair();
|
|
|
- if(musicRepair != null){
|
|
|
- musicGroupPaymentCalender.setMusicRepairNum(musicRepair.getNum());
|
|
|
- musicGroupPaymentCalender.setMusicRepairActualPrice(musicRepair.getActualAmount());
|
|
|
- musicGroupPaymentCalender.setMusicRepairOptionalFlag(musicRepair.getOptionalFlag());
|
|
|
- }
|
|
|
musicGroupPaymentCalender.setStatus(status);
|
|
|
|
|
|
if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
@@ -652,12 +625,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
String batchNo = idGeneratorService.generatorId() + "";
|
|
|
musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
|
musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
-
|
|
|
- //课程费用列表
|
|
|
+ Long calenderId = musicGroupPaymentCalender.getId();
|
|
|
+ //保存会员缴费信息
|
|
|
+ MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
|
|
|
+ if(calenderMember != null){
|
|
|
+ calenderMember = musicGroupPaymentCalenderMemberService.initBean(musicGroupPaymentBaseCalender.getCalenderMember());
|
|
|
+ calenderMember.setOriginalAmount(memberOriginalAmount);
|
|
|
+ calenderMember.setCalenderId(calenderId);
|
|
|
+ musicGroupPaymentCalenderMemberService.insert(calenderMember);
|
|
|
+ }
|
|
|
+ //保存乐保缴费信息
|
|
|
+ MusicGroupPaymentCalenderRepair musicRepair = musicGroupPaymentBaseCalender.getMusicRepair();
|
|
|
+ if(musicRepair != null){
|
|
|
+ musicRepair.setOriginalAmount(repairOriginalAmount);
|
|
|
+ musicRepair.setCalenderId(calenderId);
|
|
|
+ musicGroupPaymentCalenderRepairService.insert(musicRepair);
|
|
|
+ }
|
|
|
+ //保存活动缴费信息
|
|
|
+ List<MusicGroupPaymentCalenderActivity> calenderActivityList = musicGroupPaymentBaseCalender.getCalenderActivityList();
|
|
|
+ if(calenderActivityList != null && calenderActivityList.size() > 0){
|
|
|
+ musicGroupPaymentCalenderActivityService.initBean(calenderActivityList);
|
|
|
+ musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,calenderId);
|
|
|
+ }
|
|
|
+ //保存课程费用列表
|
|
|
musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList());
|
|
|
musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
|
|
|
- //活动费用列表
|
|
|
- musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,musicGroupPaymentCalender.getId());
|
|
|
|
|
|
// 如果是报名,需要修改乐团状态
|
|
|
if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
|
|
@@ -686,24 +678,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
public Object getDetail(Long id) {
|
|
|
+ Map<String, Object> result = new HashMap<>(4);
|
|
|
+ //获取缴费项目详情
|
|
|
MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
|
|
|
+ //统计预计缴费人数
|
|
|
Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));
|
|
|
+ //统计实际缴费人数
|
|
|
Map<Long, Long> actualNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countActualNum(id));
|
|
|
calender.setActualNum(actualNumMap.get(id) == null ? 0 : actualNumMap.get(id).intValue());
|
|
|
calender.setExpectNum(expectNumMap.get(id) == null ? 0 : expectNumMap.get(id).intValue());
|
|
|
+ //汇总收款金额
|
|
|
BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
|
|
|
+ result.put("sumActualAmount", sumActualAmount);
|
|
|
//收费标准名称
|
|
|
- String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id);
|
|
|
- Map<String, Object> result = new HashMap<>(4);
|
|
|
- result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettings);
|
|
|
+// String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
|
|
|
+// result.put("calenderSettingsName", name);
|
|
|
+ //收费标准
|
|
|
+ result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id));
|
|
|
+ //会员信息
|
|
|
if(calender.getMemberRankSettingId() != null){
|
|
|
MemberRankSetting memberRankSetting = memberRankSettingDao.get(calender.getMemberRankSettingId());
|
|
|
calender.setMemberRankSettingName(memberRankSetting.getName());
|
|
|
}
|
|
|
+ //活动相关信息
|
|
|
+ result.put("activity",musicGroupPaymentCalenderActivityService.findByCalenderId(id));
|
|
|
result.put("calender", calender);
|
|
|
- result.put("calenderSettingsName", name);
|
|
|
- result.put("sumActualAmount", sumActualAmount);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -1715,6 +1714,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
|
|
|
musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);
|
|
|
musicGroupPaymentCalenderActivityService.delByCalenderId(id);
|
|
|
+ musicGroupPaymentCalenderMemberService.deleteByCalenderId(id);
|
|
|
+ musicGroupPaymentCalenderRepairService.deleteByCalenderId(id);
|
|
|
List<Long> calenderIds = new ArrayList<Long>();
|
|
|
calenderIds.add(id);
|
|
|
musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);
|