|
@@ -29,6 +29,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -121,6 +122,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
private VipGroupActivityDao vipGroupActivityDao;
|
|
|
@Autowired
|
|
|
private OperatingReportCloudService operatingReportCloudService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupCalenderRefundPeriodService musicGroupCalenderRefundPeriodService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
|
|
@@ -258,6 +261,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//进行中加学员拓展信息
|
|
|
CalenderAddStudent calenderAddStudent = musicGroupPaymentBaseCalender.getCalenderAddStudent();
|
|
|
MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
|
|
|
+ BeanUtils.copyProperties(musicGroupPaymentBaseCalender,musicGroupPaymentCalender);
|
|
|
//判断缴费项目类型
|
|
|
if (musicGroup.getStatus() == MusicGroupStatusEnum.DRAFT) {
|
|
|
musicGroupPaymentBaseCalender.setPaymentType(MUSIC_APPLY);
|
|
@@ -289,19 +293,24 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
BigDecimal originalTotalAmount = courseOriginalAmount.add(memberOriginalAmount)
|
|
|
.add(activityOriginalAmount)
|
|
|
.add(repairOriginalAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal actualTotalAmount;
|
|
|
|
|
|
- //计算缴费项目总金额(前端录入)
|
|
|
- BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
- BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
- BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
- BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ if(musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL){
|
|
|
+ actualTotalAmount = musicGroupPaymentBaseCalender.getCurrentTotalAmount();
|
|
|
+ }else {
|
|
|
+ //计算缴费项目总金额(前端录入)
|
|
|
+ BigDecimal courseActualAmount = musicGroupPaymentCalenderCourseSettingsService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal memberActualAmount = musicGroupPaymentCalenderMemberService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
+ BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
|
|
|
|
|
|
- BigDecimal actualTotalAmount = courseActualAmount.add(memberActualAmount)
|
|
|
- .add(repairActualAmount)
|
|
|
- .add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ actualTotalAmount = courseActualAmount.add(memberActualAmount)
|
|
|
+ .add(repairActualAmount)
|
|
|
+ .add(activityActualAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
|
|
|
- PaymentCalenderStatusEnum status = PaymentCalenderStatusEnum.DRAFT;
|
|
|
- /*if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
|
|
|
+ PaymentCalenderStatusEnum status;
|
|
|
+ if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
|
|
|
status = AUDITING;
|
|
|
} else {
|
|
|
//计算项目原现价
|
|
@@ -320,27 +329,19 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
.add(activityCurrentAmount).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
status = actualTotalAmount.compareTo(currentTotalAmount) == 0 ? NO : AUDITING;
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
Date date = new Date();
|
|
|
|
|
|
- musicGroupPaymentCalender.setIsShowSalePrice(musicGroupPaymentBaseCalender.getIsShowSalePrice());
|
|
|
- musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentBaseCalender.getDeadlinePaymentDate());
|
|
|
- musicGroupPaymentCalender.setMemo(musicGroupPaymentBaseCalender.getMemo());
|
|
|
musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
|
|
|
- musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId());
|
|
|
- musicGroupPaymentCalender.setPayUserType(musicGroupPaymentBaseCalender.getPayUserType());
|
|
|
- musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentBaseCalender.getStartPaymentDate());
|
|
|
musicGroupPaymentCalender.setOperator(sysUser.getId());
|
|
|
musicGroupPaymentCalender.setCreateTime(date);
|
|
|
musicGroupPaymentCalender.setUpdateTime(date);
|
|
|
- musicGroupPaymentCalender.setPaymentType(musicGroupPaymentBaseCalender.getPaymentType());
|
|
|
musicGroupPaymentCalender.setCurrentTotalAmount(actualTotalAmount);
|
|
|
musicGroupPaymentCalender.setOriginalTotalAmount(originalTotalAmount);
|
|
|
musicGroupPaymentCalender.setStatus(status);
|
|
|
musicGroupPaymentCalender.setOrganId(musicGroup.getOrganId());
|
|
|
- musicGroupPaymentCalender.setPaymentItemShowState(musicGroupPaymentBaseCalender.getPaymentItemShowState());
|
|
|
|
|
|
- /*if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
|
if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
|
|
|
} else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
|
|
@@ -348,7 +349,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
} else {
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
// 设置批次号
|
|
|
String batchNo = idGeneratorService.generatorId() + "";
|
|
|
musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
@@ -356,13 +357,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if(musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
|
|
|
if(musicGroupPaymentCalender.getPaymentType() == ADD_STUDENT){
|
|
|
musicGroupPaymentCalender.setCloudTeacherPaymentFlag(true);
|
|
|
- }else if(memberActualAmount.compareTo(BigDecimal.ZERO) > 0 &&
|
|
|
+ }/*else if(memberActualAmount.compareTo(BigDecimal.ZERO) > 0 &&
|
|
|
((courseActualAmount.compareTo(BigDecimal.ZERO) == 0 && CollectionUtils.isNotEmpty(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList()))
|
|
|
|| (activityActualAmount.compareTo(BigDecimal.ZERO) == 0 && CollectionUtils.isNotEmpty(musicGroupPaymentBaseCalender.getCalenderActivityList())))) {
|
|
|
musicGroupPaymentCalender.setCloudTeacherPaymentFlag(true);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
+ musicGroupPaymentBaseCalender.setCalenderId(musicGroupPaymentCalender.getId());
|
|
|
+ //如果是学校缴费,需要保存还款周期
|
|
|
+ musicGroupCalenderRefundPeriodService.savePeriod(musicGroupPaymentBaseCalender);
|
|
|
|
|
|
operatingReportCloudService.save(musicGroupPaymentCalender);
|
|
|
Long calenderId = musicGroupPaymentCalender.getId();
|