Joburgess 5 years ago
parent
commit
bcb6c328cd

+ 15 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1,20 +1,20 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
@@ -56,6 +56,15 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<CourseSchedule> findByCourseScheduleIds(List<Long> courseScheduleIds);
 
     /**
+     * @describe 根据课程编号列表获取助教列表
+     * @author Joburgess
+     * @date 2019/10/23
+     * @param courseScheduleIds: 课程编号列表
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
+     */
+    List<CourseScheduleTeacherSalary> findTeachingTeachers(List<Long> courseScheduleIds);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/9/17
      * 根据日期获取当日排课信息

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -3,13 +3,12 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.dto.VipGroupSalaryDto;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ibatis.annotations.Param;
-
 public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseScheduleTeacherSalary> {
 
     /**
@@ -58,4 +57,15 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 */
 	int batchUpdateWages(@Param("classGrpupId") Integer classGrpupId, @Param("userId") Integer userId, @Param("salary") BigDecimal salary,
 			@Param("subsidy") BigDecimal subsidy);
+
+	/**
+	 * @describe 批量更新指定班级关联教师预计薪水
+	 * @author Joburgess
+	 * @date 2019/10/23
+	 * @param courseScheduleId: 课程编号
+	 * @param userIds: 课程关联教师编号
+	 * @return int
+	 */
+	int batchUpdateTeacherExpectSalary(@Param("courseScheduleId") Integer courseScheduleId,
+									   @Param("userIds") List<Integer> userIds);
 }

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

