Commit efa500ff authored by 赵啸非's avatar 赵啸非

添加事件识别告警实现类

parent 12d14386
package com.mortals.xhx.busiz.req.appoint;
import lombok.Data;
@Data
public class AppointReq {
private String number;
private Long siteid;
}
......@@ -4,7 +4,7 @@ package com.mortals.xhx.busiz.req.register;
import lombok.Data;
@Data
public class registerReq {
public class RegisterReq {
private Integer page;
......
package com.mortals.xhx.busiz.rsp.appoint;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class AppointmentData {
@JSONField(name="summary")
private String summary;
@JSONField(name="queueid")
private String queueId;
@JSONField(name="flownum")
private String flownum;
@JSONField(name="idcard")
private String idCard;
@JSONField(name="count")
private int count;
@JSONField(name="businessid")
private Long businessid;
@JSONField(name="sitename")
private String siteName;
@JSONField(name="businessname")
private String businessName;
@JSONField(name="time",format = "yyyy-MM-dd HH:mm:ss")
private Date time;
@JSONField(name="windows")
private String windows;
@JSONField(name="region")
private String region;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.appoint;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class AppointmentSubmitDataInfo {
@JSONField(name="data")
private AppointmentData data;
@JSONField(name="resdata")
private List<Object> resdata;
}
\ No newline at end of file
package com.mortals.xhx.daemon.task;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.busiz.req.appoint.AppointReq;
import com.mortals.xhx.busiz.rsp.appoint.AppointmentSubmitDataInfo;
import com.mortals.xhx.busiz.rsp.register.AppointmentDataInfo;
import com.mortals.xhx.common.code.AppointmentStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsQuery;
import com.mortals.xhx.module.appointment.service.AppointmentPersonService;
import com.mortals.xhx.module.appointment.service.AppointmentRecordsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 今日挂号任务。
*/
@Slf4j
@Service("SyncSubmitAppointTask")
public class SyncSubmitAppointTaskImpl implements ITaskExcuteService {
@Autowired
private AppointmentPersonService appointmentPersonService;
@Autowired
private AppointmentRecordsService appointmentRecordsService;
@Value("${php.host:''}")
private String host;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步提交预约任务");
syncSubmitAppoint();
log.info("同步提交预约任务完成");
}
private void syncSubmitAppoint() {
String registerPath = "/inter/Actuary/orderTakebusiness";
String url = host + registerPath;
AppointmentRecordsQuery appointmentRecordsQuery = new AppointmentRecordsQuery();
appointmentRecordsQuery.setAppointmentStatus(AppointmentStatusEnum.未取号.getValue());
appointmentRecordsQuery.setCreateTime(DateUtils.getCurrDate());
List<AppointmentRecordsEntity> appointmentRecordsList = appointmentRecordsService.find(appointmentRecordsQuery);
for (AppointmentRecordsEntity appointmentRecordsEntity : appointmentRecordsList) {
//请求取号
AppointReq appointReq = new AppointReq();
appointReq.setSiteid(appointmentRecordsEntity.getSiteId());
appointReq.setNumber(appointmentRecordsEntity.getReservationNumber());
log.info("appointment submit req=>{}",JSON.toJSONString(appointReq));
String respJson = HttpUtil.post(url, JSON.toJSONString(appointReq));
log.info("appointment submit respJson=>{}",respJson);
Rest<AppointmentSubmitDataInfo> rest = JSON.parseObject(respJson, new TypeReference<Rest<AppointmentSubmitDataInfo>>() {
});
if(rest.getCode()== YesNoEnum.YES.getValue()){
appointmentRecordsEntity.setFlowNum(rest.getData().getData().getFlownum());
appointmentRecordsEntity.setAppointmentStatus(AppointmentStatusEnum.取号完成.getValue());
appointmentRecordsEntity.setFlowTime(rest.getData().getData().getTime());
appointmentRecordsEntity.setUpdateTime(new Date());
appointmentRecordsEntity.setUpdateUserId(1L);
appointmentRecordsEntity.setUpdateUserName("system");
appointmentRecordsService.update(appointmentRecordsEntity);
}
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
......@@ -44,6 +44,9 @@ import java.util.List;
* 同步用户人脸数据到海康指定库。
* 时间间隔以同步注册用户之后
* 默认同步到一个人脸用户组,如要其它用户组 则页面上进行添加
* 需要根据计划进行同步人脸链接
* 默认
*
*/
@Slf4j
@Service("SyncUserToHikTask")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment