|
@@ -415,6 +415,7 @@ 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<>();
|
|
@@ -444,7 +445,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
orderAmount = orderAmount.add(orderDetail.getPrice());
|
|
|
}
|
|
|
- } else if (studentRegistration.getTemporaryCourseFee() == null && StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
|
|
|
+ } else if (StringUtils.isNoneBlank(registerPayDto.getGoodsGroupIds())) {
|
|
|
goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(registerPayDto.getGoodsGroupIds());
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
if (goodsGroup.getType().equals(GoodsType.INSTRUMENT) && musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
@@ -467,6 +468,42 @@ 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);
|
|
|
}
|
|
|
|
|
|
//单独辅件
|
|
@@ -507,7 +544,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.setBalancePaymentAmount(amount);
|
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
@@ -705,7 +742,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("用户账户找不到");
|
|
|
}
|
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
- if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
|
|
|
+ if(userCashAccount.getBalance().subtract(amount).doubleValue() >= 0){
|
|
|
// 更新订单信息
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
|
studentPaymentOrder.setOrganId(musicGroup.getOrganId());
|
|
@@ -1451,7 +1488,7 @@ 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("已缴费");
|
|
@@ -1771,44 +1808,44 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
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;
|
|
|
- }
|
|
|
+ boolean isModifiedOfCalender = false;
|
|
|
|
|
|
- if (isModifiedOfCalender) {
|
|
|
-
|
|
|
- Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
- if (num > 0) {
|
|
|
- throw new BizException("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
- }
|
|
|
-
|
|
|
- // 删除乐团相关付费周期
|
|
|
- musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
- musicGroupStudentFeeDao.deleteByMusicGroupId(musicGroupId,0);
|
|
|
- if (months != null && months.size() > 0) {
|
|
|
- // 批量插入
|
|
|
- musicGroupPaymentCalenderDao.batchAdd(months, musicGroupId);
|
|
|
- }
|
|
|
- if(musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS){
|
|
|
+ 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("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 删除乐团相关付费周期
|
|
|
+ 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");
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
//修改课程里面的教学点
|
|
|
if(!musicGroup.getSchoolId().equals(musicGroup.getSchoolId())){
|