|
|
|
@ -286,10 +286,16 @@ 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(), reservationNowVO.getAppointmentPersonList(), reservationNowVO.getAppointmentDate()) > 0) { |
|
|
|
|
if (ybsjyAppointmentSettingMapper.getReservationInformation(reservationNowVO.getAppointmentTimeInfoId(), newAppointmentPersonVOList, reservationNowVO.getAppointmentDate()) > 0) { |
|
|
|
|
return ServerResponse.createByError("预约失败,预约单中有人已预约。"); |
|
|
|
|
} |
|
|
|
|
//插入预约单
|
|
|
|
@ -332,68 +338,98 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti |
|
|
|
|
synchronousDataVO.setOrganCode(organCode); |
|
|
|
|
synchronousDataVO.setExternalId(reservationNowVO.getExternalId()); |
|
|
|
|
synchronousDataVOList.add(synchronousDataVO); |
|
|
|
|
//
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map.put("startTime", item.getAppointmentDate() + " " + reservationNowVO.getStartTime() + ":00"); |
|
|
|
|
map.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
String responseString = HttpUtil.sendPost(turnstileUrl + addAccessRight, map); |
|
|
|
|
//记录访问日志
|
|
|
|
|
JSONObject accessRightResponseJson = JSONObject.parseObject(responseString); |
|
|
|
|
if (accessRightResponseJson.get("code").equals("500")) { |
|
|
|
|
if (item.getDocumentsType() == 5502) { |
|
|
|
|
Long identificationCode=IdProduceUtil.ordinaryCreate().nextId(); |
|
|
|
|
System.out.println(identificationCode+"--———————————————————————————————————————————————————————————————————————————————————————————————"); |
|
|
|
|
item.setIdentificationCode(identificationCode.toString()); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("idCard", identificationCode); |
|
|
|
|
map.put("startTime", item.getAppointmentDate() + " " + reservationNowVO.getStartTime() + ":00"); |
|
|
|
|
map.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
String responseString = HttpUtil.sendPost(turnstileUrl + addAccessRight, map); |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity addAccessRightAppointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + addAccessRight); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestParams(map.toString()); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setResponseBody(responseString); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setState(accessRightResponseJson.get("code").toString()); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(addAccessRightAppointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(accessRightResponseJson.get("msg")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//添加访客
|
|
|
|
|
// Map<String,Object> map1= new HashMap<>();
|
|
|
|
|
// map1.put("idCard",item.getDocumentsNumber());
|
|
|
|
|
// map1.put("startTime",item.getAppointmentDate()+" " +reservationNowVO.getStartTime()+":00");
|
|
|
|
|
// map1.put("endTime",item.getAppointmentDate()+" " +reservationNowVO.getEndTime()+":00");
|
|
|
|
|
// String addVisitorResponseString = HttpUtil.sendPost(turnstileUrl+addVisitor,map1);
|
|
|
|
|
// JSONObject addVisitorResponseJson = JSONObject.parseObject(addVisitorResponseString);
|
|
|
|
|
// //记录访问日志
|
|
|
|
|
// AppointmentRequestTurnstileLogEntity VisitorResponseJsonAppointmentRequestTurnstileLogEntity=new AppointmentRequestTurnstileLogEntity();
|
|
|
|
|
// VisitorResponseJsonAppointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl+addVisitor);
|
|
|
|
|
// VisitorResponseJsonAppointmentRequestTurnstileLogEntity.setRequestParams(map1.toString());
|
|
|
|
|
// VisitorResponseJsonAppointmentRequestTurnstileLogEntity.setResponseBody(addVisitorResponseString);
|
|
|
|
|
// VisitorResponseJsonAppointmentRequestTurnstileLogEntity.setState(addVisitorResponseJson.get("code").toString());
|
|
|
|
|
// VisitorResponseJsonAppointmentRequestTurnstileLogEntity.setType("post");
|
|
|
|
|
// ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(VisitorResponseJsonAppointmentRequestTurnstileLogEntity);
|
|
|
|
|
//
|
|
|
|
|
//获取二维码信息
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map2.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
|
|
|
|
|
String updateQRCodevResponseString = HttpUtil.sendPost(turnstileUrl + updateQRCodev, map2); |
|
|
|
|
JSONObject json = JSONObject.parseObject(updateQRCodevResponseString); |
|
|
|
|
if (json.get("code").equals("500")) { |
|
|
|
|
JSONObject accessRightResponseJson = JSONObject.parseObject(responseString); |
|
|
|
|
if (accessRightResponseJson.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity addAccessRightAppointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + addAccessRight); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestParams(map.toString()); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setResponseBody(responseString); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setState(accessRightResponseJson.get("code").toString()); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(addAccessRightAppointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(accessRightResponseJson.get("msg")); |
|
|
|
|
} |
|
|
|
|
//获取二维码信息
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put("idCard", identificationCode); |
|
|
|
|
map2.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
|
|
|
|
|
String updateQRCodevResponseString = HttpUtil.sendPost(turnstileUrl + updateQRCodev, map2); |
|
|
|
|
JSONObject json = JSONObject.parseObject(updateQRCodevResponseString); |
|
|
|
|
if (json.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + updateQRCodev); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestParams(map2.toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setResponseBody(updateQRCodevResponseString); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setState(json.get("code").toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setType("post"); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(json.get("msg")); |
|
|
|
|
} |
|
|
|
|
JSONObject json1 = JSONObject.parseObject(json.get("data").toString()); |
|
|
|
|
|
|
|
|
|
item.setQrContent(json1.get("二维码信息").toString()); |
|
|
|
|
} else { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map.put("startTime", item.getAppointmentDate() + " " + reservationNowVO.getStartTime() + ":00"); |
|
|
|
|
map.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
String responseString = HttpUtil.sendPost(turnstileUrl + addAccessRight, map); |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + updateQRCodev); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestParams(map2.toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setResponseBody(updateQRCodevResponseString); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setState(json.get("code").toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setType("post"); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(json.get("msg")); |
|
|
|
|
JSONObject accessRightResponseJson = JSONObject.parseObject(responseString); |
|
|
|
|
if (accessRightResponseJson.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity addAccessRightAppointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + addAccessRight); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setRequestParams(map.toString()); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setResponseBody(responseString); |
|
|
|
|
addAccessRightAppointmentRequestTurnstileLogEntity.setState(accessRightResponseJson.get("code").toString()); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(addAccessRightAppointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(accessRightResponseJson.get("msg")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取二维码信息
|
|
|
|
|
Map<String, Object> map2 = new HashMap<>(); |
|
|
|
|
map2.put("idCard", item.getDocumentsNumber()); |
|
|
|
|
map2.put("endTime", item.getAppointmentDate() + " " + reservationNowVO.getEndTime() + ":00"); |
|
|
|
|
|
|
|
|
|
String updateQRCodevResponseString = HttpUtil.sendPost(turnstileUrl + updateQRCodev, map2); |
|
|
|
|
JSONObject json = JSONObject.parseObject(updateQRCodevResponseString); |
|
|
|
|
if (json.get("code").equals("500")) { |
|
|
|
|
//记录访问日志
|
|
|
|
|
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity(); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestUrl(turnstileUrl + updateQRCodev); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setRequestParams(map2.toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setResponseBody(updateQRCodevResponseString); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setState(json.get("code").toString()); |
|
|
|
|
appointmentRequestTurnstileLogEntity.setType("post"); |
|
|
|
|
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity); |
|
|
|
|
return ServerResponse.createByError(json.get("msg")); |
|
|
|
|
} |
|
|
|
|
JSONObject json1 = JSONObject.parseObject(json.get("data").toString()); |
|
|
|
|
|
|
|
|
|
item.setQrContent(json1.get("二维码信息").toString()); |
|
|
|
|
} |
|
|
|
|
JSONObject json1 = JSONObject.parseObject(json.get("data").toString()); |
|
|
|
|
|
|
|
|
|
item.setQrContent(json1.get("二维码信息").toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
i.setIdentificationCode(documentsNumber); |
|
|
|
|
i.setDocumentsNumber(i.getDocumentsNumber()); |
|
|
|
|
} |
|
|
|
|
if (!i.getPhone().isEmpty()) { |
|
|
|
|