|  | @@ -1,6 +1,7 @@
 | 
											
												
													
														|  |  package com.ym.mec.biz.service.impl;
 |  |  package com.ym.mec.biz.service.impl;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.*;
 |  |  import com.ym.mec.biz.dal.dao.*;
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.MusicGroup;
 |  |  import com.ym.mec.biz.dal.entity.MusicGroup;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.OperatingReport;
 |  |  import com.ym.mec.biz.dal.entity.OperatingReport;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 |  |  import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 | 
											
										
											
												
													
														|  | @@ -23,6 +24,8 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
 | 
											
												
													
														|  |      private OperatingReportDao operatingReportDao;
 |  |      private OperatingReportDao operatingReportDao;
 | 
											
												
													
														|  |      private StudentPaymentOrderDao studentPaymentOrderDao;
 |  |      private StudentPaymentOrderDao studentPaymentOrderDao;
 | 
											
												
													
														|  |      private MusicGroupDao musicGroupDao;
 |  |      private MusicGroupDao musicGroupDao;
 | 
											
												
													
														|  | 
 |  | +    private SellOrderDao sellOrderDao;
 | 
											
												
													
														|  | 
 |  | +    private CooperationOrganDao cooperationOrganDao;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
										
											
												
													
														|  | @@ -34,35 +37,54 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
 | 
											
												
													
														|  |      public List<OperatingReport> statistics() {
 |  |      public List<OperatingReport> statistics() {
 | 
											
												
													
														|  |          Date nowDate = new Date();
 |  |          Date nowDate = new Date();
 | 
											
												
													
														|  |          Date startTime = DateUtil.addDays1(nowDate, -1);
 |  |          Date startTime = DateUtil.addDays1(nowDate, -1);
 | 
											
												
													
														|  | -        Map<String, Object> params = new HashMap<>();
 |  | 
 | 
											
												
													
														|  | -        params.put("orderStartDate", DateUtil.getDate(startTime));
 |  | 
 | 
											
												
													
														|  | -        params.put("orderEndDate", DateUtil.getDate(startTime));
 |  | 
 | 
											
												
													
														|  | -        params.put("paymentStatus", "SUCCESS");
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -//        APPLY("APPLY", "报名"),
 |  | 
 | 
											
												
													
														|  | -//                RENEW("RENEW", "续费"),
 |  | 
 | 
											
												
													
														|  | -//                SPORADIC("SPORADIC", "零星收费"),
 |  | 
 | 
											
												
													
														|  | -//                OTHER("OTHER", "其他"),
 |  | 
 | 
											
												
													
														|  | -//                SMALL_CLASS_TO_BUY("SMALL_CLASS_TO_BUY", "VIP购买"),
 |  | 
 | 
											
												
													
														|  | -//                PRACTICE_GROUP_BUY("PRACTICE_GROUP_BUY", "网管课购买"),
 |  | 
 | 
											
												
													
														|  | -//                PRACTICE_GROUP_RENEW("PRACTICE_GROUP_RENEW", "网管课续费"),
 |  | 
 | 
											
												
													
														|  | -//                COURSE_GROUP_BUY("COURSE_GROUP_BUY","对外课程购买"),
 |  | 
 | 
											
												
													
														|  | -//                LUCK("LUCK", "福袋活动"),
 |  | 
 | 
											
												
													
														|  | -//                TENANT_RECHARGE("TENANT_RECHARGE","租户充值"),
 |  | 
 | 
											
												
													
														|  | -//                REPAIR("REPAIR","乐器维修");
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Date endTime = DateUtil.getLastDayOfMonth(startTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        /**
 | 
											
												
													
														|  | 
 |  | +         * 	MUSIC("乐团课"),
 | 
											
												
													
														|  | 
 |  | +         * 	VIP("VIP课"),
 | 
											
												
													
														|  | 
 |  | +         * 	DEMO("试听课"),
 | 
											
												
													
														|  | 
 |  | +         * 	SPORADIC("零星收费"),
 | 
											
												
													
														|  | 
 |  | +         * 	PRACTICE("网管课"),
 | 
											
												
													
														|  | 
 |  | +         * 	COMM("对外课程"),
 | 
											
												
													
														|  | 
 |  | +         * 	REPAIR("乐器维修"),
 | 
											
												
													
														|  | 
 |  | +         * 	OUTORDER("外部订单");
 | 
											
												
													
														|  | 
 |  | +         */
 | 
											
												
													
														|  | 
 |  | +        /**
 | 
											
												
													
														|  | 
 |  | +         *         分摊费用计算公式:全职资源数*全职资源公摊金额/12
 | 
											
												
													
														|  | 
 |  | +         *
 | 
											
												
													
														|  | 
 |  | +         *         成本费用合计:销售成本+固定支出+变动支出+分摊费用
 | 
											
												
													
														|  | 
 |  | +         *
 | 
											
												
													
														|  | 
 |  | +         *         利润:收入合计-成本费用合计
 | 
											
												
													
														|  | 
 |  | +         *
 | 
											
												
													
														|  | 
 |  | +         *        【全职资源数】*【全职资源公摊金额】/12,该公式得出的值为【学校】【每月】的公摊费用
 | 
											
												
													
														|  | 
 |  | +         */
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //1、获取分部的全职资源数的分摊费用
 | 
											
												
													
														|  | 
 |  | +        List<OrganFullJobResourceNumDto> organFullJobResourceNum = cooperationOrganDao.getOrganFullJobResourceNum();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //2、获取支出费用
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.1、乐团订单的统计
 | 
											
												
													
														|  | 
 |  | +        List<OperatingReport> musicReports = sellOrderDao.getMusicGroupMonthReport(startTime, endTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.2、VIP、网管课订单的统计(关联学生注册取一条记录)
 | 
											
												
													
														|  | 
 |  | +        List<OperatingReport> VPReports = sellOrderDao.getMusicVipPracticeMonthReport(startTime, endTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.3、外部添加订单
 | 
											
												
													
														|  | 
 |  | +        List<OperatingReport> outOrderReports = sellOrderDao.getOutOrderMonthReport(startTime, endTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.4、乐器维修
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.5、零星支付充值
 | 
											
												
													
														|  | 
 |  | +        List<OperatingReport> rechargeReports = sellOrderDao.getRechargeMonthReport(startTime, endTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //3.6、零星收费(不是充值部分的)
 | 
											
												
													
														|  | 
 |  | +        List<OperatingReport> sporadicReports = sellOrderDao.getSporadicMonthReport(startTime, endTime);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          Map<String, OperatingReport> schoolOperating = new HashMap<>();
 |  |          Map<String, OperatingReport> schoolOperating = new HashMap<>();
 | 
											
												
													
														|  |          Map<String, OperatingReport> organOperating = new HashMap<>();
 |  |          Map<String, OperatingReport> organOperating = new HashMap<>();
 | 
											
												
													
														|  | -        List<StudentPaymentOrder> orders = studentPaymentOrderDao.queryPageOrder(params);
 |  | 
 | 
											
												
													
														|  | -        for (StudentPaymentOrder order : orders) {
 |  | 
 | 
											
												
													
														|  | -            if(order.getType().equals(OrderTypeEnum.APPLY)){
 |  | 
 | 
											
												
													
														|  | -                continue;
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | -            if(order.getType().equals(OrderTypeEnum.RENEW)){
 |  | 
 | 
											
												
													
														|  | -                MusicGroup musicGroup = musicGroupDao.get(order.getMusicGroupId());
 |  | 
 | 
											
												
													
														|  | -            }
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return null;
 |  |          return null;
 | 
											
												
													
														|  |  
 |  |  
 |