chenfeng 6 months ago
parent a3c7713d8b
commit f683087111
  1. 31
      src/main/java/com/cjy/back/ybsjAppointment/controller/YbsjyAppointmentRecordController.java
  2. 56
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentSettingServiceImpl.java
  3. 52
      src/main/java/com/cjy/back/ybsjHandset/dao/YbsjHandsetMapper.xml

@ -20,10 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author liangjiawei
@ -53,7 +50,9 @@ public class YbsjyAppointmentRecordController {
if (user == null) {
return ServerResponse.createByError("请重新登陆");
}
if (getAppointmentRecordVO.getVisitTypes()!=null && !getAppointmentRecordVO.getVisitTypes().equals("")){
getAppointmentRecordVO.setVisitTypes(reverseAndSort(getAppointmentRecordVO.getVisitTypes()));
}
return ybsjyAppointmentRecordService.getAppointmentRecord(getAppointmentRecordVO);
}
@ -172,5 +171,27 @@ public class YbsjyAppointmentRecordController {
resultMap.put("code", 0);
return ServerResponse.createBySuccess(resultMap);
}
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();
}
}

@ -270,7 +270,7 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
map.put("timeList", list);
map.put("canReserveDayNumber", ybsjyAppointmentSettingMapper.getAppointmentSettingByScenicId(scenicId, bookingCategory));
if (list.size()>0){
if (list.size() > 0) {
map.put("visitTypesList", ybsjyAppointmentSettingMapper.getVisitTypes(list.get(0).getVisitTypes()));
}
@ -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();
@ -556,7 +580,7 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
if (appointmentPersonVO.getDocumentsType() == 5501) {
appointmentPeopleInfo.setEncryptionDocumentsNumber(Encryption.decrypt(appointmentPersonVO.getDocumentsNumber(), rule));
appointmentPeopleInfo.setDocumentsNumber(Encryption.decrypt(appointmentPersonVO.getDocumentsNumber(), rule));
}else {
} else {
appointmentPeopleInfo.setEncryptionDocumentsNumber(appointmentPersonVO.getDocumentsNumber());
appointmentPeopleInfo.setDocumentsNumber(appointmentPersonVO.getDocumentsNumber());
}
@ -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 (!isValidIdCard(idCard)) {
System.out.println("第" + (i + 1) + "行,证件号错误。请修改后重新导入。");
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());

@ -6,35 +6,31 @@
<select id="getPeopleCounting" resultType="map">
SELECT
(a.totalTicketCapacity + b.totalTicketCapacity) AS totalTicketCapacity,
(a.totalBookingCapacity + b.totalBookingCapacity) AS totalBookingCapacity
SUM(
CASE
WHEN ( cm.appointment_type_id = 5701 AND nmd.write_off = 1 )
OR ( cm.appointment_type_id != 5701 AND cm.appointment_documents_write_off = 1 ) THEN
IFNULL( cm.appointment_count, 1 ) ELSE 0
END
) AS totalTicketCapacity,
SUM(
CASE
WHEN ( cm.appointment_type_id = 5701 AND nmd.write_off IN ( 0, 1 ) )
OR ( cm.appointment_type_id != 5701 AND cm.appointment_documents_write_off IN ( 0, 1 ) ) THEN
IFNULL( cm.appointment_count, 1 ) ELSE 0
END
) AS totalBookingCapacity
FROM
(
SELECT
SUM(CASE WHEN nmd.write_off = 1 THEN 1 ELSE 0 END) AS totalTicketCapacity,
SUM(CASE WHEN nmd.write_off = 0 THEN 1 ELSE 0 END) AS totalBookingCapacity
FROM
ybsj_appointment_people_info nmd
JOIN
ybsj_appointment_documents_info cm ON nmd.appointment_documents_id = cm.id
WHERE
cm.appointment_date = CURDATE()
AND cm.appointment_type_id = 5701
AND cm.scenic_id = #{scenicId}
AND cm.del_flag = 0
) AS a,
(
SELECT
SUM(CASE WHEN cm.appointment_documents_write_off = 1 THEN 1 ELSE 0 END) AS totalTicketCapacity,
SUM(CASE WHEN cm.appointment_documents_write_off = 0 THEN 1 ELSE 0 END) AS totalBookingCapacity
FROM
ybsj_appointment_documents_info cm
WHERE
cm.appointment_date = CURDATE()
AND cm.appointment_type_id != 5701
AND cm.scenic_id = #{scenicId}
AND cm.del_flag = 0
) AS b;
ybsj_appointment_documents_info cm
LEFT JOIN ybsj_appointment_people_info nmd ON cm.id = nmd.appointment_documents_id
AND cm.appointment_type_id = 5701
WHERE
cm.appointment_date = CURDATE( )
AND cm.scenic_id = #{scenicId}
AND cm.del_flag = 0
AND ( ( cm.appointment_type_id = 5701 AND nmd.id IS NOT NULL ) OR cm.appointment_type_id != 5701 );
</select>
<select id="getHaveTicketsCheckedPage" parameterType="map" resultType="map">

Loading…
Cancel
Save