|  |  | @ -41,7 +41,6 @@ import com.epmet.constant.PartyServiceCenterConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcMatterAppointmentRecordDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcPartyServiceCenterDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.IcPartyServiceCenterDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.RegisterRelationDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.TimeDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.*; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.*; | 
			
		
	
	
		
			
				
					|  |  | @ -63,6 +62,7 @@ import java.time.LocalDate; | 
			
		
	
		
			
				
					|  |  |  | import java.time.LocalDateTime; | 
			
		
	
		
			
				
					|  |  |  | import java.time.format.DateTimeFormatter; | 
			
		
	
		
			
				
					|  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.atomic.AtomicBoolean; | 
			
		
	
		
			
				
					|  |  |  | import java.util.concurrent.atomic.AtomicReference; | 
			
		
	
		
			
				
					|  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -130,8 +130,53 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |     public void delete(String[] ids) { | 
			
		
	
		
			
				
					|  |  |  |         // 逻辑删除(@TableLogic 注解)
 | 
			
		
	
		
			
				
					|  |  |  |         baseDao.deleteBatchIds(Arrays.asList(ids)); | 
			
		
	
		
			
				
					|  |  |  |         List<String> centerIds = Arrays.asList(ids); | 
			
		
	
		
			
				
					|  |  |  |         List<String> matterIds = baseDao.selectMatterByIds(centerIds); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isEmpty(matterIds)){ | 
			
		
	
		
			
				
					|  |  |  |             baseDao.deleteBatchIds(centerIds); | 
			
		
	
		
			
				
					|  |  |  |         }else { | 
			
		
	
		
			
				
					|  |  |  |             List<DelPartyServiceCenterResultDTO> appointmentList = baseDao.selectAppointmentList(matterIds); | 
			
		
	
		
			
				
					|  |  |  |             if (CollectionUtils.isEmpty(appointmentList)){ | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.deleteBatchIds(centerIds); | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.delMatters(centerIds); | 
			
		
	
		
			
				
					|  |  |  |             }else { | 
			
		
	
		
			
				
					|  |  |  |                 List<String> names = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |                 Map<String, List<DelPartyServiceCenterResultDTO>> groupByMatterId = appointmentList.stream().collect(Collectors.groupingBy(DelPartyServiceCenterResultDTO::getMatterId)); | 
			
		
	
		
			
				
					|  |  |  |                 groupByMatterId.forEach((k,v) -> { | 
			
		
	
		
			
				
					|  |  |  |                     if (getMatterAppointmentList(v)){ | 
			
		
	
		
			
				
					|  |  |  |                         names.add(v.get(0).getCenterName()); | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |                 if (CollectionUtils.isNotEmpty(names)){ | 
			
		
	
		
			
				
					|  |  |  |                     throw new EpmetException(names.stream().collect(Collectors.joining("、")) + "存在未来时间的预约事项,不允许删除"); | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.deleteBatchIds(centerIds); | 
			
		
	
		
			
				
					|  |  |  |                 baseDao.delMatters(centerIds); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     public boolean getMatterAppointmentList(List<DelPartyServiceCenterResultDTO> list){ | 
			
		
	
		
			
				
					|  |  |  |         AtomicBoolean result = new AtomicBoolean(false); | 
			
		
	
		
			
				
					|  |  |  |         if (CollectionUtils.isNotEmpty(list)){ | 
			
		
	
		
			
				
					|  |  |  |             list.forEach(l -> { | 
			
		
	
		
			
				
					|  |  |  |                 int[] timeIds = Arrays.asList(l.getTimeId().split(",")).stream().mapToInt(m -> Integer.parseInt(m)).toArray(); | 
			
		
	
		
			
				
					|  |  |  |                 List<String> intervalTimeList = getIntervalTimeList(l.getStartTime(), l.getEndTime(), 30); | 
			
		
	
		
			
				
					|  |  |  |                 for (int timeId : timeIds) { | 
			
		
	
		
			
				
					|  |  |  |                     for (int i1 = 0; i1 < intervalTimeList.size(); i1++) { | 
			
		
	
		
			
				
					|  |  |  |                         if (timeId == i1 + 1){ | 
			
		
	
		
			
				
					|  |  |  |                             String date = l.getDate() + " " + intervalTimeList.get(i1) + ":00"; | 
			
		
	
		
			
				
					|  |  |  |                             if (DateUtils.parse(date,DateUtils.DATE_TIME_PATTERN).after(new Date())){ | 
			
		
	
		
			
				
					|  |  |  |                                 result.set(true); | 
			
		
	
		
			
				
					|  |  |  |                                 return; | 
			
		
	
		
			
				
					|  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return result.get(); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
	
		
			
				
					|  |  | 
 |