1.定时任务 推送取消数据

2.手动取消 推送取消数据
3. 定时处理核销数据 需要推送核销数据
main
862857010@qq.com 2 years ago
parent a889c712b8
commit c51c45b678
  1. 12
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.java
  2. 15
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentRecordMapper.xml
  3. 3
      src/main/java/com/cjy/back/ybsjAppointment/dao/YbsjyAppointmentSettingMapper.xml
  4. 15
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/AppletsAppointmentListVO.java
  5. 26
      src/main/java/com/cjy/back/ybsjAppointment/entity/vo/SynchronousWriteOffDataVO.java
  6. 3
      src/main/java/com/cjy/back/ybsjAppointment/service/YbsjyAppointmentRecordService.java
  7. 48
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentRecordImpl.java
  8. 97
      src/main/java/com/cjy/back/ybsjAppointment/service/impl/YbsjyAppointmentSettingServiceImpl.java
  9. 43
      src/main/java/com/cjy/back/ybsjAppointment/task/ExtractWriteOffRecordsTask.java
  10. 62
      src/main/java/com/cjy/back/ybsjAppointment/task/HandleExpiredAppointmentsTask.java
  11. 1
      src/main/resources/application.properties

@ -101,10 +101,10 @@ public interface YbsjyAppointmentRecordMapper {
/**
* 修改预约单状态
* @param Id
* @param id
* @return
*/
int updateDocumentsSate(Long Id);
int updateDocumentsSate(@Param("id") Long id,@Param("state") int state);
int updateDocumentsSateList(@Param("ids") List<Long> id);
@ -158,4 +158,12 @@ public interface YbsjyAppointmentRecordMapper {
*/
int updateProcessRequestFailRecord(List<AppointmentRequestTurnstileLogEntity> list);
/**
* 通过预约单获取到预约人的id
* @param id
* @return
*/
List<String> getAppointmentPeopleIdByDocumentsId(Long id);
Map<String,Object> getWriteOffStatusQuantity(Long id);
}

@ -44,7 +44,7 @@
</update>
<update id="updateDocumentsSate">
update ybsj_appointment_documents_info
set appointment_documents_write_off =1,
set appointment_documents_write_off =#{state},
update_by=NOW()
where id = #{id}
</update>
@ -299,4 +299,17 @@
state = '500'
AND frequency &lt; 3
</select>
<select id="getAppointmentPeopleIdByDocumentsId" resultType="java.lang.String">
select id from ybsj_appointment_people_info where appointment_documents_id = #{id}
</select>
<select id="getWriteOffStatusQuantity" resultType="java.util.Map">
SELECT
ifnull(SUM(CASE WHEN write_off = 0 THEN 1 ELSE 0 END), 0) as notWrittenOffCount,
ifnull(SUM(CASE WHEN write_off = 1 THEN 1 ELSE 0 END), 0) as writtenOffCount,
ifnull(SUM(CASE WHEN write_off = 3 THEN 1 ELSE 0 END), 0) as cancelCount
FROM
ybsj_appointment_people_info
WHERE
appointment_documents_id = #{id}
</select>
</mapper>

@ -146,7 +146,8 @@
SELECT t1.id AS appointmentTimeInfoId,
t1.start_time as startTime,
t1.end_time as endTime,
t1.reserve_count AS reservableQuantity
t1.reserve_count AS reservableQuantity,
t2.can_reserve_day_number as canReserveDayNumber
FROM ybsj_appointment_time_info t1
LEFT JOIN ybsj_appointment_setting t2 on t1.appointment_settings_id = t2.id and t2.state = 0
WHERE t2.scenic_id = #{scenicId}

@ -16,9 +16,10 @@ public class AppletsAppointmentListVO {
private String startTime;
private String endTime;
//已预约数量
private int reservedQuantity;
private String reservedQuantity;
//可预约数量(设置的预约总数)
private int reservableQuantity;
private int canReserveDayNumber;
public Long getAppointmentTimeInfoId() {
return appointmentTimeInfoId;
@ -44,11 +45,11 @@ public class AppletsAppointmentListVO {
this.endTime = endTime;
}
public int getReservedQuantity() {
public String getReservedQuantity() {
return reservedQuantity;
}
public void setReservedQuantity(int reservedQuantity) {
public void setReservedQuantity(String reservedQuantity) {
this.reservedQuantity = reservedQuantity;
}
@ -59,4 +60,12 @@ public class AppletsAppointmentListVO {
public void setReservableQuantity(int reservableQuantity) {
this.reservableQuantity = reservableQuantity;
}
public int getCanReserveDayNumber() {
return canReserveDayNumber;
}
public void setCanReserveDayNumber(int canReserveDayNumber) {
this.canReserveDayNumber = canReserveDayNumber;
}
}

@ -0,0 +1,26 @@
package com.cjy.back.ybsjAppointment.entity.vo;
/**
* @author liangjiawei
* @createDate 2023/8/3
*/
public class SynchronousWriteOffDataVO {
private String id;
private String date;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}

@ -83,12 +83,13 @@ public interface YbsjyAppointmentRecordService {
*/
int getNotWrittenOffCount(Long id);
Map<String,Object> getWriteOffStatusQuantity(Long id);
/**
* 修改预约单状态
* @param id
* @return
*/
int updateDocumentsSate(Long id);
int updateDocumentsSate(Long id,int state);
/**
* 获取当天已核销或者取消的数据

@ -1,11 +1,15 @@
package com.cjy.back.ybsjAppointment.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentSettingMapper;
import com.cjy.back.ybsjAppointment.entity.AppointmentRequestTurnstileLogEntity;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentDocumentsDetails;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.entity.vo.GetAppointmentRecordVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.common.PageWrapper;
import com.cjy.util.HttpUtil;
import com.cjy.util.ServerResponse;
import jxl.write.WriteException;
import org.apache.poi.hssf.usermodel.*;
@ -14,6 +18,7 @@ import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
@ -34,6 +39,12 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
@Autowired
YbsjyAppointmentRecordMapper ybsjyAppointmentRecordMapper;
@Autowired
YbsjyAppointmentSettingMapper ybsjyAppointmentSettingMapper;
@Value("${jqzhgk.synchronousCancelDataUrl}")
private String synchronousCancelDataUrl;
/**
* 查询预约记录
*
@ -95,8 +106,21 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
public ServerResponse cancelAppointment(Long id, int userId) {
//第一步修改取消单状态
ybsjyAppointmentRecordMapper.updateCancelDocuments(id, userId+"");
List<String> appointmentPeopleIds=ybsjyAppointmentRecordMapper.getAppointmentPeopleIdByDocumentsId(id);
String responseString = HttpUtil.sendPostJson(synchronousCancelDataUrl, JSONObject.toJSONString(appointmentPeopleIds));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousCancelDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(appointmentPeopleIds));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
//第二步修改预约单下人的状态
ybsjyAppointmentRecordMapper.updateAppointmentPeopleInfo(id, userId+"");
//通过单号获取到所有取消的数据id
return ServerResponse.createBySuccess("取消成功");
}
@ -112,6 +136,19 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
ybsjyAppointmentRecordMapper.updateCancelDocuments(id, unionId);
//第二步修改预约单下人的状态
ybsjyAppointmentRecordMapper.updateAppointmentPeopleInfo(id, unionId);
//通过单号获取到所有取消的数据id
List<String> appointmentPeopleIds=ybsjyAppointmentRecordMapper.getAppointmentPeopleIdByDocumentsId(id);
String responseString = HttpUtil.sendPostJson(synchronousCancelDataUrl, JSONObject.toJSONString(appointmentPeopleIds));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousCancelDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(appointmentPeopleIds));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
return ServerResponse.createBySuccess("取消成功");
}
@ -136,7 +173,7 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
public void exportReserveRecord(HttpServletRequest request, HttpServletResponse response, GetAppointmentRecordVO getAppointmentRecordVO) throws IOException, WriteException {
List<Map<String, Object>> list = ybsjyAppointmentRecordMapper.getExportReserveRecordList(getAppointmentRecordVO);
String filename = "预约记录.xls";
String filename = "预约记录.xlsx";
int pageSize = 30000;
int sheetCount = (int) Math.ceil((double) list.size() / pageSize);
@ -294,8 +331,8 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
* @return
*/
@Override
public int updateDocumentsSate(Long id) {
return ybsjyAppointmentRecordMapper.updateDocumentsSate(id);
public int updateDocumentsSate(Long id,int state) {
return ybsjyAppointmentRecordMapper.updateDocumentsSate(id,state);
}
/**
@ -316,4 +353,9 @@ public class YbsjyAppointmentRecordImpl implements YbsjyAppointmentRecordService
public int updateClearVisitorsState(List<String> ids) {
return ybsjyAppointmentRecordMapper.updateClearVisitorsState(ids);
}
@Override
public Map<String, Object> getWriteOffStatusQuantity(Long id) {
return ybsjyAppointmentRecordMapper.getWriteOffStatusQuantity(id);
}
}

@ -209,17 +209,25 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
public ServerResponse appointmentList(String date, String scenicId) {
//第一步通过景区id获取到对应的规则 通过日期及今天是周几判断是否返回
Map<String,Object> map =new HashMap();
//知道周几
int whichDay = DateUtil.getWhichDay(date);
List<AppletsAppointmentListVO> list = ybsjyAppointmentSettingMapper.appointmentList(date, scenicId, whichDay);
list.stream().forEach(item -> {
//通过时间段id统计目前预约了多少人
item.setReservedQuantity(ybsjyAppointmentSettingMapper.getAppointmentCount(item.getAppointmentTimeInfoId(), date));
item.setReservedQuantity(ybsjyAppointmentSettingMapper.getAppointmentCount(item.getAppointmentTimeInfoId(), date)+"");
});
//第二步通过通过规则id获取到时间段列表
map.put("timeList",list);
if(!list.isEmpty()){
map.put("canReserveDayNumber",list.get(0).getCanReserveDayNumber());
}else {
map.put("canReserveDayNumber",0);
}
return ServerResponse.createBySuccess(list);
return ServerResponse.createBySuccess(map);
}
/**
@ -319,40 +327,40 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
// addAccessRightAppointmentRequestTurnstileLogEntity.setState(accessRightResponseJson.get("code").toString());
// ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(addAccessRightAppointmentRequestTurnstileLogEntity);
//添加访客
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);
JSONObject json1= JSONObject.parseObject(json.get("data").toString());
//记录访问日志
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);
item.setQrContent(json1.get("二维码信息").toString());
// //添加访客
// 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);
// JSONObject json1= JSONObject.parseObject(json.get("data").toString());
//
// //记录访问日志
// 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);
// item.setQrContent(json1.get("二维码信息").toString());
});
ybsjyAppointmentSettingMapper.saveAppointmentPeopleInfo(reservationNowVO.getAppointmentPersonList());
@ -442,21 +450,26 @@ public class YbsjyAppointmentSettingServiceImpl implements YbsjyAppointmentSetti
try {
Map<String, Object> map = ybsjyAppointmentRecordMapper.getAppointmentPeopleInfo(formattedDate, idCard);
ybsjyAppointmentRecordMapper.writeOff(time, map.get("id").toString());
Map<String,Object> map1= new HashMap<>();
map1.put("id",map.get("id").toString());
map1.put("date",time);
String responseString = HttpUtil.sendPost(synchronousWriteOffDataUrl,map1);
List<SynchronousWriteOffDataVO> synchronousWriteOffDataVOS= new ArrayList<>();
SynchronousWriteOffDataVO synchronousWriteOffDataVO= new SynchronousWriteOffDataVO();
synchronousWriteOffDataVO.setId(map.get("id").toString());
synchronousWriteOffDataVO.setDate(time);
synchronousWriteOffDataVOS.add(synchronousWriteOffDataVO);
String responseString = HttpUtil.sendPostJson(synchronousWriteOffDataUrl,JSONObject.toJSONString(synchronousWriteOffDataVOS));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousWriteOffDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams(map1.toString());
appointmentRequestTurnstileLogEntity.setRequestParams(JSONObject.toJSONString(synchronousWriteOffDataVOS));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
if (ybsjyAppointmentRecordMapper.getNotWrittenOffCount((Long) map.get("appointment_documents_id")) == 0) {
ybsjyAppointmentRecordMapper.updateDocumentsSate(Long.parseLong(map.get("appointment_documents_id").toString()));
ybsjyAppointmentRecordMapper.updateDocumentsSate(Long.parseLong(map.get("appointment_documents_id").toString()),1);
}
appointmentWriteOffLogEntity.setState("200");
} catch (Exception e) {

@ -3,8 +3,11 @@ package com.cjy.back.ybsjAppointment.task;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentRecordMapper;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentSettingMapper;
import com.cjy.back.ybsjAppointment.entity.AppointmentRequestTurnstileLogEntity;
import com.cjy.back.ybsjAppointment.entity.AppointmentWriteOffLogEntity;
import com.cjy.back.ybsjAppointment.entity.vo.ExtractRecordsDataVO;
import com.cjy.back.ybsjAppointment.entity.vo.SynchronousWriteOffDataVO;
import com.cjy.util.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -30,6 +33,12 @@ public class ExtractWriteOffRecordsTask {
@Autowired
YbsjyAppointmentRecordMapper ybsjyAppointmentRecordMapper;
@Autowired
YbsjyAppointmentSettingMapper ybsjyAppointmentSettingMapper;
@Value("${jqzhgk.synchronousWriteOffDataUrl}")
private String synchronousWriteOffDataUrl;
@Scheduled(cron = "0 0/50 * * * ?")
// @Scheduled(cron = "0 0/1 * * * ?")
/**
@ -42,7 +51,7 @@ public class ExtractWriteOffRecordsTask {
JSONObject extractRecordsJson = JSONObject.parseObject(extractRecordsString);
JSONArray extractRecordsDataJson = extractRecordsJson.getJSONArray("data");
List<ExtractRecordsDataVO> list = extractRecordsDataJson.toJavaList(ExtractRecordsDataVO.class);
List<SynchronousWriteOffDataVO> synchronousWriteOffDataVOS= new ArrayList<>();
List<AppointmentWriteOffLogEntity> appointmentWriteOffLogEntityList = new ArrayList<>();
List<Long> ids = new ArrayList<>();
@ -72,6 +81,26 @@ public class ExtractWriteOffRecordsTask {
if (map != null) {
ybsjyAppointmentRecordMapper.writeOff(time, map.get("id").toString());
SynchronousWriteOffDataVO synchronousWriteOffDataVO= new SynchronousWriteOffDataVO();
synchronousWriteOffDataVO.setId(map.get("id").toString());
synchronousWriteOffDataVO.setDate(time);
if(synchronousWriteOffDataVOS.size()<500){
synchronousWriteOffDataVOS.add(synchronousWriteOffDataVO);
}else {
String responseString = HttpUtil.sendPostJson(synchronousWriteOffDataUrl, JSONObject.toJSONString(synchronousWriteOffDataVOS));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousWriteOffDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(synchronousWriteOffDataVOS));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
synchronousWriteOffDataVOS.clear();
synchronousWriteOffDataVOS.add(synchronousWriteOffDataVO);
}
if (ybsjyAppointmentRecordMapper.getNotWrittenOffCount((Long) map.get("appointment_documents_id")) == 0) {
if (ids.size() < 200) {
ids.add(Long.parseLong(map.get("appointment_documents_id").toString()));
@ -107,6 +136,18 @@ public class ExtractWriteOffRecordsTask {
if (!ids.isEmpty()) {
ybsjyAppointmentRecordMapper.updateDocumentsSateList(ids);
}
if(!synchronousWriteOffDataVOS.isEmpty()){
String responseString = HttpUtil.sendPostJson(synchronousWriteOffDataUrl, JSONObject.toJSONString(synchronousWriteOffDataVOS));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousWriteOffDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(synchronousWriteOffDataVOS));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
}
}

@ -1,13 +1,20 @@
package com.cjy.back.ybsjAppointment.task;
import com.alibaba.fastjson.JSONObject;
import com.cjy.back.ybsjAppointment.dao.YbsjyAppointmentSettingMapper;
import com.cjy.back.ybsjAppointment.entity.AppointmentRequestTurnstileLogEntity;
import com.cjy.back.ybsjAppointment.entity.vo.AppointmentPersonVO;
import com.cjy.back.ybsjAppointment.service.YbsjyAppointmentRecordService;
import com.cjy.back.ybsjAppointment.utils.DateUtil;
import com.cjy.util.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author liangjiawei
@ -18,7 +25,10 @@ public class HandleExpiredAppointmentsTask {
@Autowired
YbsjyAppointmentRecordService ybsjyAppointmentRecordService;
@Autowired
YbsjyAppointmentSettingMapper ybsjyAppointmentSettingMapper;
@Value("${jqzhgk.synchronousCancelDataUrl}")
private String synchronousCancelDataUrl;
/**
* 处理过期预约人信息
* 一小时扫描一次
@ -28,21 +38,61 @@ public class HandleExpiredAppointmentsTask {
public void handleExpiredAppointments() {
// 第一步先获取到 当天 未核销的数据
List<AppointmentPersonVO> list = ybsjyAppointmentRecordService.getAppointmentNotWrittenOffRecord();
List<Long> ids =new ArrayList<>();
if (!list.isEmpty()) {
list.stream().forEach(item -> {
//如果当前时间大于结束时间
if (DateUtil.isAfterEndDateTime(item.getAppointmentDate() +" " +item.getEndTime())) {
//就将该数据修改取消 且是过期的
ybsjyAppointmentRecordService.updateAppointmentRecordSate(item.getId());
if(ids.size()<500){
ids.add(item.getId());
}else {
String responseString = HttpUtil.sendPostJson(synchronousCancelDataUrl, JSONObject.toJSONString(ids));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousCancelDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(ids));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
ids.clear();
ids.add(item.getId());
}
//未核销数量
int notWrittenOffCount = ybsjyAppointmentRecordService.getNotWrittenOffCount(item.getAppointmentDocumentsId());
//如果该单子未核销数量为0 则表示单子都是处理过的状态 可以把单子修改为已核销
if (notWrittenOffCount == 0) {
//修改预约单状态
ybsjyAppointmentRecordService.updateDocumentsSate(item.getAppointmentDocumentsId());
// int notWrittenOffCount = ybsjyAppointmentRecordService.getNotWrittenOffCount(item.getAppointmentDocumentsId());
Map<String,Object> map = ybsjyAppointmentRecordService.getWriteOffStatusQuantity(item.getAppointmentDocumentsId());
//如果该单子未核销数量为0 则表示单子都是处理过的状态 可以把单子修改为已核销 这里需要判断这个单子是否全是取消状态 如果不是
//如果未核销 且已核销 都等于0则表是取消订单 否则表示核销订单
if (Integer.parseInt(map.get("notWrittenOffCount").toString()) == 0) {
if( Integer.parseInt(map.get("writtenOffCount").toString())==0){
//修改预约单状态
ybsjyAppointmentRecordService.updateDocumentsSate(item.getAppointmentDocumentsId(),3);
}else {
ybsjyAppointmentRecordService.updateDocumentsSate(item.getAppointmentDocumentsId(),1);
}
}
}
});
if(!ids.isEmpty()){
String responseString = HttpUtil.sendPostJson(synchronousCancelDataUrl, JSONObject.toJSONString(ids));
JSONObject responseJson = JSONObject.parseObject(responseString);
//记录访问日志
AppointmentRequestTurnstileLogEntity appointmentRequestTurnstileLogEntity = new AppointmentRequestTurnstileLogEntity();
appointmentRequestTurnstileLogEntity.setRequestUrl(synchronousCancelDataUrl);
appointmentRequestTurnstileLogEntity.setRequestParams( JSONObject.toJSONString(ids));
appointmentRequestTurnstileLogEntity.setResponseBody(responseString);
appointmentRequestTurnstileLogEntity.setState(responseJson.get("code").toString());
appointmentRequestTurnstileLogEntity.setType("post");
ybsjyAppointmentSettingMapper.saveAppointmentRequestTurnstileLog(appointmentRequestTurnstileLogEntity);
}
}
}

@ -205,4 +205,5 @@ allowed.method.methodList= /appointmentSetting/writeOff
jqzhgk.organCode=123
jqzhgk.synchronousDataUrl=http://192.168.110.158:8080/reservationdata/appointmentrecord/synchronousData
jqzhgk.synchronousWriteOffDataUrl=http://192.168.110.158:8080/reservationdata/appointmentrecord/synchronousWriteOffData
jqzhgk.synchronousCancelDataUrl=http://192.168.110.158:8080/reservationdata/appointmentrecord/synchronousCancelData

Loading…
Cancel
Save