Browse Source

经营报表业务调整

zouxuan 2 years ago
parent
commit
10bf9d603b

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -327,4 +327,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     * @date 2022/3/17 11:18
     * @date 2022/3/17 11:18
     */
     */
     List<Map<Long, Integer>> findCooperationByIds(@Param("calenderIds") List<Long> calenderIds);
     List<Map<Long, Integer>> findCooperationByIds(@Param("calenderIds") List<Long> calenderIds);
+
+    void updatePaymentNum(@Param("calenderId") Long calenderId, @Param("actualNum") Integer actualNum, @Param("expectNum") Integer expectNum);
 }
 }

+ 1 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java

@@ -1,15 +1,11 @@
 package com.ym.mec.biz.dal.dao;
 package com.ym.mec.biz.dal.dao;
 
 
-import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.biz.dal.entity.OperatingReportCloud;
 import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
-import java.util.List;
-
 public interface OperatingReportCloudDao extends BaseDAO<Integer, OperatingReportCloud> {
 public interface OperatingReportCloudDao extends BaseDAO<Integer, OperatingReportCloud> {
 
 
-    void batchInsert(@Param("operatingReportClouds") List<OperatingReportCloud> operatingReportClouds);
-
     /**
     /**
     * @description: 根据缴费项目编号查询
     * @description: 根据缴费项目编号查询
      * @param calenderId
      * @param calenderId

+ 2 - 64
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java

@@ -2,10 +2,12 @@ package com.ym.mec.biz.dal.entity;
 
 
 import com.ym.mec.common.entity.BaseEntity;
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
+@Data
 public class MusicGroupPaymentCalenderBase extends BaseEntity {
 public class MusicGroupPaymentCalenderBase extends BaseEntity {
     private long id;
     private long id;
 
 
@@ -27,68 +29,4 @@ public class MusicGroupPaymentCalenderBase extends BaseEntity {
     private Date createTime;
     private Date createTime;
 
 
     private Date updateTime;
     private Date updateTime;
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public BigDecimal getOriginalAmount() {
-        return originalAmount;
-    }
-
-    public void setOriginalAmount(BigDecimal originalAmount) {
-        this.originalAmount = originalAmount;
-    }
-
-    public Long getCalenderId() {
-        return calenderId;
-    }
-
-    public void setCalenderId(Long calenderId) {
-        this.calenderId = calenderId;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Boolean getOptionalFlag() {
-        return optionalFlag;
-    }
-
-    public void setOptionalFlag(Boolean optionalFlag) {
-        this.optionalFlag = optionalFlag;
-    }
-
-    public BigDecimal getNum() {
-        return num;
-    }
-
-    public void setNum(BigDecimal num) {
-        this.num = num;
-    }
-
-    public BigDecimal getActualAmount() {
-        return actualAmount;
-    }
-
-    public void setActualAmount(BigDecimal actualAmount) {
-        this.actualAmount = actualAmount;
-    }
 }
 }

+ 5 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java

@@ -26,15 +26,16 @@ public class MusicGroupPaymentCalenderDetail extends BaseEntity {
 	private Integer userId;
 	private Integer userId;
 
 
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	private java.math.BigDecimal expectAmount;
+	//经营报表乐器收入
+	private java.math.BigDecimal expectAmount = BigDecimal.ZERO;
 
 
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	//经营报表需要,重新定义该字段
+	//经营报表云教练收入
 	private java.math.BigDecimal expectMemberAmount = BigDecimal.ZERO;
 	private java.math.BigDecimal expectMemberAmount = BigDecimal.ZERO;
 	
 	
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	//经营报表需要,重新定义该字段,记录云教练缴费课程预收(经营报表当月,根据缴费项目锁排课程总成本)
-	private java.math.BigDecimal actualAmount;
+	//经营报表溢出的课程费用
+	private java.math.BigDecimal actualAmount = BigDecimal.ZERO;
 	
 	
 	/**  */
 	/**  */
 	private PaymentStatus paymentStatus;
 	private PaymentStatus paymentStatus;
@@ -87,9 +88,6 @@ public class MusicGroupPaymentCalenderDetail extends BaseEntity {
 	
 	
 	private SysUser responsible = new SysUser();
 	private SysUser responsible = new SysUser();
 
 
-	@ApiModelProperty(value = "乐器、云教练溢出的课程费用")
-	private BigDecimal courseIncome = BigDecimal.ZERO;
-
 	@Override
 	@Override
 	public String toString() {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 		return ToStringBuilder.reflectionToString(this);

+ 2 - 53
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java

@@ -2,9 +2,9 @@ package com.ym.mec.biz.dal.entity;
 
 
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 
-import java.math.BigDecimal;
-
+@Data
 public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBase{
 public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBase{
     @ApiModelProperty(value = "会员名称", required = false)
     @ApiModelProperty(value = "会员名称", required = false)
     private String name;
     private String name;
@@ -19,55 +19,4 @@ public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBa
 
 
     @ApiModelProperty(value = "自动激活团练宝标识", required = false)
     @ApiModelProperty(value = "自动激活团练宝标识", required = false)
     private Boolean autoActivationFlag = false;
     private Boolean autoActivationFlag = false;
-
-    @ApiModelProperty(value = "团练宝收入,actualAmount减去收入以及其他费用,剩下的就是课程费用", required = false)
-    private BigDecimal income;
-
-    public BigDecimal getIncome() {
-        return income;
-    }
-
-    public void setIncome(BigDecimal income) {
-        this.income = income;
-    }
-
-    public Boolean getAutoActivationFlag() {
-        return autoActivationFlag;
-    }
-
-    public void setAutoActivationFlag(Boolean autoActivationFlag) {
-        this.autoActivationFlag = autoActivationFlag;
-    }
-
-    public Integer getOrganId() {
-        return organId;
-    }
-
-    public void setOrganId(Integer organId) {
-        this.organId = organId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public PeriodEnum getPeriod() {
-        return period;
-    }
-
-    public void setPeriod(PeriodEnum period) {
-        this.period = period;
-    }
-
-    public Integer getMemberRankSettingId() {
-        return memberRankSettingId;
-    }
-
-    public void setMemberRankSettingId(Integer memberRankSettingId) {
-        this.memberRankSettingId = memberRankSettingId;
-    }
 }
 }

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

@@ -97,10 +97,9 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
     /**
     /**
     * @description: 生成缴费项目学员详情
     * @description: 生成缴费项目学员详情
      * @param studentPaymentOrder
      * @param studentPaymentOrder
- * @param studentRegistration
     * @return void
     * @return void
     * @author zx
     * @author zx
     * @date 2021/12/30 15:16
     * @date 2021/12/30 15:16
     */
     */
-    void addCalenderDetail(StudentPaymentOrder studentPaymentOrder,StudentRegistration studentRegistration);
+    void addCalenderDetail(StudentPaymentOrder studentPaymentOrder);
 }
 }

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

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

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

@@ -219,8 +219,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         Map<Integer, Long> userCalenderDetailMap = new HashMap<>();
         Map<Integer, Long> userCalenderDetailMap = new HashMap<>();
         Map<Integer, Integer> activityuserMap = new HashMap<>();
         Map<Integer, Integer> activityuserMap = new HashMap<>();
         List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
         List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
-        //创建缴费明细
-        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 
 
         List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityService.findByCalenderId(musicGroupPaymentCalenderId);
         List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityService.findByCalenderId(musicGroupPaymentCalenderId);
         Map<Integer, VipGroupActivity> collect = new HashMap<>();
         Map<Integer, VipGroupActivity> collect = new HashMap<>();
@@ -245,13 +243,15 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
-            musicGroupPaymentCalenderDetail.setCourseIncome(this.getCourseIncome(calenderMember,musicGroup));
+            //设置云教练、课程收入
+            this.setCourseIncome(calenderMember,musicGroupPaymentCalenderDetail);
+            Integer organId = musicGroupPaymentCalender.getOrganId();
             musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
             musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
             if (musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0 || musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
             if (musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0 || musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
                 // 添加会员
                 // 添加会员
                 if (calenderMember != null) {
                 if (calenderMember != null) {
                     CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
                     CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
-                    cloudTeacherOrder.setOrganId(musicGroup.getOrganId());
+                    cloudTeacherOrder.setOrganId(organId);
                     cloudTeacherOrder.setType(calenderMember.getPeriod());
                     cloudTeacherOrder.setType(calenderMember.getPeriod());
                     cloudTeacherOrder.setAmount(BigDecimal.ZERO);
                     cloudTeacherOrder.setAmount(BigDecimal.ZERO);
                     cloudTeacherOrder.setStudentId(studentId);
                     cloudTeacherOrder.setStudentId(studentId);
@@ -275,7 +275,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                         activityUserMapper.setSubNoCoursePrice(BigDecimal.ZERO);
                         activityUserMapper.setSubNoCoursePrice(BigDecimal.ZERO);
                         activityUserMapper.setActivityId(calenderActivity.getActivityId());
                         activityUserMapper.setActivityId(calenderActivity.getActivityId());
                         activityUserMapper.setUserId(studentId);
                         activityUserMapper.setUserId(studentId);
-                        activityUserMapper.setOrganId(musicGroup.getOrganId());
+                        activityUserMapper.setOrganId(organId);
                         if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
                         if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
                             activityUserMapper.setAddMemo("学校缴费新增学员");
                             activityUserMapper.setAddMemo("学校缴费新增学员");
                         }else {
                         }else {
@@ -317,16 +317,22 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         }
         }
     }
     }
 
 
-    private BigDecimal getCourseIncome(MusicGroupPaymentCalenderMember calenderMember,MusicGroup musicGroup){
-        if(Objects.nonNull(calenderMember) && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-            //获取云教练溢出费用
-            BigDecimal courseIncome = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
-                    calenderMember.getNum(), MemberFeeSettingServiceImpl::getIncome);
-            if(calenderMember.getActualAmount().compareTo(courseIncome) > 0){
-                return calenderMember.getActualAmount().subtract(courseIncome);
+    public void setCourseIncome(MusicGroupPaymentCalenderMember calenderMember, MusicGroupPaymentCalenderDetail calenderDetail){
+        if(Objects.nonNull(calenderMember)){
+            MusicGroup musicGroup = musicGroupDao.get(calenderDetail.getMusicGroupId());
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                //获取云教练溢出费用
+                BigDecimal courseIncome = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
+                        calenderMember.getNum(), MemberFeeSettingServiceImpl::getIncome);
+                if(calenderMember.getActualAmount().compareTo(courseIncome) > 0){
+                    calenderDetail.setExpectMemberAmount(courseIncome);
+                    calenderDetail.setActualAmount(calenderMember.getActualAmount().subtract(courseIncome));
+                }
+            }else {
+                calenderDetail.setExpectMemberAmount(calenderMember.getActualAmount());
+                calenderDetail.setActualAmount(BigDecimal.ZERO);
             }
             }
         }
         }
-        return BigDecimal.ZERO;
     }
     }
 
 
     @Override
     @Override
