|  | @@ -1,10 +1,14 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.PracticeGroupDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.PracticeGroup;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.SysConfig;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.PracticeGroupType;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Propagation;
 | 
	
	
		
			
				|  | @@ -18,6 +22,7 @@ import com.ym.mec.biz.dal.entity.TeacherDefaultPracticeGroupSalary;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TeacherDefaultPracticeGroupSalaryService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImpl<Long, TeacherDefaultPracticeGroupSalary>  implements TeacherDefaultPracticeGroupSalaryService {
 | 
	
	
		
			
				|  | @@ -28,6 +33,12 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private PracticeGroupDao practiceGroupDao;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SysConfigService sysConfigService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	public BaseDAO<Long, TeacherDefaultPracticeGroupSalary> getDAO() {
 | 
	
		
			
				|  |  |  		return teacherDefaultPracticeGroupSalaryDao;
 | 
	
	
		
			
				|  | @@ -67,7 +78,16 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 | 
	
		
			
				|  |  |  						userId, typeList, startDate);
 | 
	
		
			
				|  |  |  				
 | 
	
		
			
				|  |  |  				if (updateTeacherSalaryList != null && updateTeacherSalaryList.size() > 0) {
 | 
	
		
			
				|  |  | -					
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					Set<Long> groupIds = updateTeacherSalaryList.stream().map(c -> Long.valueOf(c.getMusicGroupId())).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | +					List<PracticeGroup> practiceGroups = practiceGroupDao.getWithIds(new ArrayList<>(groupIds));
 | 
	
		
			
				|  |  | +					Map<Long, PracticeGroup> idGroupMap = new HashMap<>();
 | 
	
		
			
				|  |  | +					if(!CollectionUtils.isEmpty(practiceGroups)){
 | 
	
		
			
				|  |  | +						idGroupMap = practiceGroups.stream().collect(Collectors.toMap(PracticeGroup::getId, p->p, (p1, p2)->p1));
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					SysConfig practiceCourseSalaryConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_SALARY);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  					Date date = new Date();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  					List<CourseScheduleTeacherSalary> list = new ArrayList<CourseScheduleTeacherSalary>();
 | 
	
	
		
			
				|  | @@ -75,7 +95,12 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 | 
	
		
			
				|  |  |  					for (CourseScheduleTeacherSalary ts : updateTeacherSalaryList) {
 | 
	
		
			
				|  |  |  						if (origSalary != null && origSalary.getMainTeacherSalary().compareTo(ts.getExpectSalary()) == 0
 | 
	
		
			
				|  |  |  								&& origSalary.getMainTeacherSalary().compareTo(salary) != 0) {
 | 
	
		
			
				|  |  | -							ts.setExpectSalary(salary);
 | 
	
		
			
				|  |  | +							PracticeGroup practiceGroup = idGroupMap.get(Long.valueOf(ts.getMusicGroupId()));
 | 
	
		
			
				|  |  | +							if(Objects.nonNull(practiceGroup)&& !PracticeGroupType.CHARGE.equals(practiceGroup.getType()) && !PracticeGroupType.COME_ON_PACKAGE.equals(practiceGroup.getType())){
 | 
	
		
			
				|  |  | +								ts.setExpectSalary(new BigDecimal(practiceCourseSalaryConfig.getParanValue()));
 | 
	
		
			
				|  |  | +							}else{
 | 
	
		
			
				|  |  | +								ts.setExpectSalary(salary);
 | 
	
		
			
				|  |  | +							}
 | 
	
		
			
				|  |  |  							ts.setUpdateTime(date);
 | 
	
		
			
				|  |  |  							list.add(ts);
 | 
	
		
			
				|  |  |  						}
 | 
	
	
		
			
				|  | @@ -92,4 +117,4 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 | 
	
		
			
				|  |  |  		return false;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | +}
 |