@@ -1,16 +1,15 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.List;
-
 import com.ym.mec.biz.dal.dto.UserGoodsDto;
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrder> {
 
@@ -28,7 +27,8 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @Date: 2019/10/3
      * 根据学生vip课获取缴费订单
      */
-    StudentPaymentOrder findByStudentVipGroup(@Param("vipGroupId") Long vipGroupId, @Param("userId") Integer userId);
+    StudentPaymentOrder findByStudentVipGroup(@Param("vipGroupId") Long vipGroupId,
+                                              @Param("userId") Integer userId);
 
     /**
      * 查询乐团报名的订单

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -215,4 +215,13 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      * @return
      */
     List<School> querySchoolByUserId(Integer userId);
+
+    /**
+     * @describe 根据课程编号获取vip课
+     * @author Joburgess
+     * @date 2019/10/23
+     * @param courseScheduleId: 课程编号
+     * @return com.ym.mec.biz.dal.entity.VipGroup
+     */
+    VipGroup findByCourseSchedule(Integer courseScheduleId);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java

@@ -11,6 +11,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -90,6 +91,9 @@ public class CourseSchedule {
 	@ApiModelProperty(value = "实际上课教师", required = false)
 	private Long actualTeacherId;
 
+	@ApiModelProperty(value = "助教编号列表")
+	private List<Integer> teachingTeacherIdList;
+
 	/**  */
 	private java.util.Date createTime;
 
@@ -110,6 +114,14 @@ public class CourseSchedule {
 	
 	private Integer schoolId;
 
+	public List<Integer> getTeachingTeacherIdList() {
+		return teachingTeacherIdList;
+	}
+
+	public void setTeachingTeacherIdList(List<Integer> teachingTeacherIdList) {
+		this.teachingTeacherIdList = teachingTeacherIdList;
+	}
+
 	public String getStartClassTimeStr() {
 		return startClassTimeStr;
 	}

+ 15 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -89,13 +89,21 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
     VipGroupManageDetailDto getVipGroupDetail(Long vipGroupId);
 
     /**
-     * @Author: Joburgess
-     * @Date: 2019/10/10
-     * @params [vipGroup, onlineClassesUnitPrice, offlineClassesUnitPrice]
-     * @return java.math.BigDecimal
-     * @describe 计算课程购买总价
-     */
-    Map countVipGroupPredictFee(VipGroup vipGroup,BigDecimal onlineClassesUnitPrice,BigDecimal offlineClassesUnitPrice);
+     * @describe 计算vip课程购买总价,及老师课酬
+     * @author Joburgess
+     * @date 2019/10/23
+     * @param vipGroup: vip课程
+     * @param teacherId: 要计算课酬的老师的编号
+     * @param onlineClassesUnitPrice: 线上课程单价
+     * @param offlineClassesUnitPrice: 线下课程单价
+     * @param computeTotalPrice: 是否计算课程购买总价
+     * @return java.util.Map
+     */
+    Map countVipGroupPredictFee(VipGroup vipGroup,
+                                Integer teacherId,
+                                BigDecimal onlineClassesUnitPrice,
+                                BigDecimal offlineClassesUnitPrice,
+                                boolean computeTotalPrice);
 
     /**
      * @Author: Joburgess

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

@@ -6,10 +6,7 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
-import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
@@ -28,6 +25,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -53,6 +51,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 	@Autowired
 	private SysMessageService sysMessageService;
+	@Autowired
+	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
 
 	@Override
 	public BaseDAO<Long, CourseSchedule> getDAO() {
@@ -315,9 +315,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(oldCourseScheduleList.size()!=newCourseSchedules.size()){
 			throw new BizException("课程信息错误");
 		}
+
+		//课程对应助教集合
+		List<CourseScheduleTeacherSalary> teachingTeacherSalarys = courseScheduleDao.findTeachingTeachers(newCourseScheduleIds);
+		Map<Long, List<CourseScheduleTeacherSalary>> courseTeachingTeacherMaps = teachingTeacherSalarys.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
+
 		Map<Long, CourseSchedule> oldCourseSchedules = oldCourseScheduleList.stream().collect(Collectors.toMap(CourseSchedule::getId,courseSchedule -> courseSchedule));
 		newCourseSchedules.forEach(newCourseSchedule -> {
 			CourseSchedule oldCourseSchedule = oldCourseSchedules.get(newCourseSchedule.getId());
+
 			ArrayList<Date> dates = new ArrayList<>();
 			dates.add(newCourseSchedule.getClassDate());
 			List<CourseSchedule> coursesByDates = courseScheduleDao.findOverLapCoursesInDay(dates,newCourseSchedule.getStartClassTime(),newCourseSchedule.getEndClassTime());
@@ -336,7 +342,20 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				courseScheduleDao.update(newCourseSchedule);
 			}
 			if(oldCourseSchedule.getType()== CourseSchedule.CourseScheduleType.VIP){
+				if(!oldCourseSchedule.getActualTeacherId().equals(newCourseSchedule.getActualTeacherId())){
 
+				}
+			}else{
+				List<CourseScheduleTeacherSalary> courseTeachingTeacherList=courseTeachingTeacherMaps.get(newCourseSchedule.getId());
+				//当前设置的课程助教编号列表
+				List<Integer> currentCourseTeachingTeacherIds=new ArrayList<>();
+				if(!CollectionUtils.isEmpty(courseTeachingTeacherList)){
+					currentCourseTeachingTeacherIds = courseTeachingTeacherList.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toList());
+				}
+				//修改后的课程助教编号列表
+				List<Integer> newTeachingTeacherIdList = newCourseSchedule.getTeachingTeacherIdList();
+				//找出重复的助教编号
+				List<Integer> foundInCurrentCourseTeachingTeacherIds = newTeachingTeacherIdList.stream().filter(currentCourseTeachingTeacherIds::contains).collect(Collectors.toList());
 			}
 		});
 	}

+ 29 - 84
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -1,14 +1,14 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
+import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,38 +16,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
-import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.CourseScheduleComplaintsDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
-import com.ym.mec.biz.dal.dto.VipGroupSalarySettlementDto;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.SysConfig;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
-import com.ym.mec.biz.dal.entity.VipGroupActivity;
-import com.ym.mec.biz.dal.enums.AuditStatusEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.TeachModeEnum;
-import com.ym.mec.biz.dal.enums.TeachTypeEnum;
-import com.ym.mec.biz.dal.enums.VipGroupActivityTypeEnum;
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
-import com.ym.mec.common.dal.BaseDAO;
-import com.ym.mec.common.exception.BizException;
-import com.ym.mec.common.service.impl.BaseServiceImpl;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long, CourseScheduleTeacherSalary>  implements CourseScheduleTeacherSalaryService {
@@ -65,9 +36,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 	@Autowired
 	private SysUserCashAccountService sysUserCashAccountService;
 	@Autowired
-	private SysUserCashAccountDetailService sysUserCashAccountDetailService;
-	@Autowired
-	private StudentPaymentOrderDao studentPaymentOrderDao;
+	private VipGroupService vipGroupService;
 	
 	@Autowired
 	private SysConfigDao sysConfigDao;
@@ -85,12 +54,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 													List<CourseSchedule> vipCourseSchedules,
 													BigDecimal onlineTeacherSalary,
 													BigDecimal offlineTeacherSalary) {
-		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
-				vipGroup.getVipGroupCategoryId());
-
 		//获取活动信息
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
-		VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
 
 		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries=new ArrayList<>();
 		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipCourseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
@@ -107,42 +72,22 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 				courseScheduleTeacherSalary.setUserId(vipGroup.getUserId());
 				courseScheduleTeacherSalary.setClassGroupId(courseSchedules.get(i).getClassGroupId());
 
-				if(teachModeEnum==TeachModeEnum.ONLINE){
-					if(vipGroupActivity.getType()== VipGroupActivityTypeEnum.GIVE_CLASS
-							&&vipGroup.getGiveTeachMode()==teachModeEnum
-							&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())
-							&&"0".equals(vipGroupActivity.getGiveClassPaySalaryFlag())){
-						courseScheduleTeacherSalary.setExpectSalary(new BigDecimal(0));
-					}else {
-						//教师课酬线上单课酬计算
-						switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
-							case TEACHER_DEFAULT:
-								courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOnlineClassesSalary());
-								break;
-							case RATIO_DISCOUNT:
-								courseScheduleTeacherSalary.setExpectSalary(onlineTeacherSalary.multiply(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue()));
-								break;
-							case FIXED_SALARY:
-								courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
-								break;
-							default:
-								throw new BizException("未指定课酬结算标准!");
-						}
-					}
-				}else{
-					//教师线下单课酬计算
-					switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
-						case TEACHER_DEFAULT:
-							courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOfflineClassesSalary());
-							break;
-						case RATIO_DISCOUNT:
-							courseScheduleTeacherSalary.setExpectSalary(offlineTeacherSalary.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
-							break;
-						case FIXED_SALARY:
-							courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
-							break;
-						default:
-							throw new BizException("未指定课酬结算标准!");
+				Map<String,BigDecimal> feeInfo = vipGroupService.countVipGroupPredictFee(vipGroup,
+						courseSchedules.get(i).getActualTeacherId().intValue(),
+						onlineTeacherSalary,
+						offlineTeacherSalary,
+						false);
+
+				if(vipGroupActivity.getType()== VipGroupActivityTypeEnum.GIVE_CLASS
+						&&vipGroup.getGiveTeachMode()==teachModeEnum
+						&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())
+						&&"0".equals(vipGroupActivity.getGiveClassPaySalaryFlag())){
+					courseScheduleTeacherSalary.setExpectSalary(new BigDecimal(0));
+				}else {
+					if(teachModeEnum==TeachModeEnum.ONLINE){
+						courseScheduleTeacherSalary.setExpectSalary(feeInfo.get("onlineTeacherSalary"));
+					}else{
+						courseScheduleTeacherSalary.setExpectSalary(feeInfo.get("offlineTeacherSalary"));
 					}
 				}
 				courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);

+ 47 - 41
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -141,8 +141,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		//计算课程相关费用信息
 		Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
+				vipGroupApplyBaseInfoDto.getUserId(),
 				vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
-				vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
+				vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(),
+				true);
 
 		//如果默认课酬与实际课酬不匹配则需要审批
 		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())!=0||
@@ -441,14 +443,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         return new VipGroupCostCountDto(null,teacherSalary);
     }
 
-    /**
-     * @Author: Joburgess
-     * @Date: 2019/10/2
-     * 计算VIP课程预计收费
-     */
     @Override
-    public Map<String,BigDecimal> countVipGroupPredictFee(VipGroup vipGroup,BigDecimal onlineClassesUnitPrice,BigDecimal offlineClassesUnitPrice){
-		if(Objects.isNull(vipGroup.getUserId())){
+    public Map<String,BigDecimal> countVipGroupPredictFee(VipGroup vipGroup,
+														  Integer teacherId,
+														  BigDecimal onlineClassesUnitPrice,
+														  BigDecimal offlineClassesUnitPrice,
+														  boolean computeTotalPrice){
+		if(Objects.isNull(teacherId)){
 			throw new BizException("请指定教师");
 		}
 
@@ -461,7 +462,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("未找到课程形式");
 		}
 
-		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
+		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(teacherId.longValue(),
 				vipGroup.getVipGroupCategoryId());
 
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
@@ -531,37 +532,39 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		}
 
 
-		//课程购买费用计算
-		BigDecimal totalPrice;
-		switch (vipGroupActivity.getType()){
-			case BASE_ACTIVITY:
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				break;
-			case DISCOUNT:
-				BigDecimal discount=new BigDecimal(vipGroupActivity.getAttribute1());
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				totalPrice=totalPrice.multiply(discount);
-				break;
-			case GIVE_CLASS:
-				if(vipGroup.getGiveTeachMode()==TeachModeEnum.OFFLINE){
-					if(offlineClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
-						offlineClassNum=offlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
-					}
-					offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
-				}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.ONLINE){
-					if(onlineClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
-						onlineClassNum=onlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
+		if(computeTotalPrice){
+			//课程购买费用计算
+			BigDecimal totalPrice;
+			switch (vipGroupActivity.getType()){
+				case BASE_ACTIVITY:
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					break;
+				case DISCOUNT:
+					BigDecimal discount=new BigDecimal(vipGroupActivity.getAttribute1());
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					totalPrice=totalPrice.multiply(discount);
+					break;
+				case GIVE_CLASS:
+					if(vipGroup.getGiveTeachMode()==TeachModeEnum.OFFLINE){
+						if(offlineClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
+							offlineClassNum=offlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
+						}
+						offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
+					}else if(vipGroup.getGiveTeachMode()==TeachModeEnum.ONLINE){
+						if(onlineClassNum.compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){
+							onlineClassNum=onlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2()));
+						}
+						onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
+					}else{
+						throw new BizException("请指定赠送课程类型!");
 					}
-					onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
-				}else{
-					throw new BizException("请指定赠送课程类型!");
-				}
-				totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
-				break;
-			default:
-				throw new BizException("活动类型错误!");
+					totalPrice=onlineVipGroupCharge.add(offlineVipGroupCharge);
+					break;
+				default:
+					throw new BizException("活动类型错误!");
+			}
+			results.put("totalPrice",totalPrice);
 		}
-		results.put("totalPrice",totalPrice);
         return results;
     }
 
@@ -632,8 +635,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map payMap = payService.getPayMap(
 				vipGroup.getTotalPrice(),
 				orderNo,
-				"http://47.99.212.176:8000/api-student/studentOrder/notify",
-				"http://dev.dayaedu.com",
+				"http://103.46.128.45:11805/api-student/studentOrder/notify",
+				"http://103.46.128.45:41818/paymentresult",
 				"vip课购买",
 				vipGroup.getName());
 
@@ -651,6 +654,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Integer userId = order.getUserId();
 		boolean isOk=order.getStatus().equals(DealStatusEnum.SUCCESS);
 
+		studentPaymentOrderDao.update(order);
+
 		//将学生加入到班级,更新班级报名状态及人数信息
 		if(!isOk){
 			updateVipGroupStudentNumAndStatus(vipGroupId,-1);
@@ -693,8 +698,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		//剩余课时数
 		Map surplusClassTimes=MapUtil.convertMybatisMap(vipGroupDao.countSurplusClassTimes(vipGroupId));
 		studentApplyRefunds.setExpectAmount(countVipGroupPredictFee(vipGroup,
+				vipGroup.getUserId(),
 				new BigDecimal(surplusClassTimes.get(TeachModeEnum.ONLINE.getCode()).toString()),
-				new BigDecimal(surplusClassTimes.get(TeachModeEnum.OFFLINE.getCode()).toString())).get("totalPrice"));
+				new BigDecimal(surplusClassTimes.get(TeachModeEnum.OFFLINE.getCode()).toString()),true).get("totalPrice"));
 		studentApplyRefunds.setStatus(AuditStatusEnum.ING);
 		String orderNo=StringUtils.join(new String[]{studentId.toString(),String.valueOf(System.currentTimeMillis())});
 		studentApplyRefunds.setOrderNo(orderNo);

+ 31 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -286,15 +286,45 @@
 
     <select id="findByCourseScheduleIds" resultMap="CourseSchedule">
         SELECT
-            *
+            cs.id_,
+            cs.class_group_id_,
+            cs.status_,
+            cs.subsidy_,
+            cs.class_date_,
+            cs.start_class_time_,
+            cs.end_class_time_,
+            cs.teacher_id_,
+            csts.user_id_ actual_teacher_id_,
+            cs.create_time_,
+            cs.update_time_,
+            cs.teach_mode_,
+            cs.type_,
+            cs.name_,
+            cs.student_num_,
+            cs.leave_student_num_,
+            cs.schoole_id_
         FROM
             course_schedule
+            LEFT JOIN course_schedule_teacher_salary csts ON cs.id_= csts.course_schedule_id_ AND csts.teacher_role_='BISHOP'
         WHERE id_ IN
         <foreach collection="courseScheduleIds" item="id" open="(" close=")" separator=",">
             #{id}
         </foreach>
     </select>
 
+    <select id="findTeachingTeachers" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao.CourseScheduleTeacherSalary">
+        SELECT
+          csts.*
+        FROM
+          course_schedule_teacher_salary csts
+        WHERE
+          csts.teacher_role_ = 'BISHOP'
+        AND csts.course_schedule_id_ IN
+        <foreach collection="courseScheduleIds" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
+
     <select id="getCourseSchedulesWithDate" resultMap="courseScheduleDto">
         SELECT
         cg.id_ seal_class_id_,

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -166,4 +166,14 @@
 			update_time_ = now()
 		WHERE user_id_ = #{userId} and class_group_id_ = #{classGroupId}
 	</update>
+    <update id="batchUpdateTeacherExpectSalary">
+		UPDATE course_schedule_teacher_salary
+		SET expect_salary_ = 0
+		WHERE
+			course_schedule_id_ = #{courseScheduleId}
+			AND user_id_ IN
+			<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
+				#{userId}
+			</foreach>
+	</update>
 </mapper>

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -631,4 +631,14 @@
             </foreach>
         GROUP BY vgcgm.vip_group_id_
     </select>
+
+    <select id="findByCourseSchedule" resultMap="VipGroup">
+        SELECT
+            vg.*
+        FROM
+            vip_group vg
+            LEFT JOIN vip_group_class_group_mapper vgcgm ON vg.id_=vgcgm.vip_group_id_
+            LEFT JOIN course_schedule cs ON vgcgm.class_group_id_=cs.class_group_id_
+            WHERE cs.id_=#{courseScheduleId}
+    </select>
 </mapper>

+ 5 - 1
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -118,7 +118,11 @@ public class VipGroupManageController extends BaseController {
     @PostMapping("/getVipGroupCostCount")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/getVipGroupCostCount')")
     public Object getVipGroupCostCount(VipGroup vipGroup){
-        Map results = vipGroupService.countVipGroupPredictFee(vipGroup, vipGroup.getOnlineClassesUnitPrice(), vipGroup.getOfflineClassesUnitPrice());
+        Map results = vipGroupService.countVipGroupPredictFee(vipGroup,
+                vipGroup.getUserId(),
+                vipGroup.getOnlineClassesUnitPrice(),
+                vipGroup.getOfflineClassesUnitPrice(),
+                true);
         return succeed(results);
     }