|
@@ -323,7 +323,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(userCashAccount == null){
|
|
|
throw new BizException("用户账户找不到");
|
|
|
}
|
|
|
- if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
|
|
|
+ if(userCashAccount.getBalance().subtract(amount).doubleValue() >= 0){
|
|
|
// 更新订单信息
|
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
@@ -415,7 +415,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
BigDecimal instrumentFee = BigDecimal.ZERO;
|
|
|
BigDecimal accessoriesFee = BigDecimal.ZERO;
|
|
|
BigDecimal otherFee = BigDecimal.ZERO;
|
|
|
- BigDecimal remitFee = BigDecimal.ZERO;
|
|
|
|
|
|
//乐器及打包辅件
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
|
|
@@ -445,7 +444,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
orderAmount = orderAmount.add(orderDetail.getPrice());
|
|
|
}
|
|
|
- } else if (StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
|
|
|
+ } else if (studentRegistration.getTemporaryCourseFee() == null && StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
|
|
|
goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
@@ -468,42 +467,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
courseFee.subtract(goodsGroup.getRemissionCourseFee());
|
|
|
}
|
|
|
}
|
|
|
- } else if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
|
|
|
- String goodsGroupIds = registerPayDto.getGoodsGroups().keySet().stream().map(key -> key.toString()).collect(Collectors.joining(","));
|
|
|
- goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(goodsGroupIds);
|
|
|
- for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
- Map groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), HashMap.class);
|
|
|
- if (registerPayDto.getGoodsGroups().get(goodsGroup.getId()).equals("GROUP")) {
|
|
|
- if(!groupType.containsKey("GROUP")){
|
|
|
- throw new BizException("乐器提供方式不存在");
|
|
|
- }
|
|
|
- remitFee = new BigDecimal((String) groupType.get("GROUP"));
|
|
|
- }
|
|
|
- if (registerPayDto.getGoodsGroups().get(goodsGroup.getId()).equals("LEASE")) {
|
|
|
- if(!groupType.containsKey("LEASE")){
|
|
|
- throw new BizException("乐器提供方式不存在");
|
|
|
- }
|
|
|
- goodsGroup.setPrice(goodsGroup.getDepositFee());
|
|
|
- goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.LEASE);
|
|
|
- remitFee = new BigDecimal((String) groupType.get("LEASE"));
|
|
|
- }
|
|
|
- if (registerPayDto.getGoodsGroups().get(goodsGroup.getId()).equals("FREE")) {
|
|
|
- if(!groupType.containsKey("FREE")){
|
|
|
- throw new BizException("乐器提供方式不存在");
|
|
|
- }
|
|
|
- goodsGroup.setPrice(new BigDecimal(0));
|
|
|
- remitFee = new BigDecimal((String) groupType.get("FREE"));
|
|
|
- }
|
|
|
- if(goodsGroup.getType().equals(GoodsType.INSTRUMENT)){
|
|
|
- instrumentFee = instrumentFee.add(goodsGroup.getPrice());
|
|
|
- }else if(goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
- accessoriesFee = accessoriesFee.add(goodsGroup.getPrice());
|
|
|
- }else {
|
|
|
- otherFee = otherFee.add(goodsGroup.getPrice());
|
|
|
- }
|
|
|
- orderAmount = orderAmount.add(goodsGroup.getPrice());
|
|
|
- }
|
|
|
- orderAmount.subtract(remitFee);
|
|
|
}
|
|
|
|
|
|
//单独辅件
|
|
@@ -549,7 +512,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
- sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
|
|
|
+ sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团报名");
|
|
|
amount = BigDecimal.ZERO;
|
|
|
}else{
|
|
|
if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
@@ -747,7 +710,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
|
- sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
|
|
|
+ sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团报名");
|
|
|
amount = BigDecimal.ZERO;
|
|
|
}else{
|
|
|
if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
@@ -903,6 +866,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(musicGroupStudentFees != null && musicGroupStudentFees.size() > 0){
|
|
|
musicGroupStudentFeeDao.batchInsert(musicGroupStudentFees,musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null,null),"PAID_COMPLETED");
|
|
|
}
|
|
|
+ musicGroupStudentFeeDao.batchUpdateCalenders(musicGroupId);
|
|
|
//记录操作日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"确认开团(筹备中 -> 进行中)",sysUser.getId(),""));
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.PROGRESS);
|
|
@@ -1488,13 +1452,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (orderList == null || orderList.size() == 0) {
|
|
|
throw new BizException("请走报名缴费流程");
|
|
|
}*/
|
|
|
-
|
|
|
+
|
|
|
// 判断当前是否是续费状态
|
|
|
if (musicGroupStudentFee.getPaymentStatus() != PaymentStatus.NON_PAYMENT) {
|
|
|
throw new BizException("已缴费");
|
|
|
}
|
|
|
|
|
|
- BigDecimal amount = musicGroupStudentFee.getTemporaryCourseFee();
|
|
|
+ BigDecimal amount = musicGroupStudentFee.getCourseFee();
|
|
|
if (amount == null || amount.doubleValue() == 0) {
|
|
|
amount = musicGroupStudentFee.getCourseFee();
|
|
|
}
|
|
@@ -1665,6 +1629,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, yimei, null, 0, "1",
|
|
|
studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
|
|
|
return true;
|
|
|
+ } else {
|
|
|
+ if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().doubleValue() > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(userId, studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS,
|
|
|
+ "乐团续费失败");
|
|
|
+ }
|
|
|
}
|
|
|
if(studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED){
|
|
|
String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
|
|
@@ -1805,46 +1774,50 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//如果已生成课表,那么修改未上课时教学点
|
|
|
courseScheduleDao.updateCourseScheduleSchool("MUSIC",musicGroupId,musicGroup.getSchoolId());
|
|
|
}
|
|
|
-
|
|
|
- Date date = new Date();
|
|
|
List<Integer> months = subFeeSettingDto.getMonths();
|
|
|
-
|
|
|
+
|
|
|
//判断缴费日历是否修改
|
|
|
- boolean isModifiedOfCalender = false;
|
|
|
-
|
|
|
- List<MusicGroupPaymentCalender> calenderList = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
- if (months.size() == calenderList.size()) {
|
|
|
- for (MusicGroupPaymentCalender cal : calenderList) {
|
|
|
- if (!months.contains(cal.getPaymentMonth())) {
|
|
|
- isModifiedOfCalender = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- isModifiedOfCalender = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (isModifiedOfCalender) {
|
|
|
-
|
|
|
- Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
- if (num > 0) {
|
|
|
- throw new BizException("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
- }
|
|
|
+ boolean isModifiedOfCalender = false;
|
|
|
+
|
|
|
+ List<MusicGroupPaymentCalender> calenderList = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
+ if (months.size() == calenderList.size()) {
|
|
|
+ for (MusicGroupPaymentCalender cal : calenderList) {
|
|
|
+ if (!months.contains(cal.getPaymentMonth())) {
|
|
|
+ isModifiedOfCalender = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isModifiedOfCalender = true;
|
|
|
+ }
|
|
|
|
|
|
- // 删除乐团相关付费周期
|
|
|
- musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
- musicGroupStudentFeeDao.deleteByMusicGroupId(musicGroupId,0);
|
|
|
- if (months != null && months.size() > 0) {
|
|
|
- // 批量插入
|
|
|
- musicGroupPaymentCalenderDao.batchAdd(months, musicGroupId);
|
|
|
- }
|
|
|
- if(musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS){
|
|
|
- //生成学员费用表
|
|
|
- List<MusicGroupStudentFee> musicGroupStudentFees = musicGroupStudentFeeDao.initMusicGroupStudentFee(musicGroupId);
|
|
|
- if(musicGroupStudentFees != null && musicGroupStudentFees.size() > 0){
|
|
|
- musicGroupStudentFeeDao.batchInsert(musicGroupStudentFees,musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null,null),"PAID_COMPLETED");
|
|
|
- }
|
|
|
+ if (isModifiedOfCalender) {
|
|
|
+ Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
+ if (num > 0) {
|
|
|
+ throw new BizException("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除乐团相关付费周期
|
|
|
+ musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
+ if (months != null && months.size() > 0) {
|
|
|
+ // 批量插入
|
|
|
+ musicGroupPaymentCalenderDao.batchAdd(months, musicGroupId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS){
|
|
|
+ //修改未锁定学员缴费周期
|
|
|
+ String join = null;
|
|
|
+ if (months != null && months.size() > 0) {
|
|
|
+ join = StringUtils.join(months,",");
|
|
|
}
|
|
|
+ musicGroupStudentFeeDao.batchUpdateCalender(join,musicGroupId);
|
|
|
+ List<MusicGroupStudentFee> fees = musicGroupStudentFeeDao.queryByMusicGroupId(musicGroupId);
|
|
|
+ Date date = new Date();
|
|
|
+ fees.forEach(e->{
|
|
|
+ e.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null,e));
|
|
|
+ e.setUpdateTime(date);
|
|
|
+ });
|
|
|
+ musicGroupStudentFeeDao.batchUpdate(fees);
|
|
|
}
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
//修改课程里面的教学点
|