|  | @@ -1846,14 +1846,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //退乐保费用
 | 
	
		
			
				|  |  |              if (maintenanceFee != null) {
 | 
	
		
			
				|  |  | +                StudentInstrument studentMaintenance = studentInstrumentDao.getStudentMaintenance(userId, musicGroupId);
 | 
	
		
			
				|  |  |                  if (maintenanceFee.compareTo(BigDecimal.ZERO) > 0) {
 | 
	
		
			
				|  |  | -                    int maintenanceNum = studentInstrumentDao.getStudentMaintenanceNum(userId);
 | 
	
		
			
				|  |  | -                    if (maintenanceNum <= 0) {
 | 
	
		
			
				|  |  | +                    if (studentMaintenance == null) {
 | 
	
		
			
				|  |  |                          throw new BizException("学生没有有效期内的乐保,不能退乐保费用");
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  amount = amount.add(maintenanceFee);
 | 
	
		
			
				|  |  | -                studentInstrumentDao.quitMaintenance(userId);
 | 
	
		
			
				|  |  | +                if (studentMaintenance != null) {
 | 
	
		
			
				|  |  | +                    studentMaintenance.setDelFlag(1);
 | 
	
		
			
				|  |  | +                    studentInstrumentDao.update(studentMaintenance);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (amount.doubleValue() > 0) {
 | 
	
	
		
			
				|  | @@ -2047,14 +2050,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //退乐保费用
 | 
	
		
			
				|  |  |          if (maintenanceFee != null) {
 | 
	
		
			
				|  |  | +            StudentInstrument studentMaintenance = studentInstrumentDao.getStudentMaintenance(userId, musicGroupId);
 | 
	
		
			
				|  |  |              if (maintenanceFee.compareTo(BigDecimal.ZERO) > 0) {
 | 
	
		
			
				|  |  | -                int maintenanceNum = studentInstrumentDao.getStudentMaintenanceNum(userId);
 | 
	
		
			
				|  |  | -                if (maintenanceNum <= 0) {
 | 
	
		
			
				|  |  | +                if (studentMaintenance == null) {
 | 
	
		
			
				|  |  |                      throw new BizException("学生没有有效期内的乐保,不能退乐保费用");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              amount = amount.add(maintenanceFee);
 | 
	
		
			
				|  |  | -            studentInstrumentDao.quitMaintenance(userId);
 | 
	
		
			
				|  |  | +            if (studentMaintenance != null) {
 | 
	
		
			
				|  |  | +                studentMaintenance.setDelFlag(1);
 | 
	
		
			
				|  |  | +                studentInstrumentDao.update(studentMaintenance);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (amount.doubleValue() > 0) {
 |