zouxuan 3 سال پیش
والد
کامیت
fab8b3cec5

+ 259 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderActivity.java

@@ -0,0 +1,259 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.math.BigDecimal;
+
+/**
+ * 对应数据库表(music_group_payment_calender_activity):
+ */
+public class MusicGroupPaymentCalenderActivity{
+
+	/**  */
+	private Integer id;
+
+	/**  */
+	private Integer activityId;
+	
+	/**  */
+	private Integer userId;
+
+	/**  */
+	private Integer teacherId;
+	
+	/** vip课排课标记0没有排课资格1未排课2已排课 */
+	private Integer vipFlag = 0;
+	
+	/**  */
+	private Integer giveVipFlag = 0;
+	
+	/**  */
+	private Integer practiceFlag = 0;
+	
+	/**  */
+	private Integer givePracticeFlag = 0;
+
+	/**  */
+	private Integer memberFlag = 0;
+
+	/**  */
+	private Integer giveMemberFlag = 0;
+
+	private Long paymentOrderId;
+
+	private Long vipGroupId;
+
+	private Long giveVipGroupId;
+
+	private Long memberOrderId;
+
+	private Long giveMemberOrderId;
+
+	private Long practiceGroupId;
+
+	private Long givePracticeGroupId;
+
+	private Boolean returnFee = false;
+
+	private BigDecimal actualPrice = BigDecimal.ZERO;
+
+	private String addMemo;
+
+	private String cutMemo;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+
+	public String getAddMemo() {
+		return addMemo;
+	}
+
+	public void setAddMemo(String addMemo) {
+		this.addMemo = addMemo;
+	}
+
+	public String getCutMemo() {
+		return cutMemo;
+	}
+
+	public void setCutMemo(String cutMemo) {
+		this.cutMemo = cutMemo;
+	}
+
+	public BigDecimal getActualPrice() {
+		return actualPrice;
+	}
+
+	public void setActualPrice(BigDecimal actualPrice) {
+		this.actualPrice = actualPrice;
+	}
+
+	public Integer getTeacherId() {
+		return teacherId;
+	}
+
+	public void setTeacherId(Integer teacherId) {
+		this.teacherId = teacherId;
+	}
+
+	public Long getMemberOrderId() {
+		return memberOrderId;
+	}
+
+	public void setMemberOrderId(Long memberOrderId) {
+		this.memberOrderId = memberOrderId;
+	}
+
+	public Long getGiveMemberOrderId() {
+		return giveMemberOrderId;
+	}
+
+	public void setGiveMemberOrderId(Long giveMemberOrderId) {
+		this.giveMemberOrderId = giveMemberOrderId;
+	}
+
+	public Integer getMemberFlag() {
+		return memberFlag;
+	}
+
+	public void setMemberFlag(Integer memberFlag) {
+		this.memberFlag = memberFlag;
+	}
+
+	public Integer getGiveMemberFlag() {
+		return giveMemberFlag;
+	}
+
+	public void setGiveMemberFlag(Integer giveMemberFlag) {
+		this.giveMemberFlag = giveMemberFlag;
+	}
+
+	public Boolean getReturnFee() {
+		return returnFee;
+	}
+
+	public void setReturnFee(Boolean returnFee) {
+		this.returnFee = returnFee;
+	}
+
+	public Long getVipGroupId() {
+		return vipGroupId;
+	}
+
+	public void setVipGroupId(Long vipGroupId) {
+		this.vipGroupId = vipGroupId;
+	}
+
+	public Long getGiveVipGroupId() {
+		return giveVipGroupId;
+	}
+
+	public void setGiveVipGroupId(Long giveVipGroupId) {
+		this.giveVipGroupId = giveVipGroupId;
+	}
+
+	public Long getPracticeGroupId() {
+		return practiceGroupId;
+	}
+
+	public void setPracticeGroupId(Long practiceGroupId) {
+		this.practiceGroupId = practiceGroupId;
+	}
+
+	public Long getGivePracticeGroupId() {
+		return givePracticeGroupId;
+	}
+
+	public void setGivePracticeGroupId(Long givePracticeGroupId) {
+		this.givePracticeGroupId = givePracticeGroupId;
+	}
+
+	public Long getPaymentOrderId() {
+		return paymentOrderId;
+	}
+
+	public void setPaymentOrderId(Long paymentOrderId) {
+		this.paymentOrderId = paymentOrderId;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setActivityId(Integer activityId){
+		this.activityId = activityId;
+	}
+	
+	public Integer getActivityId(){
+		return this.activityId;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setVipFlag(Integer vipFlag){
+		this.vipFlag = vipFlag;
+	}
+	
+	public Integer getVipFlag(){
+		return this.vipFlag;
+	}
+			
+	public void setGiveVipFlag(Integer giveVipFlag){
+		this.giveVipFlag = giveVipFlag;
+	}
+	
+	public Integer getGiveVipFlag(){
+		return this.giveVipFlag;
+	}
+			
+	public void setPracticeFlag(Integer practiceFlag){
+		this.practiceFlag = practiceFlag;
+	}
+	
+	public Integer getPracticeFlag(){
+		return this.practiceFlag;
+	}
+			
+	public void setGivePracticeFlag(Integer givePracticeFlag){
+		this.givePracticeFlag = givePracticeFlag;
+	}
+	
+	public Integer getGivePracticeFlag(){
+		return this.givePracticeFlag;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderBaseService.java

@@ -3,6 +3,8 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 
+import java.math.BigDecimal;
+
 public interface MusicGroupPaymentCalenderBaseService {
 
     /**
@@ -22,4 +24,13 @@ public interface MusicGroupPaymentCalenderBaseService {
     * @date 2021/12/21 11:37
     */
     MusicGroupPaymentCalender.PaymentCalenderStatusEnum checkComponentAmount(MusicGroupPaymentBaseCalender baseCalender);
+
+    /**
+    * @description: 获取实际金额
+     * @param baseCalender
+    * @return java.math.BigDecimal
+    * @author zx
+    * @date 2021/12/21 23:35
+    */
+    BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender);
 }

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderCourseSettingsService.java

@@ -16,4 +16,12 @@ public interface MusicGroupPaymentCalenderCourseSettingsService extends BaseServ
      * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
      */
     Map<String, Integer> getMusicCourseSettingsWithStudents(String musicGroupId, List<Integer> studentIds);
+
+    void batchInsert(List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings);
+
+    void deleteByMusicGroupPaymentCalenderId(List<Long> calenderIds);
+
+    List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettings(Long calenderId);
+
+    List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettingsByBatchNo(String batchNo);
 }

+ 18 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -279,7 +279,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             //判断课程是否在试用期内
             if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
-                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
 
@@ -395,7 +395,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             //判断课程是否在试用期内
             //如果上课日期在试用期内按80%结算
             if(isTrail(teacher,courseScheduleTeacherSalary.getCourseSchedule().getClassDate())){
-                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
             //扣除费用
@@ -538,7 +538,12 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             }
             //是否异常签到
             if(signCourseTimeBetween >= 0 && signCourseTimeBetween < i){
-                return SalarySettlementSignEnum.ERR_IN;
+                if(teachModeEnum == TeachModeEnum.ONLINE){
+                    //线上课,没有异常签到
+                    return SalarySettlementSignEnum.LATE;
+                }else {
+                    return SalarySettlementSignEnum.ERR_IN;
+                }
             }
         }
         //迟到规则
@@ -769,7 +774,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
             //如果上课日期在试用期内按80%结算
             if(isTrail(teacher,courseSchedule.getClassDate())){
-                teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary/100));
+                teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary/100)).setScale(0,BigDecimal.ROUND_HALF_UP);
                 deductReasons.add("未转正");
             }
 
