浏览代码

经营报表

zouxuan 2 年之前
父节点
当前提交
79c9f97909

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportNewDao.java

@@ -79,4 +79,19 @@ public interface OperatingReportNewDao extends BaseDAO<Integer, OperatingReportN
 
 
     //云教练赠送排课资格预收
     //云教练赠送排课资格预收
     List<Map<Integer,BigDecimal>> sumActivityUserMapperAmount(@Param("categoryId") Integer categoryId);
     List<Map<Integer,BigDecimal>> sumActivityUserMapperAmount(@Param("categoryId") Integer categoryId);
+
+    //付费乐团课学员缴费预收
+    List<Map<Integer,BigDecimal>> sumMusicCourseAmount();
+
+    //付费乐团课学校缴费预收
+    List<Map<Integer,BigDecimal>> sumSchoolMusicCourseAmount();
+
+    //获取排课资格预收
+    List<Map<Integer,BigDecimal>> sumSubActivityUserMapperAmount();
+
+    //导入的销售收入
+    List<Map<Integer,BigDecimal>> sumImportSaleOrderAmount(@Param("month") String month);
+
+    //导入的服务收入
+    List<Map<Integer,BigDecimal>> sumImportServerOrderAmount(@Param("month") String month);
 }
 }

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java

@@ -58,6 +58,10 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		List<OperatingReportNew> sellList = operatingReportNewDao.sumSellAmount(currentMonth);
 		List<OperatingReportNew> sellList = operatingReportNewDao.sumSellAmount(currentMonth);
 		Map<Integer, OperatingReportNew> collect = sellList.stream().collect(Collectors.groupingBy(OperatingReportNew::getOrganId,Collectors.collectingAndThen(Collectors.toList(),value->value.get(0))));
 		Map<Integer, OperatingReportNew> collect = sellList.stream().collect(Collectors.groupingBy(OperatingReportNew::getOrganId,Collectors.collectingAndThen(Collectors.toList(),value->value.get(0))));
 		//服务收入
 		//服务收入
+		//导入的销售收入(学校缴费)
+		Map<Integer, BigDecimal> collect22 = MapUtil.convertIntegerMap(operatingReportNewDao.sumImportSaleOrderAmount(currentMonth));
+		//导入的服务收入  (全部记录为课程收入)
+		Map<Integer, BigDecimal> collect24 = MapUtil.convertIntegerMap(operatingReportNewDao.sumImportServerOrderAmount(currentMonth));
 		//云教练赠送课程实际收入
 		//云教练赠送课程实际收入
 		Map<Integer, BigDecimal> collect1 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCourseAmount(firstDayOfMonth,lastDayOfMonth));
 		Map<Integer, BigDecimal> collect1 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCourseAmount(firstDayOfMonth,lastDayOfMonth));
 		//付费课程实际收入
 		//付费课程实际收入
@@ -93,6 +97,10 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		Map<Integer, BigDecimal> collect20 = MapUtil.convertIntegerMap(operatingReportNewDao.sumActivityUserMapperAmount(category.getId()));
 		Map<Integer, BigDecimal> collect20 = MapUtil.convertIntegerMap(operatingReportNewDao.sumActivityUserMapperAmount(category.getId()));
 		//付费课程预收
 		//付费课程预收
 		Map<Integer, BigDecimal> collect12 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCoursePreAmount(lastDayOfMonth));
 		Map<Integer, BigDecimal> collect12 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCoursePreAmount(lastDayOfMonth));
+		//付费团未排乐团课程预收(学员缴费)
+		Map<Integer, BigDecimal> collect21 = MapUtil.convertIntegerMap(operatingReportNewDao.sumMusicCourseAmount());
+		//排课资格预收
+		Map<Integer, BigDecimal> collect23 = MapUtil.convertIntegerMap(operatingReportNewDao.sumSubActivityUserMapperAmount());
 		//销售预收
 		//销售预收
 		Map<Integer, BigDecimal> collect13 = MapUtil.convertIntegerMap(operatingReportNewDao.sumSalePreAmount());
 		Map<Integer, BigDecimal> collect13 = MapUtil.convertIntegerMap(operatingReportNewDao.sumSalePreAmount());
 		//其他预收
 		//其他预收
