|
|
|
@ -315,7 +315,9 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
if ((reservedCount + reservationNowVO.getAppointmentPersonList().size()) > timeInfo.getReserveCount()) { |
|
|
|
|
return ServerResponse.createByError("预约失败,预约人数已满"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (reservationNowVO.getVisitTypes()!=null && !reservationNowVO.getVisitTypes().equals("")){ |
|
|
|
|
reservationNowVO.setVisitTypes(reverseAndSort(reservationNowVO.getVisitTypes())); |
|
|
|
|
} |
|
|
|
|
// 4. 时间有效性检查
|
|
|
|
|
if (DateUtil.isToday(reservationNowVO.getAppointmentDate())) { |
|
|
|
|
if (DateUtil.isAfterEndTime(reservationNowVO.getEndTime())) { |
|
|
|
@ -367,7 +369,29 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
result.put("documentsId", appointmentFormVO.getId() + ""); |
|
|
|
|
return ServerResponse.createBySuccess(msg, result); |
|
|
|
|
} |
|
|
|
|
public static String reverseAndSort(String input) { |
|
|
|
|
// 按逗号分割字符串
|
|
|
|
|
String[] parts = input.split(","); |
|
|
|
|
int[] reversedNumbers = new int[parts.length]; |
|
|
|
|
|
|
|
|
|
// 反转每个数字并存储到数组中
|
|
|
|
|
for (int i = 0; i < parts.length; i++) { |
|
|
|
|
reversedNumbers[i] = Integer.parseInt(new StringBuilder(parts[i]).reverse().toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 对反转后的数字进行排序
|
|
|
|
|
Arrays.sort(reversedNumbers); |
|
|
|
|
|
|
|
|
|
// 构建最终结果字符串
|
|
|
|
|
StringBuilder result = new StringBuilder(); |
|
|
|
|
for (int i = 0; i < reversedNumbers.length; i++) { |
|
|
|
|
result.append(reversedNumbers[i]); |
|
|
|
|
if (i < reversedNumbers.length - 1) { |
|
|
|
|
result.append(","); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result.toString(); |
|
|
|
|
} |
|
|
|
|
// 辅助方法定义在同一个类中
|
|
|
|
|
private AppointmentFormVO createAppointmentForm(ReservationNowVO vo) { |
|
|
|
|
AppointmentFormVO form = new AppointmentFormVO(); |
|
|
|
@ -729,6 +753,12 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
if (row == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Cell CellDocuments = row.getCell(2); |
|
|
|
|
if (CellDocuments == null || String.valueOf(CellDocuments).equals("")) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,证件类型为空。请修改后重新导入。"); |
|
|
|
|
errList.add("第" + (i + 1) + "行,证件类型为空。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Cell idCardCell = row.getCell(3); |
|
|
|
|
if (idCardCell == null || idCardCell.getCellType() == CellType.BLANK) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,证件号为空。请修改后重新导入。"); |
|
|
|
@ -741,13 +771,15 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
errList.add("第" + (i + 1) + "行,证件号重复。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (String.valueOf(CellDocuments).equals("身份证")) { |
|
|
|
|
if (!isValidIdCard(idCard)) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,证件号错误。请修改后重新导入。"); |
|
|
|
|
errList.add("第" + (i + 1) + "行,证件号错误。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Cell phoneCell = row.getCell(1); |
|
|
|
|
if (phoneCell == null || idCardCell.getCellType() == CellType.BLANK) { |
|
|
|
|
if (phoneCell == null || phoneCell.getCellType() == CellType.BLANK) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,手机号为空。请修改后重新导入。"); |
|
|
|
|
errList.add("第" + (i + 1) + "行,手机号为空。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
@ -757,17 +789,11 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Cell nameCell = row.getCell(0); |
|
|
|
|
if (nameCell ==null || String.valueOf(nameCell).equals("") || idCardCell.getCellType() == CellType.BLANK) { |
|
|
|
|
if (nameCell == null || String.valueOf(nameCell).equals("")) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,姓名为空。请修改后重新导入。"); |
|
|
|
|
errList.add("第" + (i + 1) + "行,姓名为空。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Cell CellDocuments = row.getCell(2); |
|
|
|
|
if (CellDocuments == null || String.valueOf(CellDocuments).equals("") || idCardCell.getCellType() == CellType.BLANK) { |
|
|
|
|
System.out.println("第" + (i + 1) + "行,证件类型为空。请修改后重新导入。"); |
|
|
|
|
errList.add("第" + (i + 1) + "行,证件类型为空。请修改后重新导入。"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
idCardSet.add(idCard); |
|
|
|
|
AppointmentPersonVO appointmentPerson = new AppointmentPersonVO(); |
|
|
|
|
appointmentPerson.setName(row.getCell(0).getStringCellValue().trim()); |
|
|
|
|