@@ -475,58 +481,57 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
 
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public void addCalenderDetail(StudentPaymentOrder studentPaymentOrder, StudentRegistration studentRegistration) {
-        Date nowDate = new Date();
-        Integer tenantId = studentPaymentOrder.getTenantId();
+    public void addCalenderDetail(StudentPaymentOrder studentPaymentOrder) {
         //缴费详情 calender detail
         //缴费详情 calender detail
-        MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderService.get(studentPaymentOrder.getCalenderId());
-        Long currentPaymentCalenderId = studentPaymentOrder.getCalenderId();
+        Long calenderId = studentPaymentOrder.getCalenderId();
+        MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderService.get(calenderId);
         //查询缴费项目关联的订单
         //查询缴费项目关联的订单
-        List<StudentPaymentOrder> orderList = studentPaymentOrderDao.findByCalenderId(currentPaymentCalenderId, studentPaymentOrder.getUserId());
+        List<StudentPaymentOrder> orderList = studentPaymentOrderDao.findByCalenderId(calenderId, studentPaymentOrder.getUserId());
         if (orderList.size() == 1) {
         if (orderList.size() == 1) {
-            // 更新实际缴费人数
-            if (musicGroupPaymentCalender.getActualNum() == null) {
-                musicGroupPaymentCalender.setActualNum(1);
-            } else {
-                musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + 1);
-            }
+            // 更新缴费人数
+            Integer expectNum = 0;
             if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
             if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
-                if (musicGroupPaymentCalender.getExpectNum() == null) {
-                    musicGroupPaymentCalender.setExpectNum(1);
-                } else {
-                    musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + 1);
-                }
+                expectNum = 1;
             }
             }
