Browse Source

update 修改财务管理下载、订单下载的方式

周箭河 4 năm trước cách đây
mục cha
commit
a3b8317874

+ 17 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -106,7 +106,7 @@ public class ExportServiceImpl implements ExportService {
                             break;
                         case MUSICAL:
                             if (orderDetail.getKitGroupPurchaseType() != null && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
-                                BigDecimal leaseFee = orderDetail.getPrice();
+                                BigDecimal leaseFee = BigDecimal.ZERO;
                                 if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
                                     leaseFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
                                 }
@@ -121,6 +121,12 @@ public class ExportServiceImpl implements ExportService {
                             break;
                         case OTHER:
                             row.setOtherFee(row.getOtherFee().add(orderDetail.getPrice()));
+                        case MAINTENANCE:
+                            BigDecimal repairFee = BigDecimal.ZERO;
+                            if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
+                                repairFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
+                            }
+                            row.setRepairFee(repairFee);
                         default:
                             break;
                     }
@@ -188,7 +194,7 @@ public class ExportServiceImpl implements ExportService {
                 StudentPaymentOrderExportDto feeByType = sellOrderDao.getFeeByType(row.getId());
                 row.setMusicalFee(feeByType.getMusicalFee());
                 row.setTeachingFee(feeByType.getTeachingFee());
-                row.setRepairFee(feeByType.getRepairFee());
+                row.setRepairFee(row.getRepairFee().add(feeByType.getRepairFee()));
                 row.setOtherFee(feeByType.getOtherFee());
                 if (row.getGroupType().equals(GroupType.MUSIC)) {
                     StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
@@ -197,7 +203,7 @@ public class ExportServiceImpl implements ExportService {
                         row.setSchoolName(studentRegistration.getSchoolName());
                         row.setCooperationOrganName(studentRegistration.getRemark());
                     }
-                    row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getRepairFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()));
+                    row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(row.getRepairFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()));
                 } else if (row.getType().equals(OrderTypeEnum.REPAIR)) {
                     row.setRepairFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getOtherFee()));
                 } else if (row.getType().equals(OrderTypeEnum.OUTORDER)) {
@@ -327,6 +333,12 @@ public class ExportServiceImpl implements ExportService {
                             break;
                         case OTHER:
                             row.setOtherFee(row.getOtherFee().add(orderDetail.getPrice()));
+                        case MAINTENANCE:
+                            BigDecimal repairFee = BigDecimal.ZERO;
+                            if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
+                                repairFee = orderDetail.getPrice().multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
+                            }
+                            row.setRepairFee(repairFee);
                         default:
                             break;
                     }
@@ -394,7 +406,7 @@ public class ExportServiceImpl implements ExportService {
                 StudentPaymentOrderExportDto feeByType = sellOrderDao.getFeeByType(row.getId());
                 row.setMusicalFee(feeByType.getMusicalFee());
                 row.setTeachingFee(feeByType.getTeachingFee());
-                row.setRepairFee(feeByType.getRepairFee());
+                row.setRepairFee(row.getRepairFee().add(feeByType.getRepairFee()));
                 row.setOtherFee(feeByType.getOtherFee());
                 if (row.getGroupType().equals(GroupType.MUSIC)) {
                     StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
@@ -403,7 +415,7 @@ public class ExportServiceImpl implements ExportService {
                         row.setSchoolName(studentRegistration.getSchoolName());
                         row.setCooperationOrganName(studentRegistration.getRemark());
                     }
-                    row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getRepairFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()));
+                    row.setMusicGroupCourseFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(row.getRepairFee()).subtract(feeByType.getOtherFee()).subtract(row.getLeaseFee()));
                 } else if (row.getType().equals(OrderTypeEnum.REPAIR)) {
                     row.setRepairFee(feeByType.getActualAmount().subtract(feeByType.getMusicalFee()).subtract(feeByType.getTeachingFee()).subtract(feeByType.getOtherFee()));
                 } else if (row.getType().equals(OrderTypeEnum.OUTORDER)) {