@@ -1659,14 +1664,14 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         //如果上课日期在试用期内按80%结算
         BigDecimal expectTeacherSalary = teacherSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            teacherSalary = teacherSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(teacherSalary)));
         }
 
@@ -1765,14 +1770,14 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         //如果上课日期在试用期内按80%结算
         BigDecimal expectTeacherSalary = expectSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(expectSalary)));
         }
         //扣除费用
@@ -1858,13 +1863,13 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         //如果上课日期在试用期内按80%结算
         //试用期课酬规则
         String configValue2 = sysTenantConfigService.getTenantConfigValue(SysConfigService.PROBATION_TEACHER_SALARY,tenantId);
-        Integer probationTeacherSalary = 100;
+        double probationTeacherSalary = 100;
         if(StringUtils.isNotEmpty(configValue2)){
-            probationTeacherSalary = Integer.parseInt(configValue2);
+            probationTeacherSalary = Double.parseDouble(configValue2);
         }
         BigDecimal expectTeacherSalary = expectSalary;
         if(isTrail(teacher,courseSchedule.getClassDate())){
-            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100));
+            expectSalary = expectSalary.multiply(new BigDecimal(probationTeacherSalary / 100)).setScale(0,BigDecimal.ROUND_HALF_UP);
             deductReasons.add(new TeacherSalaryDeductReasonDto(DeductReasonEnum.TRAIL, expectTeacherSalary.subtract(expectSalary)));
         }
 

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberPaymentCalenderServiceImpl.java

@@ -10,12 +10,15 @@ import com.ym.mec.biz.dal.enums.PeriodEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
 import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
 
 import java.math.BigDecimal;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
+@Service(value = "memberCalenderService")
 public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
 
     @Autowired
@@ -45,6 +48,15 @@ public class MemberPaymentCalenderServiceImpl implements MusicGroupPaymentCalend
         return NO;
     }
 
+    @Override
+    public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        CalenderMemberDto calenderMember = baseCalender.getCalenderMember();
+        if(calenderMember != null){
+            return calenderMember.getActualAmount();
+        }
+        return BigDecimal.ZERO;
+    }
+
     private BigDecimal getGroupPurchaseFee(PeriodEnum periodEnum,MemberFeeSetting memberFee){
         switch (periodEnum){
             case MONTH :

+ 29 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java

@@ -63,6 +63,26 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 		return result;
 	}
 
+    @Override
+    public void batchInsert(List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings) {
+        musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
+    }
+
+	@Override
+	public void deleteByMusicGroupPaymentCalenderId(List<Long> calenderIds) {
+		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+	}
+
+	@Override
+	public List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettings(Long calenderId) {
+		return musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId);
+	}
+
+	@Override
+	public List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettingsByBatchNo(String batchNo) {
+		return musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo);
+	}
+
 	@Override
 	public void createComponent(MusicGroupPaymentBaseCalender baseCalender) {
 
@@ -115,4 +135,13 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 		}
 		return MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 	}
+
+	@Override
+	public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = baseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+		if(musicGroupPaymentCalenderCourseSettingsList != null && musicGroupPaymentCalenderCourseSettingsList.size() > 0){
+			return musicGroupPaymentCalenderCourseSettingsList.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+		}
+		return BigDecimal.ZERO;
+	}
 }

+ 26 - 113
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -26,6 +26,7 @@ import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +51,8 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 
+import javax.annotation.Resource;
+
 @Service
 public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
 
@@ -59,46 +62,32 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-	
 	@Autowired
-	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
-	
+	private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
-
 	@Autowired
 	private MusicGroupOrganizationCourseSettingsService musicGroupOrganizationCourseSettingsService;
-	
 	@Autowired
 	private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
-	
 	@Autowired
 	private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
-
 	@Autowired
 	private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
-
 	@Autowired
 	private MusicGroupSchoolTermStudentCourseDetailDao musicGroupSchoolTermStudentCourseDetailDao;
-	
 	@Autowired
 	private IdGeneratorService idGeneratorService;
-	
 	@Autowired
 	private ClassGroupService classGroupService;
-	
 	@Autowired
 	private MusicGroupDao musicGroupDao;
-
 	@Autowired
 	private ClassGroupDao classGroupDao;
-
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
-
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
-
 	@Autowired
 	private TeacherAttendanceDao teacherAttendanceDao;
 	@Autowired
@@ -127,7 +116,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
 	private GroupEventSource groupEventSource;
-
 	@Autowired
 	private StudentPaymentOrderDao studentPaymentOrderDao;
 	@Autowired
@@ -138,8 +126,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private StudentService studentService;
 	@Autowired
 	private CloudTeacherOrderDao cloudTeacherOrderDao;
-	@Autowired
-	private MusicGroupPaymentCalenderBaseService musicGroupPaymentCalenderBaseService;
+	@Resource(name = "musicRepairService")
+	private MusicGroupPaymentCalenderBaseService musicRepairService;
+	@Resource(name = "memberCalenderService")
+	private MusicGroupPaymentCalenderBaseService memberCalenderService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -474,7 +464,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
 					}
 				}
-				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
+				musicGroupPaymentCalenderCourseSettingsService.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
 			}
 
 			//如果是跨团班级合并,保存用户缴费详情
@@ -584,95 +574,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Date date = new Date();
 		String batchNo = idGeneratorService.generatorId() + "";
 
-		// 获取设置的课程收费标准
-//		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
-
-		//会员原价
-//		BigDecimal memberPaymentAmount = BigDecimal.ZERO;
 		BigDecimal originalMemberPaymentAmount = BigDecimal.ZERO;
 		if (payUserType == SCHOOL) {
 			status = AUDITING;
 		} else {
-			status = musicGroupPaymentCalenderBaseService.checkComponentAmount(musicGroupPaymentBaseCalender);
-//			if(musicGroupPaymentCalenderCourseSettingsList != null){
-//				if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
-//					// 当前缴费的课程费用
-//					Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
-//							Collectors
-//									.toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
-//
-//					// 查询默认课程费用
-//					Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
-//					Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
-//							.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
-//							.stream()
-//							.collect(
-//									Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
-//											MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
-//
-//					// 相同类型的课程如果修改了课程费用,需要走审批
-//					for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
-//						if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
-//							status = AUDITING;
-//							break;
-//						}
-//					}
-//				} else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
-//					PaymentCalenderStatusEnum dtoStatus = musicGroupPaymentCalenderDto.getStatus();
-//					if(dtoStatus != null && dtoStatus == AUDITING){
-//						status = AUDITING;
-//					}else {
-//						// 如果是课程收费,判断是否审核
-//						for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
-//							OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
-//									musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
-//							if (defaultUnitPrice == null) {
-//								throw new BizException("请先设置分部课程类型单价");
-//							}
-//							if (courseSettings.getCourseTotalMinuties() != 0) {
-//
-//								if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
-//										.compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
-//
-//									status = AUDITING;
-//									break;
-//								}
-//							} else {
-//								status = AUDITING;
-//								break;
-//							}
-//						}
-//					}
-//				}else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
-//					status = musicGroupPaymentCalenderDto.getStatus();
-//				}
-//			}
-//			if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
-//				//会员价格是否变动
-//				MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
-//				if(memberFee == null){
-//					throw new BizException("操作失败:请配置当前分部会员收费标准");
-//				}
-//				switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
-//					case 1 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					case 6 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					case 12 :
-//						memberPaymentAmount = memberFee.getGroupPurchaseYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						originalMemberPaymentAmount = memberFee.getOriginalYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
-//						break;
-//					default:
-//						throw new BizException("请选择正确的会员有效期");
-//				}
-//				if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
-//					status = AUDITING;
-//				}
-//			}
+			status = memberCalenderService.checkComponentAmount(musicGroupPaymentBaseCalender);
+			if(status != AUDITING){
+				status = ((MusicGroupPaymentCalenderCourseSettingsServiceImpl)musicGroupPaymentCalenderCourseSettingsService).checkComponentAmount(musicGroupPaymentBaseCalender);
+			}
+			if(status != AUDITING){
+				status = musicRepairService.checkComponentAmount(musicGroupPaymentBaseCalender);
+			}
 		}
 
 		MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
@@ -681,13 +593,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalender.setMemo(musicGroupPaymentBaseCalender.getMemo());
 		musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
 		musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentBaseCalender.getMusicGroupOrganizationCourseSettingId());
-		BigDecimal totalPaymentAmount = BigDecimal.ZERO;
 		musicGroupPaymentCalender.setPayUserType(musicGroupPaymentBaseCalender.getPayUserType());
 		musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentBaseCalender.getStartPaymentDate());
 		musicGroupPaymentCalender.setOperator(sysUser.getId());
 		musicGroupPaymentCalender.setCreateTime(date);
 		musicGroupPaymentCalender.setUpdateTime(date);
 		musicGroupPaymentCalender.setStatus(status);
+
+		BigDecimal totalPaymentAmount = BigDecimal.ZERO;
 		CalenderMemberDto calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();
 		if(calenderMember != null){
 			//设置会员缴费金额、级别以及有效期
@@ -759,7 +672,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
 				}
 			}