-            musicGroupPaymentCalender.setUpdateTime(nowDate);
-            musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+            musicGroupPaymentCalenderDao.updatePaymentNum(studentPaymentOrder.getCalenderId(),1,expectNum);
         }
         }
-        MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(currentPaymentCalenderId, studentPaymentOrder.getUserId());
+        Date date = new Date();
+        MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, studentPaymentOrder.getUserId());
+        //只有报名订单,缴费详情才会是null
         if (musicGroupPaymentCalenderDetail == null) {
         if (musicGroupPaymentCalenderDetail == null) {
             musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
             musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-            musicGroupPaymentCalenderDetail.setTenantId(tenantId);
+            musicGroupPaymentCalenderDetail.setTenantId(studentPaymentOrder.getTenantId());
             musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
             musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
             musicGroupPaymentCalenderDetail.setUserId(studentPaymentOrder.getUserId());
             musicGroupPaymentCalenderDetail.setUserId(studentPaymentOrder.getUserId());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
-            musicGroupPaymentCalenderDetail.setPayTime(nowDate);
+            musicGroupPaymentCalenderDetail.setPayTime(date);
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             musicGroupPaymentCalenderDetail.setUseInCourse(0);
             musicGroupPaymentCalenderDetail.setUseInCourse(0);
             musicGroupPaymentCalenderDetail.setOpen(1);
             musicGroupPaymentCalenderDetail.setOpen(1);
             musicGroupPaymentCalenderDetail.setUserStatus(null);
             musicGroupPaymentCalenderDetail.setUserStatus(null);
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
-            musicGroupPaymentCalenderDetail.setCreateTime(nowDate);
-            musicGroupPaymentCalenderDetail.setUpdateTime(nowDate);
+            //判断乐团收费类型
+            MusicGroup musicGroup = musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId());
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                
+            } else if (musicGroup.getCourseViewType() == CourseViewTypeEnum.COURSE_FEE) {
+                
+            }
+
             musicGroupPaymentCalenderDetailDao.insert(musicGroupPaymentCalenderDetail);
             musicGroupPaymentCalenderDetailDao.insert(musicGroupPaymentCalenderDetail);
         } else {
         } else {
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
-            musicGroupPaymentCalenderDetail.setPayTime(nowDate);
+            musicGroupPaymentCalenderDetail.setPayTime(date);
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+            MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberService.findByCalenderId(calenderId);
+            this.setCourseIncome(calenderMember,musicGroupPaymentCalenderDetail);
             musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
             musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
         }
         }
 
 
         //保存、更新云教练缴费项目预收
         //保存、更新云教练缴费项目预收
