Parcourir la source

Merge branch 'zx_saas_0810' of http://git.dayaedu.com/yonge/mec into master_saas

zouxuan il y a 2 ans
Parent
commit
4f6f99b96a

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

@@ -65,4 +65,15 @@ public interface OperatingReportNewDao extends BaseDAO<Integer, OperatingReportN
 
     //更新云教练计费时间
     void initCloudStartTime(@Param("lastDay") String lastDay);
+
+    //汇总乐器押金
+    List<Map<Integer,BigDecimal>> sumMusicMagrin();
+
+    void batchInsert(@Param("operatingList") List<OperatingReportNew> operatingList);
+
+    void deleteByMonth(String month);
+
+    List<Map<Integer,BigDecimal>> sumInternalSettlement(@Param("month") String month);
+
+    List<Map<Integer,BigDecimal>> sumPrepayments(@Param("month") String month);
 }

+ 89 - 45
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportNew.java

@@ -19,116 +19,120 @@ public class OperatingReportNew {
 
     @ApiModelProperty(value="销售收入(当月实收)")
     //实物销售收入(已收货商品)
-    private BigDecimal saleAmount;
+    private BigDecimal saleAmount = BigDecimal.ZERO;
 
     //当月课费(每个学员当月已消耗课程费用总和) + 个体云教练当月费用(总金额/月数) + 当月云教练课程消耗费用(课次*每节课单价)
     @ApiModelProperty(value="服务收入(当月实收)")
-    private BigDecimal serviceAmount;
+    private BigDecimal serviceAmount = BigDecimal.ZERO;
 
     @ApiModelProperty(value="课程收入")
-    private BigDecimal courseAmount;
+    private BigDecimal courseAmount = BigDecimal.ZERO;
 
     @ApiModelProperty(value="云教练收入")
-    private BigDecimal cloudAmount;
+    private BigDecimal cloudAmount = BigDecimal.ZERO;
 
     @ApiModelProperty(value="其他收入")
-    private BigDecimal otherAmount;
+    private BigDecimal otherAmount = BigDecimal.ZERO;
 
     //当月退费列表总金额(当月退费列表已退费总金额)
     @ApiModelProperty(value="业务退费")
-    private BigDecimal businessRefund;
+    private BigDecimal businessRefund = BigDecimal.ZERO;
 
     //销售收入 + 服务收入 - 业务退费
     @ApiModelProperty(value="收入合计")
-    private BigDecimal totalIncome;
+    private BigDecimal totalIncome = BigDecimal.ZERO;
 
     //当月已发货商品销售成本价
     @ApiModelProperty(value="销售成本")
-    private BigDecimal saleCost;
+    private BigDecimal saleCost = BigDecimal.ZERO;
 
     //OA审批固定费用总和
     @ApiModelProperty(value="固定费用")
-    private BigDecimal fixedCosts;
+    private BigDecimal fixedCosts = BigDecimal.ZERO;
 
     //OA审批变动费用总和
     @ApiModelProperty(value="变动费用")
-    private BigDecimal variableCosts;
+    private BigDecimal variableCosts = BigDecimal.ZERO;
 
     //OA审批内部结算费用总和
     @ApiModelProperty(value="内部结算")
-    private BigDecimal internalSettlement;
+    private BigDecimal internalSettlement = BigDecimal.ZERO;
 
     //固定 + 变动 + 内部结算
     @ApiModelProperty(value="成本费用合计")
-    private BigDecimal totalCost;
+    private BigDecimal totalCost = BigDecimal.ZERO;
 
     //收入合计 - 成本合计
     @ApiModelProperty(value="准可自由支配利润")
-    private BigDecimal quasiDiscretionaryProfit;
+    private BigDecimal quasiDiscretionaryProfit = BigDecimal.ZERO;
 
     //个体云教练(订单总额 / 购买天数 * 剩余生效天数) + 已排课云教练课程预收款(乐团在读人数 * 2980 - 课程单价 * 未开始课程数) + 未排课云教练预收款(订单总额 / 购买天数 * 剩余生效天数)+
     //未发货商品
     @ApiModelProperty(value="预收账款")
-    private BigDecimal prepaidFee;
+    private BigDecimal prepaidFee = BigDecimal.ZERO;
+
+    @ApiModelProperty(value="云教练预收")
+    private BigDecimal cloudPrepaidFee = BigDecimal.ZERO;
+
+    @ApiModelProperty(value="课程预收")
+    private BigDecimal coursePrepaidFee = BigDecimal.ZERO;
+
+    @ApiModelProperty(value="商品预收")
+    private BigDecimal salePrepaidFee = BigDecimal.ZERO;
+
+    @ApiModelProperty(value="其他预收")
+    private BigDecimal otherPrepaidFee = BigDecimal.ZERO;
 
     @ApiModelProperty(value="预付账款")
-    private BigDecimal prepayments;
+    private BigDecimal prepayments = BigDecimal.ZERO;
 
     @ApiModelProperty(value="应收账款")
-    private BigDecimal receivables;
+    private BigDecimal receivables = BigDecimal.ZERO;
 
     @ApiModelProperty(value="应付账款")
-    private BigDecimal payable;
+    private BigDecimal payable = BigDecimal.ZERO;
 
     @ApiModelProperty(value="月份")
     private String month;
 
-    public Integer getOrganId() {
-        return organId;
+    public BigDecimal getCloudPrepaidFee() {
+        return cloudPrepaidFee;
     }
 
-    public void setOrganId(Integer organId) {
-        this.organId = organId;
+    public void setCloudPrepaidFee(BigDecimal cloudPrepaidFee) {
+        this.cloudPrepaidFee = cloudPrepaidFee;
     }
 
-    public Integer getId() {
-        return id;
+    public BigDecimal getCoursePrepaidFee() {
+        return coursePrepaidFee;
     }
 
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public BigDecimal getCourseAmount() {
-        return courseAmount;
-    }
-
-    public void setCourseAmount(BigDecimal courseAmount) {
-        this.courseAmount = courseAmount;
+    public void setCoursePrepaidFee(BigDecimal coursePrepaidFee) {
+        this.coursePrepaidFee = coursePrepaidFee;
     }
 
-    public BigDecimal getCloudAmount() {
-        return cloudAmount;
+    public BigDecimal getSalePrepaidFee() {
+        return salePrepaidFee;
     }
 
-    public void setCloudAmount(BigDecimal cloudAmount) {
-        this.cloudAmount = cloudAmount;
+    public void setSalePrepaidFee(BigDecimal salePrepaidFee) {
+        this.salePrepaidFee = salePrepaidFee;
     }
 
-    public BigDecimal getOtherAmount() {
-        return otherAmount;
+    public BigDecimal getOtherPrepaidFee() {
+        return otherPrepaidFee;
     }
 
-    public void setOtherAmount(BigDecimal otherAmount) {
-        this.otherAmount = otherAmount;
+    public void setOtherPrepaidFee(BigDecimal otherPrepaidFee) {
+        this.otherPrepaidFee = otherPrepaidFee;
     }
 
-    public String getMonth() {
-        return month;
+    public Integer getId() {
+        return id;
     }
 
-    public void setMonth(String month) {
-        this.month = month;
+    public void setId(Integer id) {
+        this.id = id;
     }
 
     public String getPrincipal() {
@@ -147,6 +151,14 @@ public class OperatingReportNew {
         this.organName = organName;
     }
 
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
     public BigDecimal getSaleAmount() {
         return saleAmount;
     }
@@ -163,6 +175,30 @@ public class OperatingReportNew {
         this.serviceAmount = serviceAmount;
     }
 
+    public BigDecimal getCourseAmount() {
+        return courseAmount;
+    }
+
+    public void setCourseAmount(BigDecimal courseAmount) {
+        this.courseAmount = courseAmount;
+    }
+
+    public BigDecimal getCloudAmount() {
+        return cloudAmount;
+    }
+
+    public void setCloudAmount(BigDecimal cloudAmount) {
+        this.cloudAmount = cloudAmount;
+    }
+
+    public BigDecimal getOtherAmount() {
+        return otherAmount;
+    }
+
+    public void setOtherAmount(BigDecimal otherAmount) {
+        this.otherAmount = otherAmount;
+    }
+
     public BigDecimal getBusinessRefund() {
         return businessRefund;
     }
@@ -258,4 +294,12 @@ public class OperatingReportNew {
     public void setPayable(BigDecimal payable) {
         this.payable = payable;
     }
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
 }

+ 6 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FeeProjectEnum.java

@@ -5,9 +5,9 @@ import com.ym.mec.common.enums.BaseEnum;
 public enum FeeProjectEnum implements BaseEnum<Integer, FeeProjectEnum> {
     SALARY(1, "工资"),
     SOCIAL_SECURITY_HOUSE_ALLOWANCE(2, "社保公积金"),
-    HOUSE(3, "房"),
+    HOUSE(3, "房"),
     OFFICE(4, "办公"),
-    MAINS_PROPERTY(5, "水电物业"),
+    MAINS_PROPERTY(5, "水电物业供暖通讯"),
     TRAVEL(6, "差旅"),
     SERVICES(7, "服务"),
     WELFARE(8, "福利"),
@@ -21,7 +21,10 @@ public enum FeeProjectEnum implements BaseEnum<Integer, FeeProjectEnum> {
     POSTAL_TRANSPORT(16, "邮递运输"),
     HOSPITALITY(17, "招待费"),
     NETWORK_CLASS(18, "网络教室成本"),
-    REFUND(19, "退费");
+    REFUND(19, "退费"),
+    TEACHING_POINT_RENTAL(20, "教学点租赁"),
+    MUSICAL_INSTRUMENT_REPAIR(21, "乐器维修"),
+    INTERNAL_SETTLEMENT(22, "内部结算");
 
     private Integer code;
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java

@@ -21,7 +21,7 @@ public interface OperatingReportCloudService extends BaseService<Integer, Operat
     * @author zx
     * @date 2022/9/6 10:09
     */
-    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender, BigDecimal amount);
+    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender, Long orderId);
 
     /**
     * @description: 乐团排课、活动排课,计算课程预收

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ActivityUserMapperServiceImpl.java

@@ -688,10 +688,10 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 					userMap.keySet().stream().forEach(e-> operatingReportCloudService.updateSet(calenderId,userMap.get(e)));
 				}
 				//标记赠送课
-				String courseIdList = payments.stream().map(e -> e.getCourseScheduleId().toString()).collect(Collectors.joining(","));
-				if(StringUtils.isNotEmpty(courseIdList)){
-					courseScheduleService.getDao().markFreeCourse(courseIdList);
-				}
+//				String courseIdList = payments.stream().map(e -> e.getCourseScheduleId().toString()).collect(Collectors.joining(","));
+//				if(StringUtils.isNotEmpty(courseIdList)){
+//					courseScheduleService.getDao().markFreeCourse(courseIdList);
+//				}
 			}
 			courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 			studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());

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

@@ -534,7 +534,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			}
 		}
 		if(cloudTeacherPaymentFlag){
-			courseScheduleDao.markFreeCourse(courseSchedules.stream().map(e->e.getId().toString()).collect(Collectors.joining(",")));
+//			courseScheduleDao.markFreeCourse(courseSchedules.stream().map(e->e.getId().toString()).collect(Collectors.joining(",")));
 			operatingReportCloudService.updateSet(calenderId,courseSchedules.stream().map(e->e.getId()).collect(Collectors.toList()));
 		}
 	}

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

@@ -555,7 +555,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         }
 
         //保存、更新云教练缴费项目预收
-        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getActualAmount());
+        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getId());
 
         Boolean cloudTeacherPaymentFlag = false;
         if(musicGroupPaymentCalender.getCloudTeacherPaymentFlag()){

+ 19 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java

@@ -2,13 +2,18 @@ package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.OperatingReportCloudDao;
 import com.ym.mec.biz.dal.dao.OrganCourseTypeOriginalCostDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.service.CloudTeacherFreeCourseService;
 import com.ym.mec.biz.service.OperatingReportCloudService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -28,6 +33,10 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 	private OrganCourseTypeOriginalCostDao organCourseTypeOriginalCostDao;
 	@Autowired
 	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
+	@Autowired
+	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+	@Autowired
+	private StudentPaymentOrderDao studentPaymentOrderDao;
 
 	@Override
 	public BaseDAO<Integer, OperatingReportCloud> getDAO() {
@@ -41,10 +50,19 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateSet(MusicGroupPaymentCalender calender, BigDecimal amount) {
+	public void updateSet(MusicGroupPaymentCalender calender, Long orderId) {
 		if(!calender.getCloudTeacherPaymentFlag()){
 			return;
 		}
+		BigDecimal amount = BigDecimal.ZERO;
+		//查询云教练价格
+		List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.getOrderDetail(orderId);
+		if(CollectionUtils.isNotEmpty(orderDetail)){
+			amount = orderDetail.stream().filter(e->e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)
+					.map(e->e.getPrice()).reduce(BigDecimal.ZERO,BigDecimal::add);
+		}else {
+			amount = studentPaymentOrderDao.get(orderId).getActualAmount();
+		}
 		//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
 		//获取云教练信息
 		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId(),false);

+ 50 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.OperatingReportNewDao;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.OperatingReport;
 import com.ym.mec.biz.dal.entity.OperatingReportNew;
 import com.ym.mec.biz.service.OperatingReportNewService;
@@ -16,6 +18,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Service
@@ -40,6 +43,7 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		String firstDayOfMonth = DateUtil.dateToString(DateUtil.getFirstDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
 		String lastDayOfMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
 		String currentMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_YEAR_MONTH_FORMAT);
+		operatingReportNewDao.deleteByMonth(currentMonth);
 		List<OperatingReportNew> operatingList = operatingReportNewDao.initOperatingReport(currentMonth);
 		//更新团体云教练计费时间()
 		operatingReportNewDao.initCloudStartTime(lastDayOfMonth);
@@ -65,6 +69,7 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		//固定费用
 		Map<Integer, BigDecimal> collect8 = MapUtil.mapListToMap(operatingReportNewDao.sumFixedCosts(currentMonth),Integer.class,BigDecimal.class);
 		//内部结算
+		Map<Integer, BigDecimal> collect18 = MapUtil.mapListToMap(operatingReportNewDao.sumInternalSettlement(currentMonth),Integer.class,BigDecimal.class);
 
 		//云教练预收款
 		//个人云教练预收款
@@ -83,6 +88,8 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		Map<Integer, BigDecimal> collect14 = MapUtil.mapListToMap(operatingReportNewDao.sumOtherPreAmount(),Integer.class,BigDecimal.class);
 
 		//预付款
+		//房租
+		Map<Integer, BigDecimal> collect19 = MapUtil.mapListToMap(operatingReportNewDao.sumPrepayments(currentMonth),Integer.class,BigDecimal.class);
 
 		//应收
 		//欠费学员总金额
@@ -91,7 +98,50 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		Map<Integer, BigDecimal> collect16 = MapUtil.mapListToMap(operatingReportNewDao.sumSchoolAmount(),Integer.class,BigDecimal.class);
 
 		//应付(乐器押金)
+		Map<Integer, BigDecimal> collect17 = MapUtil.mapListToMap(operatingReportNewDao.sumMusicMagrin(),Integer.class,BigDecimal.class);
 
+		for (OperatingReportNew operatingReportNew : operatingList) {
+			Integer organId = operatingReportNew.getOrganId();
+			OperatingReportNew reportNew = collect.get(organId);
+			if(Objects.nonNull(reportNew)){
+				operatingReportNew.setSaleAmount(reportNew.getSaleAmount());
+				operatingReportNew.setSaleCost(reportNew.getSaleCost());
+			}
 
+			operatingReportNew.setCourseAmount(getAmount(collect1.get(organId)));
+			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect2.get(organId))));
+
+			operatingReportNew.setCloudAmount(getAmount(collect3.get(organId)));
+			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect4.get(organId))));
+			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect5.get(organId))));
+
+			operatingReportNew.setServiceAmount(operatingReportNew.getCloudAmount().add(operatingReportNew.getCourseAmount()));
+
+			operatingReportNew.setBusinessRefund(getAmount(collect6.get(organId)));
+			operatingReportNew.setFixedCosts(getAmount(collect7.get(organId)));
+			operatingReportNew.setVariableCosts(getAmount(collect8.get(organId)));
+
+			operatingReportNew.setCloudPrepaidFee(getAmount(collect9.get(organId)).add(collect10.get(organId)));
+			operatingReportNew.setCoursePrepaidFee(getAmount(collect11.get(organId)).add(collect12.get(organId)));
+			operatingReportNew.setSalePrepaidFee(getAmount(collect13.get(organId)));
+			operatingReportNew.setOtherPrepaidFee(getAmount(collect14.get(organId)));
+			operatingReportNew.setPrepaidFee(operatingReportNew.getCloudPrepaidFee().
+					add(operatingReportNew.getSalePrepaidFee()).
+					add(operatingReportNew.getOtherPrepaidFee()).
+					add(operatingReportNew.getCoursePrepaidFee()));
+
+			operatingReportNew.setReceivables(getAmount(collect15.get(organId)).add(collect16.get(organId)));
+			operatingReportNew.setPayable(getAmount(collect17.get(organId)));
+
+			operatingReportNew.setInternalSettlement(getAmount(collect18.get(organId)));
+			operatingReportNew.setPrepayments(getAmount(collect19.get(organId)));
+		}
+		operatingReportNewDao.batchInsert(operatingList);
+	}
+	private BigDecimal getAmount(BigDecimal amount){
+		if(amount == null){
+			amount = BigDecimal.ZERO;
+		}
+		return amount;
 	}
 }

+ 29 - 4
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -43,7 +43,18 @@
 		INSERT INTO operating_report_new (id_,principal_,organ_name_,sale_amount_,service_amount_,business_refund_,total_income_,sale_cost_,fixed_costs_,variable_costs_,internal_settlement_,total_cost_,quasi_discretionary_profit_,prepaid_fee_,prepayments_,receivables_,payable_,month_)
 		VALUES(#{id},#{principal},#{organName},#{saleAmount},#{serviceAmount},#{businessRefund},#{totalIncome},#{saleCost},#{fixedCosts},#{variableCosts},#{internalSettlement},#{totalCost},#{quasiDiscretionaryProfit},#{prepaidFee},#{prepayments},#{receivables},#{payable},#{month})
 	</insert>
-	
+	<insert id="batchInsert">
+		INSERT INTO operating_report_new (principal_,organ_name_,sale_amount_,service_amount_,business_refund_,total_income_,sale_cost_,
+		                                  fixed_costs_,variable_costs_,internal_settlement_,total_cost_,quasi_discretionary_profit_,
+		                                  prepaid_fee_,prepayments_,receivables_,payable_,month_)
+		VALUES
+		<foreach collection="operatingList" item="bean" separator=",">
+			(#{bean.principal},#{bean.organName},#{bean.saleAmount},#{bean.serviceAmount},#{bean.businessRefund},#{bean.totalIncome},
+			 #{bean.saleCost},#{bean.fixedCosts},#{bean.variableCosts},#{bean.internalSettlement},#{bean.totalCost},#{bean.quasiDiscretionaryProfit},
+			 #{bean.prepaidFee},#{bean.prepayments},#{bean.receivables},#{bean.payable},#{bean.month})
+		</foreach>
+	</insert>
+
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReportNew">
 		UPDATE operating_report_new <set>
@@ -123,7 +134,10 @@
 	<delete id="delete" >
 		DELETE FROM operating_report_new WHERE id_ = #{id} 
 	</delete>
-	
+	<delete id="deleteByMonth">
+		DELETE FROM operating_report_new WHERE month_ = #{month}
+	</delete>
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="OperatingReportNew" parameterType="map">
 		SELECT * FROM operating_report_new ORDER BY id_ <include refid="global.limit"/>
@@ -174,11 +188,11 @@
 	</select>
 	<select id="sumVariableCosts" resultType="java.util.Map">
 		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
-		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ BETWEEN 6 AND 18 AND process_id_ = 28 group by fe.organ_id_;
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ BETWEEN 6 AND 21 AND process_id_ = 28 group by fe.organ_id_;
 	</select>
 	<select id="sumFixedCosts" resultType="java.util.Map">
 		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
-		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ BETWEEN 1 AND 5 AND process_id_ = 28 group by fe.organ_id_;
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ IN (1,2,4,5) AND process_id_ = 28 group by fe.organ_id_;
 	</select>
 	<select id="sumCloudPreAmount" resultType="java.util.Map">
 		select orc.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / TIMESTAMPDIFF(DAY,start_time_,end_time_) * TIMESTAMPDIFF(DAY,#{lastDay},end_time_)),2) 'value'
@@ -234,4 +248,15 @@
 		where spro.calender_id_ IS NOT NULL AND spro.audit_status_ = 'PASS' AND mgpc.id_ = spro.calender_id_
 		group by mgpc.organ_id_
 	</select>
+	<select id="sumMusicMagrin" resultType="java.util.Map">
+		select mm.organ_id_ 'key',SUM(mm.balance_) 'value' from music_margin mm where mm.refund_flag_ = 0 group by mm.organ_id_;
+	</select>
+	<select id="sumInternalSettlement" resultType="java.util.Map">
+		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ = 22 AND process_id_ = 28 group by fe.organ_id_;
+	</select>
+	<select id="sumPrepayments" resultType="java.util.Map">
+		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ = 3 AND process_id_ = 28 group by fe.organ_id_;
+	</select>
 </mapper>