|
|
@ -38,6 +38,7 @@ import com.epmet.constant.PartyServiceCenterConstant; |
|
|
|
import com.epmet.dao.IcMatterAppointmentRecordDao; |
|
|
|
import com.epmet.dao.IcPartyServiceCenterDao; |
|
|
|
import com.epmet.dto.IcPartyServiceCenterDTO; |
|
|
|
import com.epmet.dto.TimeDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.PartyServiceCenterListResultDTO; |
|
|
|
import com.epmet.entity.IcMatterAppointmentRecordEntity; |
|
|
@ -51,10 +52,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN; |
|
|
|
|
|
|
@ -278,4 +279,67 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public List<TimeDTO> getTimeList(String start,String end,Integer interval){ |
|
|
|
List<TimeDTO> result = new ArrayList<>(); |
|
|
|
List<String> intervalTimeList = getIntervalTimeList(start, end, interval); |
|
|
|
Integer sort = NumConstant.ONE; |
|
|
|
for (int i = NumConstant.ZERO; i < intervalTimeList.size(); i++) { |
|
|
|
if (i + NumConstant.ONE >= intervalTimeList.size()){ |
|
|
|
return result; |
|
|
|
} |
|
|
|
TimeDTO timeDTO = new TimeDTO(); |
|
|
|
timeDTO.setTime(intervalTimeList.get(i) + "-" + intervalTimeList.get(i + NumConstant.ONE)); |
|
|
|
timeDTO.setTimeId(String.valueOf(sort++)); |
|
|
|
result.add(timeDTO); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 获取固定时间段之间固定时间的集合 |
|
|
|
* @param start 开始时间 |
|
|
|
* @param end 结束时间 |
|
|
|
* @param interval 间隔时间 |
|
|
|
* @author zxc |
|
|
|
* @date 2021/11/22 3:48 下午 |
|
|
|
*/ |
|
|
|
public List<String> getIntervalTimeList(String start,String end,Integer interval) { |
|
|
|
Date startDate = convertStringToDate("HH:mm", start); |
|
|
|
Date endDate = convertStringToDate("HH:mm", end); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
while (startDate.getTime() <= endDate.getTime()) { |
|
|
|
list.add(convertDateToString("HH:mm", startDate)); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(startDate); |
|
|
|
calendar.add(Calendar.MINUTE, interval); |
|
|
|
if (calendar.getTime().getTime() > endDate.getTime()) { |
|
|
|
if (!startDate.equals(endDate)) { |
|
|
|
list.add(convertDateToString("HH:mm", endDate)); |
|
|
|
} |
|
|
|
startDate = calendar.getTime(); |
|
|
|
} else { |
|
|
|
startDate = calendar.getTime(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Date convertStringToDate(String format, String dateStr) { |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); |
|
|
|
try { |
|
|
|
Date date = simpleDateFormat.parse(dateStr); |
|
|
|
return date; |
|
|
|
} catch (ParseException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public String convertDateToString(String format, Date date) { |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); |
|
|
|
return simpleDateFormat.format(date); |
|
|
|
} |
|
|
|
|
|
|
|
} |