-        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getId());
+        operatingReportCloudService.updateSet(musicGroupPaymentCalender,musicGroupPaymentCalenderDetail.getExpectMemberAmount());
         //续费项目加学员时就生成了课程时长,报名项目在缴费成功后才需要添加课程时长
         //续费项目加学员时就生成了课程时长,报名项目在缴费成功后才需要添加课程时长
         musicGroupPaymentStudentCourseDetailService.batchInsert(studentPaymentOrder.getUserId(),
         musicGroupPaymentStudentCourseDetailService.batchInsert(studentPaymentOrder.getUserId(),
                 musicGroupPaymentCalender,
                 musicGroupPaymentCalender,

+ 0 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -385,13 +385,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             calenderMember.setActualAmount(memberActualAmount);
             calenderMember.setActualAmount(memberActualAmount);
             calenderMember.setOriginalAmount(memberOriginalAmount);
             calenderMember.setOriginalAmount(memberOriginalAmount);
             calenderMember.setCalenderId(calenderId);
             calenderMember.setCalenderId(calenderId);
-            //如果当前乐团是会员收费,那么获取云教练收入
-            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-                BigDecimal income = memberFeeSettingService.getAmount(sysUser.getOrganId(),1,
-                        calenderMember.getPeriod(),new BigDecimal(1),
-                        MemberFeeSettingServiceImpl::getIncome);
-                calenderMember.setIncome(income);
-            }
             musicGroupPaymentCalenderMemberService.insert(calenderMember);
             musicGroupPaymentCalenderMemberService.insert(calenderMember);
         }
         }
         //保存乐保缴费信息
         //保存乐保缴费信息

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

@@ -412,7 +412,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
 
 			MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 			MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 			List<MusicGroupPaymentCalenderDetail> insertMusicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
 			List<MusicGroupPaymentCalenderDetail> insertMusicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