-			musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
+			musicGroupPaymentCalenderCourseSettingsService.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
 		}
 
 		// 如果是报名,需要修改乐团状态
@@ -797,7 +710,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		BigDecimal sumActualAmount = musicGroupPaymentCalenderDetailDao.sumActualAmount(id);
 		//收费标准名称
 		String name = musicGroupPaymentCalenderDao.getCalenderSettingsName(id);
-		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(id);
+		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(id);
 		Map<String, Object> result = new HashMap<>(4);
 		result.put("musicGroupPaymentCalenderCourseSettings", musicGroupPaymentCalenderCourseSettings);
 		if(calender.getMemberRankSettingId() != null){
@@ -859,7 +772,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender :: getId).collect(Collectors.toList());
 		//删除原来数据
 		musicGroupPaymentCalenderDao.delByIds(calenderIds);
-		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+		musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);
 
 		status = PaymentCalenderStatusEnum.NO;
 
@@ -1140,7 +1053,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
 					}
 				}
-				musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
+				musicGroupPaymentCalenderCourseSettingsService.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
 			}
 		}
 
@@ -1457,7 +1370,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 		}
 		//获取收费标准
-		calenderAuditDetailDto.setMusicGroupPaymentCalenderCourseSettings(musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo));
+		calenderAuditDetailDto.setMusicGroupPaymentCalenderCourseSettings(musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettingsByBatchNo(batchNo));
 		//获取跨团合班学员缴费详情
 		calenderAuditDetailDto.setMusicGroupPaymentCalenderStudentDetails(musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo));
 		return calenderAuditDetailDto;
@@ -1561,7 +1474,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 				if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
 					musicGroupPaymentCalender.setExpectNum(1);
-					List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
+					List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
 					addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettings,musicGroup);
 				}
 			}
@@ -1609,7 +1522,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				String classGroupIdStr = calender.getAttribute1();
 				if (StringUtils.isNotBlank(classGroupIdStr)) {
 					classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(calender.getStudentIds()), classGroupIdStr, batchNo,
-							musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo),musicGroup);
+							musicGroupPaymentCalenderCourseSettingsService.queryCalenderCourseSettingsByBatchNo(batchNo),musicGroup);
 				}
 				MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
 				if(musicGroupStudentClassAdjust != null){
@@ -1835,7 +1748,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		
 		List<Long> calenderIds = new ArrayList<Long>();
 		calenderIds.add(id);
-		musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
+		musicGroupPaymentCalenderCourseSettingsService.deleteByMusicGroupPaymentCalenderId(calenderIds);
 		
 		//如果乐团是“费用审核”,则需要修改状态
 		MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicRepairPaymentCalenderServiceImpl.java

@@ -1,10 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dto.CalenderMemberDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.dto.MusicRepairDto;
-import com.ym.mec.biz.dal.entity.MemberFeeSetting;
-import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
 import com.ym.mec.biz.service.SysConfigService;
@@ -13,12 +10,14 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.NO;
 
+@Service(value = "musicRepairService")
 public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentCalenderBaseService {
 
     @Autowired
@@ -46,4 +45,13 @@ public class MusicRepairPaymentCalenderServiceImpl implements MusicGroupPaymentC
         }
         return NO;
     }
+
+    @Override
+    public BigDecimal getActualAmount(MusicGroupPaymentBaseCalender baseCalender) {
+        MusicRepairDto musicRepair = baseCalender.getMusicRepair();
+        if(musicRepair != null){
+            return musicRepair.getActualAmount();
+        }
+        return BigDecimal.ZERO;
+    }
 }

+ 3 - 2
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -4,6 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
@@ -60,8 +61,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @ApiOperation(value = "新增乐团缴费日历")
     @PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/add')")
-    public Object add(@RequestBody MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
-    	String batchNo = musicGroupPaymentCalenderService.create(musicGroupPaymentCalenderDto);
+    public Object add(@RequestBody MusicGroupPaymentBaseCalender musicGroupPaymentBaseCalender) {
+    	String batchNo = musicGroupPaymentCalenderService.create1(musicGroupPaymentBaseCalender);
         ModelMap map = new ModelMap();
         map.put("musicGroupPaymentCalenderBatchNo", batchNo);
         return succeed(map);