liujc 2 年之前
父節點
當前提交
d5761a7b8a

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java

@@ -110,4 +110,12 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
     List<Map<Integer, Long>> getWaitActivateMap(@Param("organIds") List<Integer> organIds);
 
     List<Map<Integer, BigDecimal>> sumPersonIncome(@Param("month") String month);
+
+    List<Map<Integer,BigDecimal>> sumGroupCloudAmount(@Param("month") String month,
+                                                      @Param("firstDay") String firstDayOfMonth,
+                                                      @Param("lastDay") String lastDayOfMonth);
+
+    List<Map<Integer,BigDecimal>> sumPersonalCloudAmount(@Param("month") String month,
+                                                         @Param("firstDay") String firstDayOfMonth,
+                                                         @Param("lastDay") String lastDayOfMonth);
 }

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OperatingTotalIncomeDto.java

@@ -30,15 +30,21 @@ public class OperatingTotalIncomeDto {
     // 其他服务收入
     private BigDecimal otherServiceIncome = BigDecimal.ZERO;
 
-    // 云教练收入
+    // 云教练团云教练收入
     private BigDecimal cloudCoachIncome = BigDecimal.ZERO;
 
+    // 个人云教练收入
+    private BigDecimal saleCloudCoachIncome = BigDecimal.ZERO;
+
     // 团购乐器
     private BigDecimal groupPurchaseInstruments = BigDecimal.ZERO;
 
     // 团购教辅
     private BigDecimal groupPurchaseTeachingAids = BigDecimal.ZERO;
 
+    // 其他(零售乐器、教辅)
+    private BigDecimal otherIncome = BigDecimal.ZERO;
+
     // 大件乐器
     private BigDecimal largeInstruments = BigDecimal.ZERO;
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/FinancialExpenditure.java

@@ -59,7 +59,7 @@ public class FinancialExpenditure {
 	@ApiModelProperty(value = "费用明细",required = false)
 	private String itemDetail;
 	/**  */
-	@ApiModelProperty(value = "经营报表生效时间",required = false)
+	@ApiModelProperty(value = "费用分摊日期",required = false)
 	private String effectiveTime;
 	/**  */
 	@ApiModelProperty(value = "审批通过时间",required = false)

+ 28 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -2329,12 +2329,19 @@ public class ExportServiceImpl implements ExportService {
         //按分部分组
         Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(e -> e.getOrganId()));
         List<OperatingTotalIncomeDto> incomeDtos = new ArrayList<>();
-        //统计云教练个人收入
-        List<Map<Integer, BigDecimal>> personIncomeMapList = cloudTeacherOrderDao.sumPersonIncome(params.get("month").toString());
-        Map<Integer, BigDecimal> personIncomeMap = new HashMap<>();
-        if(!CollectionUtils.isEmpty(personIncomeMapList)){
-            personIncomeMap = MapUtil.convertIntegerMap(personIncomeMapList);
-        }
+        //承担课程的云教练收入
+        String month = params.get("month").toString();
+        String firstDayOfMonth = DateUtil.dateToString(DateUtil.getFirstDayOfMonth(DateUtil.stringToDate(month,DateUtil.ISO_YEAR_MONTH_FORMAT)),DateUtil.ISO_EXPANDED_DATE_FORMAT);
+        String lastDayOfMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(DateUtil.stringToDate(month,DateUtil.ISO_YEAR_MONTH_FORMAT)),DateUtil.ISO_EXPANDED_DATE_FORMAT);
+        Map<Integer, BigDecimal> groupCloudAmount = MapUtil.convertIntegerMap(cloudTeacherOrderDao.sumGroupCloudAmount(month,firstDayOfMonth,lastDayOfMonth));
+        //不承担课程的云教练收入
+        Map<Integer, BigDecimal> personalCloudAmount = MapUtil.convertIntegerMap(cloudTeacherOrderDao.sumPersonalCloudAmount(month,firstDayOfMonth,lastDayOfMonth));
+
+//        List<Map<Integer, BigDecimal>> personIncomeMapList = cloudTeacherOrderDao.sumPersonIncome(params.get("month").toString());
+//        Map<Integer, BigDecimal> personIncomeMap = new HashMap<>();
+//        if(!CollectionUtils.isEmpty(personIncomeMapList)){
+//            personIncomeMap = MapUtil.convertIntegerMap(personIncomeMapList);
+//        }
         for (Integer organId : listMap.keySet()) {
             OperatingTotalIncomeDto incomeDto = new OperatingTotalIncomeDto();
             incomeDto.setOrganName(userOrganNameMap.get(organId));
@@ -2529,8 +2536,6 @@ public class ExportServiceImpl implements ExportService {
                         .add(row.getVipCourseFee())
                         .add(row.getPracticeCourseFee())
                         .add(row.getTheoryCourseFee()));
-                //云教练团课耗收入
-//                incomeDto.setCloudCoachGroupClassIncome();
                 //学校课程采买
                 incomeDto.setCoursePurchaseIncome(incomeDto.getCoursePurchaseIncome()
                         .add(row.getCourseSchoolBuyAmount()));
@@ -2552,16 +2557,26 @@ public class ExportServiceImpl implements ExportService {
                 );
                 //团购乐器
                 incomeDto.setGroupPurchaseInstruments(incomeDto.getGroupPurchaseInstruments()
+                        .add(row.getMusicalFee()));
+                //零售乐器,计入其他
+                incomeDto.setOtherIncome(incomeDto.getOtherIncome()
                         .add(row.getRetailGoodsFee()));
-                //教辅
-                incomeDto.setGroupPurchaseTeachingAids(incomeDto.getGroupPurchaseTeachingAids()
-                        .add(row.getTeachingFee()));
+                if(row.getGroupType() == GroupType.GOODS_SELL){
+                    //零售教辅,计入其他
+                    incomeDto.setOtherIncome(incomeDto.getOtherIncome()
+                            .add(row.getTeachingFee()));
+                }else {
+                    //团购教辅
+                    incomeDto.setGroupPurchaseTeachingAids(incomeDto.getGroupPurchaseTeachingAids()
+                            .add(row.getTeachingFee()));
+                }
+
                 //大件乐器
                 incomeDto.setLargeInstruments(incomeDto.getLargeInstruments()
                         .add(row.getLargeMusicalFee()));
-                //其他?
             }
-            incomeDto.setCloudCoachIncome(incomeDto.getCloudCoachIncome().add(personIncomeMap.getOrDefault(organId,BigDecimal.ZERO)));
+            incomeDto.setCloudCoachIncome(incomeDto.getCloudCoachIncome().add(groupCloudAmount.getOrDefault(organId,BigDecimal.ZERO)));
+            incomeDto.setSaleCloudCoachIncome(incomeDto.getSaleCloudCoachIncome().add(personalCloudAmount.getOrDefault(organId,BigDecimal.ZERO)));
             //服务收入
             incomeDto.setServiceIncome(incomeDto.getLargeInstruments()
                     .add(incomeDto.getStudentGuidanceIncome())

+ 118 - 153
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -254,87 +254,90 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
             JSONObject formData = JSONObject.parseObject(financialExpenditureDao.getFormData(workOrderId));
             OaFormStructureDto oaFormStructureDto = JSONObject.parseObject(formStructure, OaFormStructureDto.class);
             List<OaInputDto> oaInputDtos = oaFormStructureDto.getList();
-            Date now = new Date();
             //课程退费和乐团退费需要单独处理
             if(pWorkOrderInfo.getProcess().equals(33) ||
                     pWorkOrderInfo.getProcess().equals(22) ||
                     pWorkOrderInfo.getProcess().equals(19) ||
-                    pWorkOrderInfo.getProcess().equals(28)){
+                    pWorkOrderInfo.getProcess().equals(51) ||
+                    pWorkOrderInfo.getProcess().equals(28)
+            ){
                 List<FinancialExpenditure> financialExpenditureList = new ArrayList<>();
                 Integer organId = null;
                 String note = "";
+                ExpenditureTypeEnum expenditureTypeEnum = ExpenditureTypeEnum.REFUND;
+                FeeProjectEnum feeProjectEnum = FeeProjectEnum.REFUND;
                 BigDecimal totalAmount = BigDecimal.ZERO;
+
                 for (OaInputDto oaInputDto : oaInputDtos) {
-                    if (StringUtils.equals("分部",oaInputDto.getName())) {
-                        String submitForm = oaInputDto.getModel();
-                        if(Objects.isNull(formData.get(submitForm))){
-                            continue;
-                        }
-                        organId = Integer.parseInt(formData.get(submitForm).toString());
+                    String submitForm = oaInputDto.getModel();
+                    Object submitValue = formData.get(submitForm);
+                    if (Objects.isNull(submitValue) || StringUtils.isEmpty(submitValue.toString())) {
+                        continue;
                     }
-                    if (StringUtils.equals("情况说明",oaInputDto.getName())) {
-                        String submitForm = oaInputDto.getModel();
-                        if(Objects.isNull(formData.get(submitForm))){
-                            continue;
-                        }
-                        note = formData.get(submitForm).toString();
+                    if (StringUtils.equals("分部", oaInputDto.getName())) {
+                        organId = Integer.parseInt(submitValue.toString());
                     }
-                    if (StringUtils.equals("金额",oaInputDto.getName())) {
-                        String submitForm = oaInputDto.getModel();
-                        if(Objects.isNull(formData.get(submitForm))){
-                            continue;
-                        }
-                        totalAmount = new BigDecimal(formData.get(submitForm).toString());
+                    if (StringUtils.equals("情况说明", oaInputDto.getName())) {
+                        note = submitValue.toString();
                     }
-                    if(!StringUtils.equals("子表单",oaInputDto.getName()) && !StringUtils.equals("分摊明细",oaInputDto.getName())){
-                        continue;
+                    if (oaInputDto.getName().contains("金额")) {
+                        totalAmount = new BigDecimal(submitValue.toString());
+                    }
+                    if (StringUtils.equals("支出类型", oaInputDto.getName())) {
+                        expenditureTypeEnum = ExpenditureTypeEnum.valueOfDesc(submitValue.toString());
+                    }
+                    if (StringUtils.equals("费用类别", oaInputDto.getName()) || StringUtils.equals("费用类型", oaInputDto.getName())) {
+                        feeProjectEnum = FeeProjectEnum.valueOfDesc(submitValue.toString());
                     }
+                }
+
+                for (OaInputDto oaInputDto : oaInputDtos) {
                     String submitForm = oaInputDto.getModel();
-                    if(Objects.isNull(formData.get(submitForm))){
+                    Object submitValue = formData.get(submitForm);
+                    if(Objects.isNull(submitValue)){
+                        continue;
+                    }
+                    if(!StringUtils.equals("子表单",oaInputDto.getName()) && !StringUtils.equals("分摊明细",oaInputDto.getName())){
                         continue;
                     }
                     List<HashMap> hashMaps = JSONObject.parseArray(formData.get(submitForm).toString(), HashMap.class);
                     if(StringUtils.equals("分摊明细",oaInputDto.getName())){
                         //处理房租的分摊明细
-                        nullUser:
+                        nullAmount:
                         for (HashMap hashMap : hashMaps) {
                             List<OaColumnDto> columns = oaInputDto.getColumns();
                             if (columns != null && columns.size() > 0) {
-                                nullAmount:for (OaColumnDto column : columns) {
+                                FinancialExpenditure financialExpenditure = new FinancialExpenditure();
+                                for (OaColumnDto column : columns) {
                                     List<OaInputDto> columnList = column.getList();
                                     if (columnList != null && columnList.size() > 0) {
-                                        FinancialExpenditure financialExpenditure = new FinancialExpenditure();
                                         for (OaInputDto inputDto : columnList) {
                                             String name = inputDto.getName();
-                                            if (name.contains("金额")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setCurrentAmount(new BigDecimal(Double.parseDouble(o.toString())));
-                                                }else {
-                                                    continue nullAmount;
-                                                }
-                                            } else if (name.contains("日期")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setEffectiveTime(o.toString());
-                                                }else {
-                                                    continue nullAmount;
-                                                }
+                                            Object o = hashMap.get(inputDto.getModel());
+                                            if (Objects.isNull(o) || StringUtils.isEmpty(o.toString())) {
+                                                continue nullAmount;
+                                            }
+                                            if (StringUtils.equals(name,"金额")) {
+                                                financialExpenditure.setCurrentAmount(new BigDecimal(Double.parseDouble(o.toString())));
+                                            } else if (StringUtils.equals(name,"日期")) {
+                                                financialExpenditure.setEffectiveTime(o.toString());
                                             }
                                         }
-                                        financialExpenditure.setAprovalTime(endTime);
-                                        financialExpenditure.setPaymentTime(endTime);
-                                        financialExpenditure.setAmount(totalAmount);
-                                        financialExpenditure.setCause(note);
-                                        financialExpenditure.setBatchNo(pWorkOrderInfo.getId().toString());
-                                        financialExpenditure.setFinancialProcessNo(pWorkOrderInfo.getId().toString());
-                                        financialExpenditure.setApplyUser(realName);
-                                        financialExpenditure.setApplyUserId(pWorkOrderInfo.getCreator());
-                                        financialExpenditure.setProcessId(pWorkOrderInfo.getProcess());
-                                        financialExpenditure.setOrganId(organId);
-                                        financialExpenditureList.add(financialExpenditure);
                                     }
                                 }
+                                financialExpenditure.setFeeProject(feeProjectEnum);
+                                financialExpenditure.setType(expenditureTypeEnum);
+                                financialExpenditure.setAprovalTime(endTime);
+                                financialExpenditure.setPaymentTime(endTime);
+                                financialExpenditure.setAmount(totalAmount);
+                                financialExpenditure.setCause(note);
+                                financialExpenditure.setBatchNo(pWorkOrderInfo.getId().toString());
+                                financialExpenditure.setFinancialProcessNo(pWorkOrderInfo.getId().toString());
+                                financialExpenditure.setApplyUser(realName);
+                                financialExpenditure.setApplyUserId(pWorkOrderInfo.getCreator());
+                                financialExpenditure.setProcessId(pWorkOrderInfo.getProcess());
+                                financialExpenditure.setOrganId(organId);
+                                financialExpenditureList.add(financialExpenditure);
                             }
                         }
                     }else {
@@ -342,13 +345,13 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                         for (HashMap hashMap : hashMaps) {
                             FinancialExpenditure financialExpenditure = new FinancialExpenditure();
                             financialExpenditure.setAprovalTime(endTime);
-                            financialExpenditure.setPaymentTime(endTime);
                             financialExpenditure.setBatchNo(pWorkOrderInfo.getId().toString());
                             financialExpenditure.setFinancialProcessNo(pWorkOrderInfo.getId().toString());
                             financialExpenditure.setApplyUser(realName);
                             financialExpenditure.setApplyUserId(pWorkOrderInfo.getCreator());
                             financialExpenditure.setProcessId(pWorkOrderInfo.getProcess());
                             financialExpenditure.setEffectiveTime(DateUtil.format(endTime,DateUtil.ISO_YEAR_MONTH_FORMAT));
+                            financialExpenditure.setType(expenditureTypeEnum);
                             List<OaColumnDto> columns = oaInputDto.getColumns();
                             if (columns != null && columns.size() > 0) {
                                 for (OaColumnDto column : columns) {
@@ -356,84 +359,54 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                                     if (columnList != null && columnList.size() > 0) {
                                         for (OaInputDto inputDto : columnList) {
                                             String name = inputDto.getName();
-                                            if (name.contains("课程组编号")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setVipGroupId(Long.parseLong(o.toString()));
-                                                    continue;
-                                                }
-                                            } else if (name.contains("课程类型")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setGroupType(o.toString());
-                                                    continue;
-                                                }
-                                            } else if (name.contains("乐团编号")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setMusicGroupId(o.toString());
-                                                    continue;
-                                                }
-                                            } else if (name.contains("退费项目")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setReturnFeeType(o.toString());
-                                                    continue;
-                                                }
-                                            } else if (name.contains("学员编号")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setStudentId(Integer.parseInt(o.toString()));
-                                                    continue;
-                                                } else {
-                                                    continue nullUser;
-                                                }
-                                            } else if (name.contains("分部")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    Organization organization = organizationDao.get(Integer.parseInt(o.toString()));
-                                                    if (organization != null) {
-                                                        financialExpenditure.setOrganId(organization.getId());
-                                                        financialExpenditure.setOrganName(organization.getName());
-                                                    }
-                                                    continue;
-                                                }
-                                            } else if (name.contains("金额") || name.contains("住宿费") || name.contains("出差补助") || name.contains("交通费")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setAmount(financialExpenditure.getAmount().add(new BigDecimal(Double.parseDouble(o.toString()))));
-                                                    financialExpenditure.setCurrentAmount(financialExpenditure.getAmount());
-                                                    continue;
-                                                }
-                                            } else if (name.contains("情况说明") || name.contains("事由")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setCause(o.toString());
-                                                    continue;
-                                                }
-                                            } else if (name.contains("支出类型")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setType(ExpenditureTypeEnum.valueOfDesc(o.toString()));
-                                                    continue;
-                                                }
-                                            } else if (name.contains("费用类型") || name.contains("费用类别")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setFeeProject(FeeProjectEnum.valueOfDesc(o.toString()));
-                                                    continue;
+                                            Object o = hashMap.get(inputDto.getModel());
+                                            if (Objects.isNull(o) || StringUtils.isEmpty(o.toString())) {
+                                                continue;
+                                            }
+                                            if (StringUtils.equals(name,"课程组编号")) {
+                                                financialExpenditure.setVipGroupId(Long.parseLong(o.toString()));
+                                            } else if (StringUtils.equals(name,"课程类型")) {
+                                                financialExpenditure.setGroupType(o.toString());
+                                            } else if (StringUtils.equals(name,"乐团编号")) {
+                                                financialExpenditure.setMusicGroupId(o.toString());
+                                            } else if (StringUtils.equals(name,"退费项目")) {
+                                                financialExpenditure.setReturnFeeType(o.toString());
+                                            } else if (StringUtils.equals(name,"学员编号")) {
+                                                financialExpenditure.setStudentId(Integer.parseInt(o.toString()));
+                                            } else if (StringUtils.equals(name,"分部")) {
+                                                Organization organization = organizationDao.get(Integer.parseInt(o.toString()));
+                                                if (organization != null) {
+                                                    financialExpenditure.setOrganId(organization.getId());
+                                                    financialExpenditure.setOrganName(organization.getName());
                                                 }
-                                            } else if (name.contains("住宿费")) {
-                                                Object o = hashMap.get(inputDto.getModel());
-                                                if (Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())) {
-                                                    financialExpenditure.setFeeProject(FeeProjectEnum.valueOfDesc(o.toString()));
-                                                    continue;
+                                            } else if (StringUtils.equals(name,"金额") || StringUtils.equals(name,"住宿费") || StringUtils.equals(name,"出差补助") || StringUtils.equals(name,"交通费")) {
+                                                financialExpenditure.setAmount(financialExpenditure.getAmount().add(new BigDecimal(Double.parseDouble(o.toString()))));
+                                                financialExpenditure.setCurrentAmount(financialExpenditure.getAmount());
+                                            } else if (StringUtils.equals(name,"情况说明") || StringUtils.equals(name,"事由")) {
+                                                financialExpenditure.setCause(o.toString());
+                                            } else if (StringUtils.equals(name,"支出类型")) {
+                                                financialExpenditure.setType(ExpenditureTypeEnum.valueOfDesc(o.toString()));
+                                            } else if (StringUtils.equals(name,"费用类型") || StringUtils.equals(name,"费用类别")) {
+                                                FeeProjectEnum projectEnum = FeeProjectEnum.valueOfDesc(o.toString());
+                                                if(projectEnum == null){
+                                                    projectEnum = feeProjectEnum;
                                                 }
+                                                financialExpenditure.setFeeProject(projectEnum);
+                                            }else if (StringUtils.equals(name,"日期") || StringUtils.equals(name,"费用发生日期")) {
+                                                financialExpenditure.setPaymentTime(DateUtil.stringToDate(o.toString(),DateUtil.DEFAULT_PATTERN));
+                                            } else if (StringUtils.equals(name,"费用分摊月份")) {
+                                                financialExpenditure.setEffectiveTime(o.toString());
                                             }
                                         }
                                     }
                                 }
                             }
+                            if(financialExpenditure.getPaymentTime() == null){
+                                financialExpenditure.setPaymentTime(endTime);
+                            }
+                            if(StringUtils.isEmpty(financialExpenditure.getEffectiveTime())){
+                                financialExpenditure.setEffectiveTime(DateUtil.format(financialExpenditure.getPaymentTime(),DateUtil.ISO_YEAR_MONTH_FORMAT));
+                            }
                             financialExpenditureList.add(financialExpenditure);
                         }
                     }
@@ -503,6 +476,8 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                         for (FinancialExpenditure financialExpenditure : financialExpenditures) {
                             financialExpenditure.setAprovalTime(endTime);
                             financialExpenditure.setPaymentTime(endTime);
+                            financialExpenditure.setType(expenditureTypeEnum);
+                            financialExpenditure.setEffectiveTime(DateUtil.format(endTime,DateUtil.ISO_YEAR_MONTH_FORMAT));
                             financialExpenditure.setApplyUser(realName);
                             financialExpenditure.setType(ExpenditureTypeEnum.REFUND);
                             financialExpenditure.setFeeProject(FeeProjectEnum.REFUND);
@@ -534,31 +509,19 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                 }
                 for (OaInputDto oaInputDto : oaInputDtos) {
                     String name = oaInputDto.getName();
-                    if(name.contains("金额")){
-                        Object o = formData.get(oaInputDto.getModel());
-                        if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
-                            financialExpenditure.setAmount(new BigDecimal(Double.parseDouble(o.toString())));
-                            financialExpenditure.setCurrentAmount(financialExpenditure.getAmount());
-                            continue;
-                        }
-                    }else if(name.contains("情况说明")){
-                        Object o = formData.get(oaInputDto.getModel());
-                        if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
-                            financialExpenditure.setCause(o.toString());
-                            continue;
-                        }
-                    }else if(name.contains("支出类型")){
-                        Object o = formData.get(oaInputDto.getModel());
-                        if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
-                            financialExpenditure.setType(ExpenditureTypeEnum.valueOfDesc(o.toString()));
-                            continue;
-                        }
-                    }else if(name.contains("费用类型")){
-                        Object o = formData.get(oaInputDto.getModel());
-                        if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
-                            financialExpenditure.setFeeProject(FeeProjectEnum.valueOfDesc(o.toString()));
-                            continue;
-                        }
+                    Object o = formData.get(oaInputDto.getModel());
+                    if(Objects.isNull(o) || StringUtils.isEmpty(o.toString())){
+                        continue;
+                    }
+                    if(StringUtils.equals(name,"金额")){
+                        financialExpenditure.setAmount(new BigDecimal(Double.parseDouble(o.toString())));
+                        financialExpenditure.setCurrentAmount(financialExpenditure.getAmount());
+                    }else if(StringUtils.equals(name,"情况说明")){
+                        financialExpenditure.setCause(o.toString());
+                    }else if(StringUtils.equals(name,"支出类型")){
+                        financialExpenditure.setType(ExpenditureTypeEnum.valueOfDesc(o.toString()));
+                    }else if(StringUtils.equals(name,"费用类型") || StringUtils.equals(name,"费用类别")){
+                        financialExpenditure.setFeeProject(FeeProjectEnum.valueOfDesc(o.toString()));
                     }
                 }
                 financialExpenditureDao.insert(financialExpenditure);
@@ -594,6 +557,8 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                 List<HashMap> hashMaps = JSONObject.parseArray(formData.get(submitForm).toString(), HashMap.class);
                 nullUser: for (HashMap hashMap : hashMaps) {
                     FinancialExpenditure financialExpenditure = new FinancialExpenditure();
+                    financialExpenditure.setAprovalTime(now);
+                    financialExpenditure.setPaymentTime(now);
                     financialExpenditure.setEffectiveTime(DateUtil.format(now,DateUtil.ISO_YEAR_MONTH_FORMAT));
                     List<OaColumnDto> columns = oaInputDto.getColumns();
                     if(columns != null && columns.size() > 0){
@@ -602,25 +567,25 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                             if(columnList != null && columnList.size() > 0){
                                 for (OaInputDto inputDto : columnList) {
                                     String name = inputDto.getName();
-                                    if(name.contains("课程组编号")){
+                                    if(StringUtils.equals(name,"课程组编号")){
                                         Object o = hashMap.get(inputDto.getModel());
                                         if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
                                             financialExpenditure.setVipGroupId(Long.parseLong(o.toString()));
                                             continue;
                                         }
-                                    }else if(name.contains("课程类型")){
+                                    }else if(StringUtils.equals(name,"课程类型")){
                                         Object o = hashMap.get(inputDto.getModel());
                                         if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
                                             financialExpenditure.setGroupType(o.toString());
                                             continue;
                                         }
-                                    }else if(name.contains("乐团编号")){
+                                    }else if(StringUtils.equals(name,"乐团编号")){
                                         Object o = hashMap.get(inputDto.getModel());
                                         if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
                                             financialExpenditure.setMusicGroupId(o.toString());
                                             continue;
                                         }
-                                    }else if(name.contains("学员编号")){
+                                    }else if(StringUtils.equals(name,"学员编号")){
                                         Object o = hashMap.get(inputDto.getModel());
                                         if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
                                             financialExpenditure.setStudentId(Integer.parseInt(o.toString()));
@@ -628,7 +593,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                                         }else {
                                             continue nullUser;
                                         }
-                                    }else if(name.contains("金额")){
+                                    }else if(StringUtils.equals(name,"金额")){
                                         Object o = hashMap.get(inputDto.getModel());
                                         if(Objects.nonNull(o) && StringUtils.isNotEmpty(o.toString())){
                                             financialExpenditure.setAmount(new BigDecimal(Double.parseDouble(o.toString())));

+ 19 - 1
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -500,6 +500,24 @@
     <select id="sumPersonIncome" resultType="java.util.Map">
         select organ_id_ 'key',SUM(amount_) 'value' from cloud_teacher_order cto
         where cto.music_group_id_ IS NULL
-          AND DATE_FORMAT(create_time_, '%Y-%m') = #{month} AND cto.status_ IN (1,2) AND amount_ > 0 group by  organ_id_
+        AND DATE_FORMAT(create_time_, '%Y-%m') = #{month} AND cto.status_ IN (1,2) AND amount_ > 0 group by  organ_id_
+    </select>
+    <select id="sumPersonalCloudAmount" resultType="java.util.Map">
+        select cto.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / (TIMESTAMPDIFF(DAY,cto.start_time_,cto.end_time_) + 1) *
+        (TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{firstDay} THEN #{firstDay} ELSE DATE_FORMAT(start_time_,'%Y-%m-%d') END,
+        CASE WHEN DATE_FORMAT(end_time_,'%Y-%m') > #{month} THEN #{lastDay} ELSE DATE_FORMAT(end_time_,'%Y-%m-%d') END) + 1)),2) 'value'
+        from cloud_teacher_order cto
+        where operating_amount_ = 480 AND music_group_id_ IS NOT NULL AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND DATE_FORMAT(end_time_,'%Y-%m')
+        AND cto.settlement_report_flag_ = 0 AND cto.status_ = 2
+        group by cto.organ_id_;
+    </select>
+    <select id="sumGroupCloudAmount" resultType="java.util.Map">
+        select cto.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / (TIMESTAMPDIFF(DAY,cto.start_time_,cto.end_time_) + 1) *
+                                                (TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{firstDay} THEN #{firstDay} ELSE DATE_FORMAT(start_time_,'%Y-%m-%d') END,
+                                                                   CASE WHEN DATE_FORMAT(end_time_,'%Y-%m') > #{month} THEN #{lastDay} ELSE DATE_FORMAT(end_time_,'%Y-%m-%d') END) + 1)),2) 'value'
+        from cloud_teacher_order cto
+        where operating_amount_ > 0 AND operating_amount_ != 480 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND DATE_FORMAT(end_time_,'%Y-%m')
+          AND cto.settlement_report_flag_ = 0 AND cto.status_ = 2
+        group by cto.organ_id_
     </select>
 </mapper>

+ 7 - 4
mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml

@@ -52,12 +52,13 @@
         INSERT INTO financial_expenditure (batch_no_, financial_process_no_, dingtalk_process_no_,
                                            process_id_,organ_id_, cooperation_organ_id_, apply_user_, apply_user_id_, amount_, item_detail_,
                                            payment_time_, cause_, create_time_, update_time_, fee_project_, type_,
-                                           tenant_id_,student_id_,effective_time_,aproval_time_)
+                                           tenant_id_,student_id_,effective_time_,aproval_time_,current_amount_)
         VALUES (#{batchNo}, #{financialProcessNo}, #{dingtalkProcessNo},#{processId}, #{organId}, #{cooperationOrganId},
                 #{applyUser}, #{applyUserId}, #{amount},
                 #{itemDetail}, #{paymentTime}, #{cause}, now(), now(),
                 #{feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-                #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{tenantId},#{studentId},#{effectiveTime},#{aprovalTime})
+                #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                #{tenantId},#{studentId},#{effectiveTime},#{aprovalTime},#{currentAmount})
     </insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.FinancialExpenditure" useGeneratedKeys="true"
@@ -65,14 +66,16 @@
             keyProperty="id">
         INSERT INTO financial_expenditure (batch_no_,financial_process_no_,dingtalk_process_no_,
         process_id_,organ_id_,cooperation_organ_id_,apply_user_,amount_,item_detail_,payment_time_,
-                                           cause_,create_time_,update_time_,fee_project_,type_,tenant_id_,student_id_,effective_time_,aproval_time_)
+                                           cause_,create_time_,update_time_,fee_project_,type_,tenant_id_,
+                                           student_id_,effective_time_,aproval_time_,current_amount_)
         VALUES
         <foreach collection="financialExpenditures" item="item" separator=",">
             (#{item.batchNo},#{item.financialProcessNo},#{item.dingtalkProcessNo},#{item.processId},#{item.organId},
             #{item.cooperationOrganId},#{item.applyUser},#{item.amount},
             #{item.itemDetail},#{item.paymentTime},#{item.cause},now(),now(),
             #{item.feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.tenantId},#{item.studentId},#{item.effectiveTime},#{item.aprovalTime})
+            #{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.tenantId},
+             #{item.studentId},#{item.effectiveTime},#{item.aprovalTime},#{item.currentAmount})
         </foreach>
     </insert>
 

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -199,8 +199,9 @@
 		(TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{firstDay} THEN #{firstDay} ELSE DATE_FORMAT(start_time_,'%Y-%m-%d') END,
 		CASE WHEN DATE_FORMAT(end_time_,'%Y-%m') > #{month} THEN #{lastDay} ELSE DATE_FORMAT(end_time_,'%Y-%m-%d') END) + 1)),2) 'value'
 		from cloud_teacher_order cto
-		where operating_amount_ > 0 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND cto.settlement_report_flag_ = 0 AND cto.status_ = 2
-		AND DATE_FORMAT(end_time_,'%Y-%m') group by cto.organ_id_;
+		where operating_amount_ > 0 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND DATE_FORMAT(end_time_,'%Y-%m')
+		AND cto.settlement_report_flag_ = 0 AND cto.status_ = 2
+		group by cto.organ_id_;
 	</select>
 	<select id="sumGroupCloudAmount" resultType="java.util.Map">
 		select orc.organ_id_ 'key',TRUNCATE(SUM(orc.cloud_price_ / (TIMESTAMPDIFF(DAY,orc.start_date_,orc.end_date_) + 1) *

+ 2 - 2
mec-web/src/main/resources/exportColumnMapper.ini

@@ -351,5 +351,5 @@ headColumns = ["城市","钉钉流程编号","费用归属学校","申请人","
 fieldColumns = ["organName","batchNo","cooperationOrganName","applyUser","feeProject.desc","type.desc","amount","paymentTime","cause","studentId","currentAmount"]
 
 [经营报表收入汇总]
-headColumns = ["城市","学生指导费课耗收入","学校课程采买课耗收入","考级","维修费用","乐保费用","其他服务收入","云教练收入","团购乐器","团购教辅","大件乐器","服务收入","销售收入"]
-fieldColumns = ["organName","studentGuidanceIncome","coursePurchaseIncome","examIncome","maintenanceCost","instrumentInsuranceCost","otherServiceIncome","cloudCoachIncome","groupPurchaseInstruments","groupPurchaseTeachingAids","largeInstruments","serviceIncome","salesIncome"]
+headColumns = ["城市","学生指导费课耗收入","承担课程云教练收入","学校课程采买课耗收入","考级","维修费用","乐保费用","其他服务收入","不承担课程云教练收入","团购乐器","团购教辅","大件乐器","其他","服务收入","销售收入"]
+fieldColumns = ["organName","studentGuidanceIncome","cloudCoachIncome","coursePurchaseIncome","examIncome","maintenanceCost","instrumentInsuranceCost","otherServiceIncome","saleCloudCoachIncome","groupPurchaseInstruments","groupPurchaseTeachingAids","largeInstruments","otherIncome","serviceIncome","salesIncome"]