-
 			for (StudentImportDto si : studentBasicList) {
 			for (StudentImportDto si : studentBasicList) {
 				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
 				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
 				musicGroupPaymentCalenderDetail.setTenantId(tenantId);
 				musicGroupPaymentCalenderDetail.setTenantId(tenantId);

+ 26 - 39
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java

@@ -1,16 +1,15 @@
 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.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.OperatingReportCloudDao;
+import com.ym.mec.biz.dal.dao.OrganCourseTypeOriginalCostDao;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.OperatingReportCloud;
 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.CloudTeacherFreeCourseService;
 import com.ym.mec.biz.service.OperatingReportCloudService;
 import com.ym.mec.biz.service.OperatingReportCloudService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -31,10 +30,6 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 	@Autowired
 	@Autowired
 	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
 	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
 	@Autowired
 	@Autowired
-	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
-	@Autowired
-	private StudentPaymentOrderDao studentPaymentOrderDao;
-	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
 
 	@Override
 	@Override
@@ -49,39 +44,31 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 
 
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
-	public void updateSet(MusicGroupPaymentCalender calender, Long orderId) {
-		if(!calender.getCloudTeacherPaymentFlag()){
-			return;
-		}
-		BigDecimal amount = BigDecimal.ZERO;
-		//查询云教练价格
-		List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.findApplyOrderGoods(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();
-		}
-		if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
-			this.saveMonthOperating(calender,amount);
-			return;
-		}
-		//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
-		//获取云教练信息
-		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId());
-		if(Objects.isNull(reportCloud)){
-			reportCloud = new OperatingReportCloud();
-			reportCloud.setCalenderId(calender.getId());
-			reportCloud.setCloudPrice(amount);
-			reportCloud.setOrganId(calender.getOrganId());
-			operatingReportCloudDao.insert(reportCloud);
-		}else {
-			if(reportCloud.getSettlementFlag()){
+	public void updateSet(MusicGroupPaymentCalender calender, BigDecimal amount) {
+		//是否有云教练收入需要结转
+		if(BigDecimal.ZERO.compareTo(amount) < 0){
+			//如果是学员缴费,直接结转到本月
+			if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
 				this.saveMonthOperating(calender,amount);
 				this.saveMonthOperating(calender,amount);
 			}else {
 			}else {
-				reportCloud.setCloudPrice(reportCloud.getCloudPrice().add(amount));
-				reportCloud.setUpdateTime(new Date());
-				operatingReportCloudDao.update(reportCloud);
+				//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
+				//获取云教练信息
+				OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId());
+				if(Objects.isNull(reportCloud)){
+					reportCloud = new OperatingReportCloud();
+					reportCloud.setCalenderId(calender.getId());
+					reportCloud.setCloudPrice(amount);
+					reportCloud.setOrganId(calender.getOrganId());
+					operatingReportCloudDao.insert(reportCloud);
+				}else {
+					if(reportCloud.getSettlementFlag()){
+						this.saveMonthOperating(calender,amount);
+					}else {
+						reportCloud.setCloudPrice(reportCloud.getCloudPrice().add(amount));
+						reportCloud.setUpdateTime(new Date());
+						operatingReportCloudDao.update(reportCloud);
+					}
+				}
 			}
 			}
 		}
 		}
 	}
 	}

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

@@ -658,7 +658,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         }
         }
 
 
         //缴费项目详情
         //缴费项目详情
-        musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder, studentRegistration);
+        musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder);
 
 
         List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
         List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
         //销售订单详情
         //销售订单详情

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -276,6 +276,9 @@
         WHERE user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT')
         WHERE user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT')
         AND expect_num_ > 0 AND music_group_id_ = #{musicGroupId}
         AND expect_num_ > 0 AND music_group_id_ = #{musicGroupId}
     </update>
     </update>
+    <update id="updatePaymentNum">
+        UPDATE music_group_payment_calender SET expect_num_ = expect_num_ + #{expectNum},actual_num_ = actual_num_ + #{actualNum} WHERE id_ = #{calenderId}
+    </update>
     <select id="findStudentNoPaymentCalender" resultType="java.lang.Long">
     <select id="findStudentNoPaymentCalender" resultType="java.lang.Long">
         SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
         SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
         WHERE mgpc.student_ids_ = #{userId} AND mgpc.payment_type_ = 'ADD_STUDENT'
         WHERE mgpc.student_ids_ = #{userId} AND mgpc.payment_type_ = 'ADD_STUDENT'

+ 0 - 6
mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml

@@ -35,12 +35,6 @@
 		INSERT INTO operating_report_cloud (organ_id_,calender_id_,start_date_,end_date_,cloud_price_,course_price_,settlement_flag_,month_flag_,create_time_,update_time_)
 		INSERT INTO operating_report_cloud (organ_id_,calender_id_,start_date_,end_date_,cloud_price_,course_price_,settlement_flag_,month_flag_,create_time_,update_time_)
 		VALUES(#{organId},#{calenderId},#{startDate},#{endDate},#{cloudPrice},#{coursePrice},#{settlementFlag},#{monthFlag},NOW(),NOW())
 		VALUES(#{organId},#{calenderId},#{startDate},#{endDate},#{cloudPrice},#{coursePrice},#{settlementFlag},#{monthFlag},NOW(),NOW())
 	</insert>
 	</insert>
-	<insert id="batchInsert">
-		INSERT INTO operating_report_cloud (organ_id_,calender_id_,month_flag_,create_time_,update_time_) VALUES
-		<foreach collection="operatingReportClouds" separator="," item="item">
-			(#{item.organId},#{item.calenderId},#{item.monthFlag},NOW(),NOW())
-		</foreach>
-	</insert>
 
 
 	<!-- 根据主键查询一条记录 -->
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReportCloud">
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReportCloud">