1.修改预约&核销逻辑

l
862857010@qq.com 2 years ago
parent 287b3b1ccc
commit 0ad9263fc8
  1. 2
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.xml
  2. 5
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentSettingMapper.xml
  3. 10
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppointmentPersonVO.java
  4. 148
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentSettingServiceImpl.java

@ -289,7 +289,7 @@
select id,name,phone,documents_type,documents_number,reservation_code,appointment_date,appointment_documents_id,appointment_time_info_id,write_off,qr_content,write_off_date,expired_state,reservation_person
from ybsj_appointment_people_info
where appointment_date = #{date}
and documents_number = #{idCard}
and (documents_number = #{idCard} or identification_code= #{idCard} )
and write_off = 0
</select>
<select id="getWrittenOffAppointmentData" resultType="java.util.Map">

@ -33,12 +33,12 @@
documents_number, reservation_code,
appointment_documents_id, appointment_time_info_id,
qr_content,
appointment_date,reservation_person
appointment_date,reservation_person,identification_code
)
VALUES
<foreach item="item" collection="list" separator=",">
(#{item.id}, #{item.name}, #{item.phone}, #{item.documentsType}, #{item.documentsNumber}, #{item.reservationCode},
#{item.appointmentDocumentsId}, #{item.appointmentTimeInfoId}, #{item.qrContent}, #{item.appointmentDate},#{item.reservationPerson})
#{item.appointmentDocumentsId}, #{item.appointmentTimeInfoId}, #{item.qrContent}, #{item.appointmentDate},#{item.reservationPerson},#{item.identificationCode})
</foreach>
</insert>
@ -180,6 +180,7 @@
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.documentsNumber}
</foreach>
</select>
<select id="getNotWrittenOffAppointmentDocumentsCount" resultType="java.lang.Integer">
select count(*) from ybsj_appointment_documents_info where union_id=#{unionId} and appointment_documents_write_off=0

@ -41,6 +41,16 @@ public class AppointmentPersonVO {
private String endTime;
private String identificationCode;
public String getIdentificationCode() {
return identificationCode;
}
public void setIdentificationCode(String identificationCode) {
this.identificationCode = identificationCode;
}
public String getDocumentsTypeName() {
return documentsTypeName;
}

@ -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()) {

Loading…
Cancel
Save