@@ -119,9 +127,11 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 				operatingReportNew.setSaleAmount(reportNew.getSaleAmount());
 				operatingReportNew.setSaleAmount(reportNew.getSaleAmount());
 				operatingReportNew.setSaleCost(reportNew.getSaleCost());
 				operatingReportNew.setSaleCost(reportNew.getSaleCost());
 			}
 			}
+			operatingReportNew.setSaleAmount(operatingReportNew.getSaleAmount().add(getAmount(collect22.get(organId))));
 
 
 			operatingReportNew.setCourseAmount(getAmount(collect1.get(organId)));
 			operatingReportNew.setCourseAmount(getAmount(collect1.get(organId)));
 			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect2.get(organId))));
 			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect2.get(organId))));
+			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect24.get(organId))));
 
 
 			operatingReportNew.setCloudAmount(getAmount(collect3.get(organId)));
 			operatingReportNew.setCloudAmount(getAmount(collect3.get(organId)));
 			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect4.get(organId))));
 			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect4.get(organId))));
@@ -137,7 +147,8 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 					add(operatingReportNew.getFixedCosts()).add(operatingReportNew.getVariableCosts()));
 					add(operatingReportNew.getFixedCosts()).add(operatingReportNew.getVariableCosts()));
 
 
 			operatingReportNew.setCloudPrepaidFee(getAmount(collect9.get(organId)).add(getAmount(collect10.get(organId))));
 			operatingReportNew.setCloudPrepaidFee(getAmount(collect9.get(organId)).add(getAmount(collect10.get(organId))));
-			operatingReportNew.setCoursePrepaidFee(getAmount(collect11.get(organId)).add(getAmount(collect12.get(organId))).add(getAmount(collect20.get(organId))));
+			operatingReportNew.setCoursePrepaidFee(getAmount(collect11.get(organId)).add(getAmount(collect12.get(organId))).
+					add(getAmount(collect20.get(organId))).add(getAmount(collect21.get(organId))).add(getAmount(collect23.get(organId))));
 			operatingReportNew.setSalePrepaidFee(getAmount(collect13.get(organId)));
 			operatingReportNew.setSalePrepaidFee(getAmount(collect13.get(organId)));
 			operatingReportNew.setOtherPrepaidFee(getAmount(collect14.get(organId)));
 			operatingReportNew.setOtherPrepaidFee(getAmount(collect14.get(organId)));
 			operatingReportNew.setPrepaidFee(operatingReportNew.getCloudPrepaidFee().
 			operatingReportNew.setPrepaidFee(operatingReportNew.getCloudPrepaidFee().

+ 28 - 1
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -245,7 +245,7 @@
 	<select id="sumCoursePreAmount" resultType="java.util.Map">
 	<select id="sumCoursePreAmount" resultType="java.util.Map">
 		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
 		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
 		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
 		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_) cs.class_date_ > #{lastDay}
+		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_) AND cs.class_date_ > #{lastDay}
 		group by cs.organ_id_;
 		group by cs.organ_id_;
 	</select>
 	</select>
 	<select id="sumOtherPreAmount" resultType="java.util.Map">
 	<select id="sumOtherPreAmount" resultType="java.util.Map">
@@ -296,4 +296,31 @@
 		  AND ((aum.sub_course_num_ > 0 AND aum.category_id_ != 8) OR (aum.sub_give_course_num_ > 0 AND aum.give_category_id_ != 8))
 		  AND ((aum.sub_course_num_ > 0 AND aum.category_id_ != 8) OR (aum.sub_give_course_num_ > 0 AND aum.give_category_id_ != 8))
 		GROUP BY mgpc.organ_id_
 		GROUP BY mgpc.organ_id_
 	</select>
 	</select>
+	<select id="sumMusicCourseAmount" resultType="java.util.Map">
+		select mgpc.organ_id_ 'key',SUM(mgpscd.course_current_price_) 'value' from music_group_payment_student_course_detail mgpscd
+		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpscd.music_group_payment_calender_id_
+		where mgpc.pay_user_type_ = 'STUDENT' AND mgpscd.used_course_minutes_ = 0
+		group by mgpc.organ_id_
+	</select>
+	<select id="sumSchoolMusicCourseAmount" resultType="java.util.Map">
+
+	</select>
+	<select id="sumSubActivityUserMapperAmount" resultType="java.util.Map">
+		select su.organ_id_ 'key',SUM(aum.sub_no_course_price_) 'value' from activity_user_mapper aum
+		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
+		where aum.return_fee_ = 0 AND aum.sub_no_course_price_ > 0
+		group by su.organ_id_
+	</select>
+	<select id="sumImportSaleOrderAmount" resultType="java.util.Map">
+		select spo.organ_id_,SUM(spro.sale_amount_) from student_payment_order spo
+		LEFT JOIN student_payment_route_order spro ON spro.order_no_ = spo.order_no_
+		where spo.group_type_ = 'OUTORDER' AND DATE_FORMAT(spro.pay_time_,'%Y-%m') = #{month}
+		GROUP BY spo.organ_id_;
+	</select>
+	<select id="sumImportServerOrderAmount" resultType="java.util.Map">
+		select spo.organ_id_,SUM(spro.service_amount_) from student_payment_order spo
+		LEFT JOIN student_payment_route_order spro ON spro.order_no_ = spo.order_no_
+		where spo.group_type_ = 'OUTORDER' AND DATE_FORMAT(spro.pay_time_,'%Y-%m') = #{month}
+		GROUP BY spo.organ_id_;
+	</select>
 </mapper>
 </mapper>

+ 12 - 0
mec-web/src/main/java/com/ym/mec/web/controller/OperatingReportNewController.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +16,9 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.util.Date;
+import java.util.Objects;
+
 @Api(tags = "经营报表服务")
 @Api(tags = "经营报表服务")
 @RequestMapping("operatingReportNew")
 @RequestMapping("operatingReportNew")
 @RestController
 @RestController
@@ -25,6 +29,14 @@ public class OperatingReportNewController extends BaseController {
     @Autowired
     @Autowired
     private OrganizationService organizationService;
     private OrganizationService organizationService;
 
 
+    @GetMapping(value = "/execTask")
+    public void operatingReportMonth(Date month){
+        if(Objects.isNull(month)){
+            month = DateUtil.addMonths(new Date(),-1);
+        }
+        operatingReportNewService.operatingReportMonth(month);
+    }
+
     @ApiOperation("报表列表")
     @ApiOperation("报表列表")
     @GetMapping(value = "/queryPage")
     @GetMapping(value = "/queryPage")
     @PreAuthorize("@pcs.hasPermissions('operatingReportNew/queryPage')")
     @PreAuthorize("@pcs.hasPermissions('operatingReportNew/queryPage')")

+ 5 - 1
mec-web/src/main/resources/exportColumnMapper.ini

@@ -296,4 +296,8 @@ fieldColumns = ["organName", "userId", "username","phone", "playTime", "playNum"
 
 
 [回访统计导出]
 [回访统计导出]
 headColumns = ["分部", "预计回访人数", "实际回访人数", "覆盖率"]
 headColumns = ["分部", "预计回访人数", "实际回访人数", "覆盖率"]
-fieldColumns = ["organName","expectVisitNum","visitNum","coverRate"]
+fieldColumns = ["organName","expectVisitNum","visitNum","coverRate"]
+
+[经营报表导出]
+headColumns = ["月份","分部", "销售收入", "服务收入", "课程收入", "云教练收入", "业务退费", "收入合计", "销售成本", "固定费用", "变动费用", "内部结算", "成本费用合计", "准可自由支配利润", "预收账款", "云教练预收", "课程预收", "商品预收", "其他预收", "预付账款", "应收账款", "应付账款"]
+fieldColumns = ["month","organName","saleAmount","serviceAmount","courseAmount","cloudAmount","businessRefund","totalIncome","saleCost","fixedCosts","variableCosts","internalSettlement","totalCost","quasiDiscretionaryProfit","prepaidFee","cloudPrepaidFee","coursePrepaidFee","salePrepaidFee","otherPrepaidFee","prepayments","receivables","payable"]