|
|
@@ -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() {
|
|
|
@@ -238,15 +241,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
throw new BizException("请登录");
|
|
|
});
|
|
|
|
|
|
- if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
|
|
|
- throw new BizException("创建缴费失败:已存在缴费项目");
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
|
|
|
+ throw new BizException("只有‘草稿’状态才能创建报名缴费");
|
|
|
}
|
|
|
// 所有缴费项目已完成排课才能创建下一个缴费项目
|
|
|
- String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
|
|
|
+ /*String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, null);
|
|
|
if (!musicGroupPaymentBaseCalender.getConfirmCreate() && StringUtils.isNoneBlank(orignBatchNo)) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return BaseController.failed(HttpStatus.MULTI_STATUS,"当前乐团存在未排课的缴费项目,请再次确认操作");
|
|
|
- }
|
|
|
+ return BaseController.failed(HttpStatus.MULTI_STATUS, "当前乐团存在未排课的缴费项目,请再次确认操作");
|
|
|
+ }*/
|
|
|
|
|
|
// 不是进行中,只能创建一次缴费
|
|
|
if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
|
|
|
@@ -258,8 +261,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//进行中加学员拓展信息
|
|
|
CalenderAddStudent calenderAddStudent = musicGroupPaymentBaseCalender.getCalenderAddStudent();
|
|
|
MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
|
|
|
+ BeanUtils.copyProperties(musicGroupPaymentBaseCalender,musicGroupPaymentCalender);
|
|
|
//判断缴费项目类型
|
|
|
- if (musicGroup.getStatus() == MusicGroupStatusEnum.PRE_BUILD_FEE) {
|
|
|
+ if (musicGroup.getStatus() == MusicGroupStatusEnum.DRAFT) {
|
|
|
musicGroupPaymentBaseCalender.setPaymentType(MUSIC_APPLY);
|
|
|
} else {
|
|
|
if (calenderAddStudent != null && calenderAddStudent.getStudentIds() != null) {
|
|
|
@@ -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;
|
|
|
- if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
|
|
|
+ if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
|
|
|
status = AUDITING;
|
|
|
} else {
|
|
|
//计算项目原现价
|
|
|
@@ -321,24 +330,16 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
status = actualTotalAmount.compareTo(currentTotalAmount) == 0 ? NO : AUDITING;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
Date date = new Date();
|
|
|
|
|
|
- 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 (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
|
|
|
@@ -349,7 +350,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 设置批次号
|
|
|
String batchNo = idGeneratorService.generatorId() + "";
|
|
|
musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
|
@@ -357,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();
|
|
|
@@ -403,38 +406,31 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
// 如果是报名,需要修改乐团状态
|
|
|
if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
|
|
|
- if (status != AUDITING) {
|
|
|
- musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
|
|
|
- // 记录操作日志
|
|
|
- musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费中 -> 报名中)", sysUser.getId(), ""));
|
|
|
- } else {
|
|
|
- musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
|
|
|
- // 记录操作日志
|
|
|
- musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 费用审核中)", sysUser.getId(), ""));
|
|
|
- }
|
|
|
+ // 记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功", sysUser.getId(), ""));
|
|
|
+
|
|
|
musicGroup.setUpdateTime(date);
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
}
|
|
|
- if (status == AUDITING) {
|
|
|
- // 如果是审核中
|
|
|
- Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
- sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
|
|
|
- null, null, MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, organization.getName(), musicGroup.getName());
|
|
|
- } else {
|
|
|
- if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
- addStudent(musicGroupPaymentCalender, musicGroup);
|
|
|
- //将0元未缴费学员缴费状态更新为已缴费
|
|
|
- this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender, true);
|
|
|
- // 学生加到班级
|
|
|
- classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
|
|
|
- batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(), musicGroup);
|
|
|
- ExecutorService executor = Executors.newFixedThreadPool(5);
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
|
|
|
- }, executor);
|
|
|
- executor.shutdown();
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
+ sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
|
|
|
+ null, null, MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, organization.getName(), musicGroup.getName());
|
|
|
+
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
+ addStudent(musicGroupPaymentCalender, musicGroup);
|
|
|
+ //将0元未缴费学员缴费状态更新为已缴费
|
|
|
+ this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender, true);
|
|
|
+ // 学生加到班级
|
|
|
+ classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
|
|
|
+ batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(), musicGroup);
|
|
|
+ ExecutorService executor = Executors.newFixedThreadPool(5);
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
|
|
|
+ }, executor);
|
|
|
+ executor.shutdown();
|
|
|
+ }
|
|
|
+
|
|
|
ModelMap map = new ModelMap(1);
|
|
|
map.put("musicGroupPaymentCalenderBatchNo", batchNo);
|
|
|
return BaseController.succeed(map);
|