|
|
|
@ -249,6 +249,19 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public ServerResponse reservationNow(ReservationNowVO reservationNowVO) { |
|
|
|
|
List<AppointmentPersonVO> newAppointmentPersonVOList =new ArrayList<>(); |
|
|
|
|
newAppointmentPersonVOList.addAll( reservationNowVO.getAppointmentPersonList()); |
|
|
|
|
newAppointmentPersonVOList.stream().forEach(i -> { |
|
|
|
|
if(i.getDocumentsType()==5501){ |
|
|
|
|
String documentsNumber = Encryption.encrypt(i.getDocumentsNumber(), rule); |
|
|
|
|
i.setDocumentsNumber(documentsNumber); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
//这里还需要判断一下预约人中是否有过预约的
|
|
|
|
|
if (ybsjyAppointmentSettingMapper.getReservationInformation(reservationNowVO.getAppointmentTimeInfoId(), newAppointmentPersonVOList, reservationNowVO.getAppointmentDate()) > 0) { |
|
|
|
|
return ServerResponse.createByError("预约失败,预约单中有人已预约。"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 先判断是否有未核销的预约单 如果有未核销的订单则提示请先取消或者等待 预约过期
|
|
|
|
|
if (ybsjyAppointmentSettingMapper.getNotWrittenOffAppointmentDocumentsCount(reservationNowVO.getAppointmentDate(), reservationNowVO.getUnionId()) > 0) { |
|
|
|
|
return ServerResponse.createByError("预约失败,有待核销的预约单。请先取消订单!"); |
|
|
|
@ -286,18 +299,7 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
appointmentFormVO.setCreateBy(reservationNowVO.getUnionId()); |
|
|
|
|
appointmentFormVO.setScenicId(reservationNowVO.getScenicId()); |
|
|
|
|
} |
|
|
|
|
List<AppointmentPersonVO> newAppointmentPersonVOList= new ArrayList<>(); |
|
|
|
|
reservationNowVO.getAppointmentPersonList().stream().forEach(i -> { |
|
|
|
|
if (i.getDocumentsType() == 5501) { |
|
|
|
|
String documentsNumber = Encryption.encrypt(i.getDocumentsNumber(), rule); |
|
|
|
|
i.setDocumentsNumber(documentsNumber); |
|
|
|
|
} |
|
|
|
|
newAppointmentPersonVOList.add(i); |
|
|
|
|
}); |
|
|
|
|
//这里还需要判断一下预约人中是否有过预约的
|
|
|
|
|
if (ybsjyAppointmentSettingMapper.getReservationInformation(reservationNowVO.getAppointmentTimeInfoId(), newAppointmentPersonVOList, reservationNowVO.getAppointmentDate()) > 0) { |
|
|
|
|
return ServerResponse.createByError("预约失败,预约单中有人已预约。"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//插入预约单
|
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentDocumentsInfo(appointmentFormVO); |
|
|
|
|
//插入预约人信息表
|
|
|
|
@ -324,12 +326,9 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
synchronousDataVO.setCertificateType(item.getDocumentsType() + ""); |
|
|
|
|
if (item.getDocumentsType() == 5501) { |
|
|
|
|
String documentsNumber = Encryption.encrypt(item.getDocumentsNumber(), rule); |
|
|
|
|
synchronousDataVO.setDocumentsNumber(documentsNumber); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
synchronousDataVO.setDocumentsNumber(item.getDocumentsNumber()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
synchronousDataVO.setState("0"); |
|
|
|
|
synchronousDataVO.setDataSources("2"); |
|
|
|
@ -339,8 +338,7 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
synchronousDataVO.setExternalId(reservationNowVO.getExternalId()); |
|
|
|
|
synchronousDataVOList.add(synchronousDataVO); |
|
|
|
|
if (item.getDocumentsType() == 5502) { |
|
|
|
|
Long identificationCode=IdProduceUtil.ordinaryCreate().nextId(); |
|
|
|
|
System.out.println(identificationCode+"--———————————————————————————————————————————————————————————————————————————————————————————————"); |
|
|
|
|
Long identificationCode = IdProduceUtil.ordinaryCreate().nextId(); |
|
|
|
|
item.setIdentificationCode(identificationCode.toString()); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("idCard", identificationCode); |
|
|
|
@ -382,12 +380,14 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
item.setQrContent(json1.get("二维码信息").toString()); |
|
|
|
|
} else { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map.put("idCard", Encryption.decrypt(item.getDocumentsNumber(), rule)); |
|
|
|
|
map.put("startTime", item.getAppointmentDate() + " " + reservationNowVO.getStartTime() + ":00"); |
|
|
|
|
map.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
String responseString = HttpUtil.sendPost(turnstileUrl + addAccessRight, map); |
|
|
|
|
String responseString= HttpUtil.sendPost(turnstileUrl + addAccessRight, map); |
|
|
|
|
System.out.println(responseString); |
|
|
|
|
//记录访问日志
|
|
|
|
|
JSONObject accessRightResponseJson = JSONObject.parseObject(responseString); |
|
|
|
|
|
|
|
|
|
if (accessRightResponseJson.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity addAccessRightAppointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
@ -401,10 +401,11 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
|
|
|
|
|
//获取二维码信息
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map2.put("idCard",Encryption.decrypt(item.getDocumentsNumber(), rule)); |
|
|
|
|
map2.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
|
|
|
|
|
String updateQRCodevResponseString = HttpUtil.sendPost(turnstileUrl + updateQRCodev, map2); |
|
|
|
|
System.out.println(updateQRCodevResponseString); |
|
|
|
|
JSONObject json = JSONObject.parseObject(updateQRCodevResponseString); |
|
|
|
|
if (json.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
@ -425,10 +426,9 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
|
|
|
|
|
reservationNowVO.getAppointmentPersonList().stream().forEach(i -> { |
|
|
|
|
if (i.getDocumentsType() == 5501) { |
|
|
|
|
String documentsNumber = Encryption.encrypt(i.getDocumentsNumber(), rule); |
|
|
|
|
i.setDocumentsNumber(documentsNumber); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
String documentsNumber = Encryption.encrypt(i.getIdentificationCode().toString(), rule); |
|
|
|
|
String documentsNumber = Encryption.encrypt(i.getIdentificationCode(), rule); |
|
|
|
|
i.setIdentificationCode(documentsNumber); |
|
|
|
|
i.setDocumentsNumber(i.getDocumentsNumber()); |
|
|
|
|
} |
|
|
|
|