| 
					
				 | 
			
			
				@@ -33,7 +33,9 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.collection.MapUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.util.excel.POIUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.http.HttpUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.util.ini.IniFileUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.json.JsonUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.string.MessageFormatter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.validator.CommonValidator; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -43,13 +45,17 @@ import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.context.annotation.Lazy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.core.io.ClassPathResource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.http.HttpStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Propagation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.ByteArrayInputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -60,6 +66,7 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.entity.ApprovalStatus.APPROVED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -74,10 +81,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupDao musicGroupDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TeacherDao teacherDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupDeliveryRecordDao musicGroupDeliveryRecordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentService studentService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -87,6 +94,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private MusicGroupPaymentCalenderMemberDao musicGroupPaymentCalenderMemberDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupPaymentEntitiesDao musicGroupPaymentEntitiesDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -209,6 +218,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private StudentDao studentDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupPaymentCalenderRepairDao musicGroupPaymentCalenderRepairDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private MusicGroupPaymentCalenderActivityDao musicGroupPaymentCalenderActivityDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SchoolStaffService schoolStaffService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -450,6 +461,165 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public void importStudentToMusicGroup1(List<MusicGroupPaymentImportDto> importDtos, MusicGroupPaymentCalender calender) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		String musicGroupId = calender.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//查询导入的声部是否正确 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	List<String> subjectNameList = importDtos.stream().distinct().map(t->t.getSubjectName()).distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	List<MusicGroupSubjectPlan> musicGroupSubjectPlanList = musicGroupSubjectPlanDao.getMusicSubjectClassPlan(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	Map<String,Integer> subjectMap = musicGroupSubjectPlanList.stream().collect(Collectors.toMap(MusicGroupSubjectPlan :: getSubName, MusicGroupSubjectPlan :: getSubjectId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	List<String> allSubjectNameList = musicGroupSubjectPlanList.stream().map(t -> t.getSubName()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	for(String subName : subjectNameList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    		if(!allSubjectNameList.contains(subName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    			throw new BizException("当前乐团不支持[{}]声部", subName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Long calenderId = calender.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Boolean freeFlag = calender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<String> phones = importDtos.stream().map(e -> e.getPhone()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<BasicUserDto> userList = teacherDao.queryUserByPhones(phones); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<String> existPhones = studentDao.queryExistStuByPhone(phones); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Map<String, BasicUserDto> userDtoMap = userList.stream().collect(Collectors.groupingBy(e -> e.getPhone(), Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0)))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Organization organization = organizationDao.get(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//检查用户是否已入团或在其他机构已注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<StudentRegistration> allList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		StudentRegistration studentRegistration = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SysUser sysUser = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Student student = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Integer applyNum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		MusicGroup musicGroup = musicGroupDao.get(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		MusicGroupPaymentCalenderRepair calenderRepair = musicGroupPaymentCalenderRepairDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for(MusicGroupPaymentImportDto si : importDtos){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			BasicUserDto userDto = userDtoMap.get(si.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (Objects.isNull(userDto)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser = new SysUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setPhone(si.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				int phoneStrLen = sysUser.getPhone().length(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setUsername(si.getStudentName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setGender(si.getGender().equals("男") ? 1 : 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setUserType("STUDENT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setOrganId(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				teacherDao.addSysUser(sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				si.setUserId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				si.setUserId(userDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Integer userId = si.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(!existPhones.contains(si.getPhone())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				student = new Student(userId, subjectMap.get(si.getSubjectName()) + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				student.setCurrentGradeNum(SixPlusGradeEnum.get(si.getGrade()).getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentDao.insert(student); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				// 添加用户现金账户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentRegistration = studentRegistrationService.getStudentRegister(musicGroupId,userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(studentRegistration == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration = new StudentRegistration(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String studentGrade = studentService.getStudentGrade(organization.getGradeType(), SixPlusGradeEnum.get(si.getGrade()).getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setCurrentGrade(studentGrade); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setActualSubjectId(subjectMap.get(si.getSubjectName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setIsAllowAdjust(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setSubjectId(subjectMap.get(si.getSubjectName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setParentsPhone(si.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setName(si.getStudentName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setGender(si.getGender().equals("男") ? 1 : 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setPaymentStatus(PaymentStatusEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setTemporaryCourseFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setMusicGroupPaymentCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setTenantId(calender.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setMusicGroupId(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistrationDao.insert(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				allList.add(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				applyNum ++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if (studentRegistration.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					throw new BizException("学员{}乐团状态不支持导入",si.getStudentName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				studentRegistrationDao.update(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				allList.add(studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String channelType = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String orderNo = idGeneratorService.generatorId("payment") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//生成订单,校验优惠券的使用情况 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setExpectAmount(calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setActualAmount(calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setCouponRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setUserId(studentRegistration.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setGroupType(GroupType.OUTORDER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setType(OrderTypeEnum.APPLY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setPaymentChannel(channelType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setOrganId(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setRoutingOrganId(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setMemo("缴费项目外部订单导入"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setMerNos(si.getMerNos()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setTransNo(si.getTransNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setPayTime(si.getPayTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrder.setCourseRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrderService.insert(studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<StudentPaymentOrderDetail> orderDetails = studentRegistrationService.addOrder1(studentPaymentOrder, calender, courseSettings, calenderMember, calenderRepair, calenderActivities); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentRouteOrderService.addRouteOrder(orderNo, calender.getOrganId(), calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentPaymentOrderDetailService.addOrderDetailTo1(studentPaymentOrder, musicGroup, studentRegistration,orderDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (CollectionUtils.isNotEmpty(allList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<Integer, Long> subjectCountMap = allList.stream().collect( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					Collectors.groupingBy(StudentRegistration::getActualSubjectId, Collectors.counting())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			MusicGroupSubjectPlan musicOneSubjectClassPlan = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (Entry<Integer, Long> entry : subjectCountMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, entry.getKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if (musicOneSubjectClassPlan == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					throw new BizException("系统数据[乐团声部设置]异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				int num = musicOneSubjectClassPlan.getApplyStudentNum() == null ? 0 : musicOneSubjectClassPlan.getApplyStudentNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicOneSubjectClassPlan.setApplyStudentNum(num + applyNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicOneSubjectClassPlan.setPaidStudentNum((musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						.getPaidStudentNum()) + entry.getValue().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(freeFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					musicOneSubjectClassPlan.setPaidZeroNum((musicOneSubjectClassPlan.getPaidZeroNum() == null ? 0 : musicOneSubjectClassPlan.getPaidZeroNum()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							+ entry.getValue().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicOneSubjectClassPlan.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				musicGroupSubjectPlanDao.update(musicOneSubjectClassPlan); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			// 更新实际缴费人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (calender.getActualNum() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				calender.setActualNum(allList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				calender.setActualNum(calender.getActualNum() + allList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (calender.getExpectNum() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				calender.setExpectNum(allList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				calender.setExpectNum(calender.getExpectNum() + allList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			calender.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			musicGroupPaymentCalenderDao.update(calender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public String createGroup(SubFeeSettingDto subFeeSettingDto) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -656,7 +826,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //记录操作日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "预报名完成(预报名 -> 报名缴费中)", sysUser.getId(), "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentRegistrationDao.musicGroupOpenPay(musicGroupId, PaymentStatusEnum.OPEN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -959,6 +1129,78 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(payMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void importRenew(List<MusicGroupPaymentImportDto> importDtos) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<MusicGroupPaymentImportDto>> dtoMap = importDtos.stream().collect(Collectors.groupingBy(e -> e.getBatchNo())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String batchNo : dtoMap.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<MusicGroupPaymentCalender> byBatchNo = musicGroupPaymentCalenderDao.findByBatchNo(batchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(CollectionUtils.isEmpty(byBatchNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("缴费项目批次{}不存在",batchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			MusicGroupPaymentCalender calender = byBatchNo.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(calender.getPayUserType() == SCHOOL){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				throw new BizException("不支持学校缴费导入"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(calender.getPaymentType() != MUSIC_RENEW && calender.getPaymentType() != ADD_COURSE && calender.getPaymentType() != MUSIC_APPLY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				throw new BizException("不支持类型 {} 的缴费项目导入",calender.getPaymentType().getDesc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(calender.getPaymentType() == MUSIC_APPLY){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				this.importStudentToMusicGroup1(importDtos,calender); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Long calenderId = calender.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<MusicGroupPaymentImportDto> userDtoList = dtoMap.get(batchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<MusicGroupPaymentCalenderDetail> detailList = musicGroupPaymentCalenderDetailDao.getCalenderDetailWithCalender(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Map<Integer, MusicGroupPaymentCalenderDetail> detailMap = detailList.stream().collect(Collectors.groupingBy(e -> e.getUserId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0)))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (MusicGroupPaymentImportDto userDto : userDtoList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					MusicGroupPaymentCalenderDetail calenderDetail = detailMap.get(userDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(Objects.isNull(calenderDetail)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						throw new BizException("缴费项不存在学员{},请检查导入Excel",userDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if (calenderDetail.getPaymentStatus() == PaymentStatus.PAID_COMPLETED) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						throw new BizException("学员{}已缴费,请勿重复录入",userDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				MusicGroupPaymentCalenderRepair calenderRepair = musicGroupPaymentCalenderRepairDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityDao.findByCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (MusicGroupPaymentImportDto userDto : userDtoList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					String orderNo = idGeneratorService.generatorId("payment") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setExpectAmount(calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setActualAmount(calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setCouponRemitFee(BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setGroupType(GroupType.OUTORDER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setUserId(userDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setType(OrderTypeEnum.RENEW); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setStatus(SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setMusicGroupId(calender.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setBatchNo(calenderId + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setVersion(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setCalenderId(calenderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setOrganId(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setRoutingOrganId(calender.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setMemo("缴费项目外部订单导入"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setMerNos(userDto.getMerNos()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setTransNo(userDto.getTransNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrder.setPayTime(userDto.getPayTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrderDao.insert(studentPaymentOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(studentPaymentOrder.getUserId(), calender.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					//支付成功后处理课程、云教练、活动等数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					List<StudentPaymentOrderDetail> orderDetails = studentRegistrationService.addOrder1(studentPaymentOrder, calender, courseSettings, calenderMember, calenderRepair, calenderActivities); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentRouteOrderService.addRouteOrder(orderNo, calender.getOrganId(), calender.getCurrentTotalAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					studentPaymentOrderDetailService.addOrderDetailTo1(studentPaymentOrder, musicGroup, studentRegistration,orderDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupApplyGoodsDto getCalenderTotalAmount(RegisterPayDto registerPayDto, MusicGroupPaymentCalender calender) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	String musicGroupId = calender.getMusicGroupId(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1082,10 +1324,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public HttpResponseResult pay(RegisterPayDto registerPayDto) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	Integer userId = registerPayDto.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	String musicGroupId = registerPayDto.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //判断用户是否已存在订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.ING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isNotEmpty(applyOrderList)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1107,7 +1349,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("查询乐团信息失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SubjectChange subjectChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(subjectChange != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	throw new BizException("您已做过声部更换操作,不能继续缴费"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1250,6 +1492,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return BaseController.succeed(payMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void updateSubjectInfo(SubFeeSettingDto subFeeSettingDto) throws Exception { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1315,19 +1558,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         		throw new BizException("分部信息查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	BigDecimal maxProfits = organ.getMaxMusicalInstrumentsProfits(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup : subFeeSettingDto.getMusicGroupSubjectGoodsGroups()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (musicGroupSubjectGoodsGroup.getType().equals(GoodsType.INSTRUMENT) && (musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson() == null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().isEmpty() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().equals("{}"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new BizException(musicGroupSubjectGoodsGroup.getName() + " 请选择提供方式"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //判断分润是否超过最大值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(musicGroupSubjectGoodsGroup.getOrganShareProfit() != null && maxProfits.compareTo(musicGroupSubjectGoodsGroup.getOrganShareProfit()) < 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	throw new BizException("超过了分润最大金额[{}],请重新设置分润金额", maxProfits.doubleValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     musicGroupSubjectGoodsGroup.setGroupRemissionCourseFee(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1438,12 +1681,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("用户信息获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroup musicGroup = musicGroupDao.get(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("乐团信息不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT && musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("当前乐团状态不支持此操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1457,23 +1700,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroup.setStatus(MusicGroupStatusEnum.AUDIT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroup.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupDao.update(musicGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         statusList.add(PaymentCalenderStatusEnum.DRAFT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //修改乐团报名缴费项目状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	throw new BizException("请先创建缴费项目"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupPaymentCalenderList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	t.setStatus(PaymentCalenderStatusEnum.AUDITING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	t.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 null, null, MessageTypeEnum.BACKSTAGE_CREATE_MUSIC_GROUP_APPLY, sysUser.getRealName(), musicGroup.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1495,9 +1738,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("当前乐团状态不支持此操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //记录操作日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(审核中 -> 审核失败)", sysUser.getId(), memo)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1505,40 +1748,40 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroup.setMemo(memo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroup.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupDao.update(musicGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statusList.add(PaymentCalenderStatusEnum.AUDITING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //修改乐团报名缴费项目状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setStatus(PaymentCalenderStatusEnum.DRAFT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else if(musicGroup.getStatus() == MusicGroupStatusEnum.FEE_AUDIT){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(费用审核中 -> 费用审核失败)", sysUser.getId(), memo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statusList.add(PaymentCalenderStatusEnum.AUDITING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //修改乐团报名缴费项目状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setStatus(PaymentCalenderStatusEnum.REJECT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setMemo(memo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //修改乐团状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT_FAILED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroup.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupDao.update(musicGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1558,9 +1801,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("当前乐团状态不支持此操作"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //记录操作日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 费用审核中)", sysUser.getId(), "")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1568,17 +1811,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else if(musicGroup.getStatus() == MusicGroupStatusEnum.FEE_AUDIT){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(费用审核中 -> 预报名)", sysUser.getId(), "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             statusList.add(PaymentCalenderStatusEnum.AUDITING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //修改乐团报名缴费项目状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	throw new BizException("没有审核中的缴费项目"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (t.getPayUserType() == SCHOOL) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (t.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1595,7 +1838,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             	t.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroup.setUpdateTime(date); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1931,7 +2174,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             regCalender.setDeadlinePaymentDate(expireDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             regCalender.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             musicGroupPaymentCalenderService.update(regCalender); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2210,7 +2453,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Boolean hasRole = employeePositionService.getDao().hasRole("一键退团",reqMusicGroupQuit.getOperatorId(),reqMusicGroupQuit.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //如果发起退团申请的是乐团主管 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2220,7 +2463,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	            if (!StringUtils.equals(musicGroupQuit.getCurrentApproveRole(), SysUserRoleEnum.EDUCATION.ordinal() + 1 + "")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	                throw new BizException("只有分部经理才能审核"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	            if (status == ApprovalStatus.APPROVED) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	                throw new BizException("只能分部经理操作退团"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3107,6 +3350,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public boolean importRenewForCallback(StudentPaymentOrder studentPaymentOrder) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userId = studentPaymentOrder.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String musicGroupId = studentPaymentOrder.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //支付成功后处理课程、云教练、活动等数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrderDetailService.addOrderDetailTo(studentPaymentOrder, musicGroup, studentRegistration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public boolean updateTeacherCoursesSalary(Long courseScheduleId, Integer teacherId, BigDecimal salary, BigDecimal subsidy, String scope) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3735,7 +3990,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("用户信息获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String musicGroupId = closeMusicGroupDto.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroup musicGroup = musicGroupDao.get(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (musicGroup == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("乐团找不到"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3794,7 +4049,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (registrations.size() > 0 && studentRegistrationService.quitAllStudent(musicGroup.getId(), "退团(乐团关闭)") <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("处理学生退团失败,请重试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//完结所有未处理的退团审批 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		musicGroupQuitDao.finish(musicGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //清除剩余未排课时长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupPaymentStudentCourseDetailService.clearRemainCourseMinutesByMusicGroupId(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3872,7 +4129,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public boolean confirmDelivery(Integer userId, MusicGroupDeliveryVo musicGroupDeliveryVo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     	String musicGroupId = musicGroupDeliveryVo.getMusicGroupId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroup musicGroup = musicGroupDao.get(musicGroupId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3881,24 +4138,24 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String deliveryBatchNo = idGeneratorService.generatorId("delivery") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //更新订单的发货状态(包括声部更换) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.querySubjectChangeByMusicGroupId(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(studentPaymentOrderDetailList == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	studentPaymentOrderDetailList = new ArrayList<StudentPaymentOrderDetail>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList1 = studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(studentPaymentOrderDetailList1 != null && studentPaymentOrderDetailList1.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	studentPaymentOrderDetailList.addAll(studentPaymentOrderDetailList1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(studentPaymentOrderDetailList == null || studentPaymentOrderDetailList.size() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	throw new BizException("没有商品信息,不能发货"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         studentPaymentOrderDetailList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	t.setDeliveryBatchNo(deliveryBatchNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	t.setUpdateTime(date); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3906,7 +4163,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(studentPaymentOrderDetailList.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	studentPaymentOrderDetailDao.batchUpdate(studentPaymentOrderDetailList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<SubjectChange> subjectChangeList = subjectChangeDao.queryWaitDeliveryList(musicGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         subjectChangeList.forEach(t -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	t.setDeliveryBatchNo(deliveryBatchNo); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3923,7 +4180,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	List<Long> instrumentIdList = maintenanceList.stream().map(t -> t.getStudentInstrumentId()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             MusicGroupPaymentCalenderRepair musicGroupPaymentCalenderRepair = musicGroupPaymentCalenderRepairDao.findByCalenderId(maintenanceList.get(0).getMusicGroupPaymentCalenderId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<StudentInstrument> updateList = new ArrayList<StudentInstrument>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3957,7 +4214,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dr.setMusicGroupShippingAddressId(musicGroupDeliveryVo.getAddressId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dr.setOperatorUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dr.setUpdateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         musicGroupDeliveryRecordDao.insert(dr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3990,4 +4247,48 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public List<Subject> getSubjectListByIdAndCoopId(String musicGroupId, Integer coopId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return subjectDao.getSubjectListByIdAndCoopId(musicGroupId,coopId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<String> importMusicGroupPayment(MultipartFile file) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.MUSIC_GROUP_PAYMENT_IMPORT.getMsg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<MusicGroupPaymentImportDto> importDtos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> errMsg = new ArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (String sheetName : sheetsListMap.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Map<String, Object>> sheet = sheetsListMap.get(sheetName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int i = 0; i < sheet.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, Object> row = sheet.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (row.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                JSONObject objectMap = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                valueIsNull: for (String s : row.keySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String columnValue = columns.get(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (StringUtils.isEmpty(columnValue)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (null == row.get(s)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    objectMap.put(columnValue, row.get(s)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    MusicGroupPaymentImportDto cost = JSONObject.parseObject(objectMap.toJSONString(), MusicGroupPaymentImportDto.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    importDtos.add(cost); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new BizException("导入数据出错", ex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!org.springframework.util.CollectionUtils.isEmpty(errMsg)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return errMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(!org.springframework.util.CollectionUtils.isEmpty(importDtos)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.importRenew(importDtos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |