Commit 12d14386 authored by 赵啸非's avatar 赵啸非

添加事件识别告警实现类

parent fa3d27ac
...@@ -46,6 +46,11 @@ CREATE TABLE mortals_xhx_appointment_records( ...@@ -46,6 +46,11 @@ CREATE TABLE mortals_xhx_appointment_records(
`monitorDevice` varchar(50) COMMENT '监测设备', `monitorDevice` varchar(50) COMMENT '监测设备',
`checkInMethod` tinyint(1) DEFAULT '0' COMMENT '签到方式(0.自动签到,1.手动签到)', `checkInMethod` tinyint(1) DEFAULT '0' COMMENT '签到方式(0.自动签到,1.手动签到)',
`monitorCertificate` varchar(255) COMMENT '监测凭证', `monitorCertificate` varchar(255) COMMENT '监测凭证',
`appointmentStatus` tinyint(1) DEFAULT '0' COMMENT '预约取号状态(0.未取号,1.取号中,2.取号完成)',
`flowNum` varchar(255) COMMENT '取号号码',
`flowTime` datetime COMMENT '取号时间',
`picUri` varchar(255) COMMENT '监控相对图片pic',
`serverIndexCode` varchar(255) COMMENT '图片资源唯一标识',
`createUserId` bigint(20) COMMENT '创建人id', `createUserId` bigint(20) COMMENT '创建人id',
`createTime` datetime COMMENT '创建时间', `createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新人id', `updateUserId` bigint(20) COMMENT '更新人id',
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 预约取号状态(0.未取号,1.取号中,2.取号完成)枚举类
*
* @author zxfei
*/
public enum AppointmentStatusEnum {
未取号(0, "未取号"),
取号中(1, "取号中"),
取号完成(2, "取号完成");
private Integer value;
private String desc;
AppointmentStatusEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static AppointmentStatusEnum getByValue(Integer value) {
for (AppointmentStatusEnum appointmentStatusEnum : AppointmentStatusEnum.values()) {
if (appointmentStatusEnum.getValue() == value) {
return appointmentStatusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (AppointmentStatusEnum item : AppointmentStatusEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -5,6 +5,7 @@ import cn.hutool.http.HttpUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.http.HttpUtil;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.module.person.model.PersonEntity; import com.mortals.xhx.module.person.model.PersonEntity;
import com.mortals.xhx.module.person.model.PersonQuery; import com.mortals.xhx.module.person.model.PersonQuery;
...@@ -66,7 +67,7 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService { ...@@ -66,7 +67,7 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService {
byte[] bytes = HttpUtil.downloadBytes(downUrl); byte[] bytes = HttpUtil.downloadBytes(downUrl);
if(bytes.length>0){ if(bytes.length>0){
InputStream inputStream = new ByteArrayInputStream(bytes); InputStream inputStream = new ByteArrayInputStream(bytes);
MultipartFile file = getMultipartFile(inputStream, "photo.jpg"); MultipartFile file = ServletUtils.getMultipartFile(inputStream, "photo.jpg");
String filePath = uploadService.saveFileUpload(file, "file/fileupload",null); String filePath = uploadService.saveFileUpload(file, "file/fileupload",null);
personEntity.setPhoto(filePath); personEntity.setPhoto(filePath);
personService.update(personEntity); personService.update(personEntity);
...@@ -80,66 +81,6 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService { ...@@ -80,66 +81,6 @@ public class SyncRegisterUserPicTaskImpl implements ITaskExcuteService {
} }
/**
* 获取封装得MultipartFile
*
* @param inputStream inputStream
* @param fileName fileName
* @return MultipartFile
*/
public MultipartFile getMultipartFile(InputStream inputStream, String fileName) {
FileItem fileItem = createFileItem(inputStream, fileName);
//CommonsMultipartFile是feign对multipartFile的封装,但是要FileItem类对象
return new CommonsMultipartFile(fileItem);
}
/**
* FileItem类对象创建
*
* @param inputStream inputStream
* @param fileName fileName
* @return FileItem
*/
public FileItem createFileItem(InputStream inputStream, String fileName) {
FileItemFactory factory = new DiskFileItemFactory(16, null);
String textFieldName = "file";
FileItem item = factory.createItem(textFieldName, MediaType.MULTIPART_FORM_DATA_VALUE, true, fileName);
int bytesRead = 0;
byte[] buffer = new byte[10 * 1024 * 1024];
OutputStream os = null;
//使用输出流输出输入流的字节
try {
os = item.getOutputStream();
while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
inputStream.close();
} catch (IOException e) {
log.error("Stream copy exception", e);
throw new IllegalArgumentException("文件上传失败");
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
log.error("Stream close exception", e);
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
log.error("Stream close exception", e);
}
}
}
return item;
}
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
* 预约签到记录 DAO接口 * 预约签到记录 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
public interface AppointmentRecordsDao extends ICRUDDao<AppointmentRecordsEntity,Long>{ public interface AppointmentRecordsDao extends ICRUDDao<AppointmentRecordsEntity,Long>{
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
* 预约签到记录DaoImpl DAO接口 * 预约签到记录DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
@Repository("appointmentRecordsDao") @Repository("appointmentRecordsDao")
public class AppointmentRecordsDaoImpl extends BaseCRUDDaoMybatis<AppointmentRecordsEntity,Long> implements AppointmentRecordsDao { public class AppointmentRecordsDaoImpl extends BaseCRUDDaoMybatis<AppointmentRecordsEntity,Long> implements AppointmentRecordsDao {
......
...@@ -11,7 +11,7 @@ import com.mortals.xhx.module.appointment.model.vo.AppointmentRecordsVo; ...@@ -11,7 +11,7 @@ import com.mortals.xhx.module.appointment.model.vo.AppointmentRecordsVo;
* 预约签到记录实体对象 * 预约签到记录实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
public class AppointmentRecordsEntity extends AppointmentRecordsVo { public class AppointmentRecordsEntity extends AppointmentRecordsVo {
...@@ -80,6 +80,29 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo { ...@@ -80,6 +80,29 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo {
*/ */
@Excel(name = "监测凭证") @Excel(name = "监测凭证")
private String monitorCertificate; private String monitorCertificate;
/**
* 预约取号状态(0.未取号,1.取号中,2.取号完成)
*/
@Excel(name = "预约取号状态", readConverterExp = "0=未取号,1=取号中,2=取号完成")
private Integer appointmentStatus;
/**
* 取号号码
*/
@Excel(name = "取号号码")
private String flowNum;
/**
* 取号时间
*/
@Excel(name = "取号时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date flowTime;
/**
* 监控相对图片pic
*/
private String picUri;
/**
* 图片资源唯一标识
*/
private String serverIndexCode;
...@@ -266,6 +289,76 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo { ...@@ -266,6 +289,76 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo {
public void setMonitorCertificate(String monitorCertificate){ public void setMonitorCertificate(String monitorCertificate){
this.monitorCertificate = monitorCertificate; this.monitorCertificate = monitorCertificate;
} }
/**
* 获取 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return Integer
*/
public Integer getAppointmentStatus(){
return appointmentStatus;
}
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatus
*/
public void setAppointmentStatus(Integer appointmentStatus){
this.appointmentStatus = appointmentStatus;
}
/**
* 获取 取号号码
* @return String
*/
public String getFlowNum(){
return flowNum;
}
/**
* 设置 取号号码
* @param flowNum
*/
public void setFlowNum(String flowNum){
this.flowNum = flowNum;
}
/**
* 获取 取号时间
* @return Date
*/
public Date getFlowTime(){
return flowTime;
}
/**
* 设置 取号时间
* @param flowTime
*/
public void setFlowTime(Date flowTime){
this.flowTime = flowTime;
}
/**
* 获取 监控相对图片pic
* @return String
*/
public String getPicUri(){
return picUri;
}
/**
* 设置 监控相对图片pic
* @param picUri
*/
public void setPicUri(String picUri){
this.picUri = picUri;
}
/**
* 获取 图片资源唯一标识
* @return String
*/
public String getServerIndexCode(){
return serverIndexCode;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCode
*/
public void setServerIndexCode(String serverIndexCode){
this.serverIndexCode = serverIndexCode;
}
...@@ -301,6 +394,11 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo { ...@@ -301,6 +394,11 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo {
sb.append(",monitorDevice:").append(getMonitorDevice()); sb.append(",monitorDevice:").append(getMonitorDevice());
sb.append(",checkInMethod:").append(getCheckInMethod()); sb.append(",checkInMethod:").append(getCheckInMethod());
sb.append(",monitorCertificate:").append(getMonitorCertificate()); sb.append(",monitorCertificate:").append(getMonitorCertificate());
sb.append(",appointmentStatus:").append(getAppointmentStatus());
sb.append(",flowNum:").append(getFlowNum());
sb.append(",flowTime:").append(getFlowTime());
sb.append(",picUri:").append(getPicUri());
sb.append(",serverIndexCode:").append(getServerIndexCode());
return sb.toString(); return sb.toString();
} }
...@@ -331,5 +429,15 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo { ...@@ -331,5 +429,15 @@ public class AppointmentRecordsEntity extends AppointmentRecordsVo {
this.checkInMethod = 0; this.checkInMethod = 0;
this.monitorCertificate = ""; this.monitorCertificate = "";
this.appointmentStatus = 0;
this.flowNum = "";
this.flowTime = null;
this.picUri = "";
this.serverIndexCode = "";
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity; ...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity;
* 预约签到记录查询对象 * 预约签到记录查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
public class AppointmentRecordsQuery extends AppointmentRecordsEntity { public class AppointmentRecordsQuery extends AppointmentRecordsEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -131,6 +131,42 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity { ...@@ -131,6 +131,42 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity {
/** 监测凭证排除列表 */ /** 监测凭证排除列表 */
private List <String> monitorCertificateNotList; private List <String> monitorCertificateNotList;
/** 开始 预约取号状态(0.未取号,1.取号中,2.取号完成) */
private Integer appointmentStatusStart;
/** 结束 预约取号状态(0.未取号,1.取号中,2.取号完成) */
private Integer appointmentStatusEnd;
/** 增加 预约取号状态(0.未取号,1.取号中,2.取号完成) */
private Integer appointmentStatusIncrement;
/** 预约取号状态(0.未取号,1.取号中,2.取号完成)列表 */
private List <Integer> appointmentStatusList;
/** 预约取号状态(0.未取号,1.取号中,2.取号完成)排除列表 */
private List <Integer> appointmentStatusNotList;
/** 取号号码 */
private List<String> flowNumList;
/** 取号号码排除列表 */
private List <String> flowNumNotList;
/** 开始 取号时间 */
private String flowTimeStart;
/** 结束 取号时间 */
private String flowTimeEnd;
/** 监控相对图片pic */
private List<String> picUriList;
/** 监控相对图片pic排除列表 */
private List <String> picUriNotList;
/** 图片资源唯一标识 */
private List<String> serverIndexCodeList;
/** 图片资源唯一标识排除列表 */
private List <String> serverIndexCodeNotList;
/** 开始 创建人id */ /** 开始 创建人id */
private Long createUserIdStart; private Long createUserIdStart;
...@@ -874,6 +910,215 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity { ...@@ -874,6 +910,215 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity {
this.monitorCertificateNotList = monitorCertificateNotList; this.monitorCertificateNotList = monitorCertificateNotList;
} }
/**
* 获取 开始 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return appointmentStatusStart
*/
public Integer getAppointmentStatusStart(){
return this.appointmentStatusStart;
}
/**
* 设置 开始 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusStart
*/
public void setAppointmentStatusStart(Integer appointmentStatusStart){
this.appointmentStatusStart = appointmentStatusStart;
}
/**
* 获取 结束 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return $appointmentStatusEnd
*/
public Integer getAppointmentStatusEnd(){
return this.appointmentStatusEnd;
}
/**
* 设置 结束 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusEnd
*/
public void setAppointmentStatusEnd(Integer appointmentStatusEnd){
this.appointmentStatusEnd = appointmentStatusEnd;
}
/**
* 获取 增加 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return appointmentStatusIncrement
*/
public Integer getAppointmentStatusIncrement(){
return this.appointmentStatusIncrement;
}
/**
* 设置 增加 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusIncrement
*/
public void setAppointmentStatusIncrement(Integer appointmentStatusIncrement){
this.appointmentStatusIncrement = appointmentStatusIncrement;
}
/**
* 获取 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return appointmentStatusList
*/
public List<Integer> getAppointmentStatusList(){
return this.appointmentStatusList;
}
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusList
*/
public void setAppointmentStatusList(List<Integer> appointmentStatusList){
this.appointmentStatusList = appointmentStatusList;
}
/**
* 获取 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @return appointmentStatusNotList
*/
public List<Integer> getAppointmentStatusNotList(){
return this.appointmentStatusNotList;
}
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusNotList
*/
public void setAppointmentStatusNotList(List<Integer> appointmentStatusNotList){
this.appointmentStatusNotList = appointmentStatusNotList;
}
/**
* 获取 取号号码
* @return flowNumList
*/
public List<String> getFlowNumList(){
return this.flowNumList;
}
/**
* 设置 取号号码
* @param flowNumList
*/
public void setFlowNumList(List<String> flowNumList){
this.flowNumList = flowNumList;
}
/**
* 获取 取号号码
* @return flowNumNotList
*/
public List<String> getFlowNumNotList(){
return this.flowNumNotList;
}
/**
* 设置 取号号码
* @param flowNumNotList
*/
public void setFlowNumNotList(List<String> flowNumNotList){
this.flowNumNotList = flowNumNotList;
}
/**
* 获取 开始 取号时间
* @return flowTimeStart
*/
public String getFlowTimeStart(){
return this.flowTimeStart;
}
/**
* 设置 开始 取号时间
* @param flowTimeStart
*/
public void setFlowTimeStart(String flowTimeStart){
this.flowTimeStart = flowTimeStart;
}
/**
* 获取 结束 取号时间
* @return flowTimeEnd
*/
public String getFlowTimeEnd(){
return this.flowTimeEnd;
}
/**
* 设置 结束 取号时间
* @param flowTimeEnd
*/
public void setFlowTimeEnd(String flowTimeEnd){
this.flowTimeEnd = flowTimeEnd;
}
/**
* 获取 监控相对图片pic
* @return picUriList
*/
public List<String> getPicUriList(){
return this.picUriList;
}
/**
* 设置 监控相对图片pic
* @param picUriList
*/
public void setPicUriList(List<String> picUriList){
this.picUriList = picUriList;
}
/**
* 获取 监控相对图片pic
* @return picUriNotList
*/
public List<String> getPicUriNotList(){
return this.picUriNotList;
}
/**
* 设置 监控相对图片pic
* @param picUriNotList
*/
public void setPicUriNotList(List<String> picUriNotList){
this.picUriNotList = picUriNotList;
}
/**
* 获取 图片资源唯一标识
* @return serverIndexCodeList
*/
public List<String> getServerIndexCodeList(){
return this.serverIndexCodeList;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCodeList
*/
public void setServerIndexCodeList(List<String> serverIndexCodeList){
this.serverIndexCodeList = serverIndexCodeList;
}
/**
* 获取 图片资源唯一标识
* @return serverIndexCodeNotList
*/
public List<String> getServerIndexCodeNotList(){
return this.serverIndexCodeNotList;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCodeNotList
*/
public void setServerIndexCodeNotList(List<String> serverIndexCodeNotList){
this.serverIndexCodeNotList = serverIndexCodeNotList;
}
/** /**
* 获取 开始 创建人id * 获取 开始 创建人id
* @return createUserIdStart * @return createUserIdStart
...@@ -1523,6 +1768,118 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity { ...@@ -1523,6 +1768,118 @@ public class AppointmentRecordsQuery extends AppointmentRecordsEntity {
return this; return this;
} }
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatus
*/
public AppointmentRecordsQuery appointmentStatus(Integer appointmentStatus){
setAppointmentStatus(appointmentStatus);
return this;
}
/**
* 设置 开始 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusStart
*/
public AppointmentRecordsQuery appointmentStatusStart(Integer appointmentStatusStart){
this.appointmentStatusStart = appointmentStatusStart;
return this;
}
/**
* 设置 结束 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusEnd
*/
public AppointmentRecordsQuery appointmentStatusEnd(Integer appointmentStatusEnd){
this.appointmentStatusEnd = appointmentStatusEnd;
return this;
}
/**
* 设置 增加 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusIncrement
*/
public AppointmentRecordsQuery appointmentStatusIncrement(Integer appointmentStatusIncrement){
this.appointmentStatusIncrement = appointmentStatusIncrement;
return this;
}
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusList
*/
public AppointmentRecordsQuery appointmentStatusList(List<Integer> appointmentStatusList){
this.appointmentStatusList = appointmentStatusList;
return this;
}
/**
* 设置 预约取号状态(0.未取号,1.取号中,2.取号完成)
* @param appointmentStatusNotList
*/
public AppointmentRecordsQuery appointmentStatusNotList(List<Integer> appointmentStatusNotList){
this.appointmentStatusNotList = appointmentStatusNotList;
return this;
}
/**
* 设置 取号号码
* @param flowNum
*/
public AppointmentRecordsQuery flowNum(String flowNum){
setFlowNum(flowNum);
return this;
}
/**
* 设置 取号号码
* @param flowNumList
*/
public AppointmentRecordsQuery flowNumList(List<String> flowNumList){
this.flowNumList = flowNumList;
return this;
}
/**
* 设置 监控相对图片pic
* @param picUri
*/
public AppointmentRecordsQuery picUri(String picUri){
setPicUri(picUri);
return this;
}
/**
* 设置 监控相对图片pic
* @param picUriList
*/
public AppointmentRecordsQuery picUriList(List<String> picUriList){
this.picUriList = picUriList;
return this;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCode
*/
public AppointmentRecordsQuery serverIndexCode(String serverIndexCode){
setServerIndexCode(serverIndexCode);
return this;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCodeList
*/
public AppointmentRecordsQuery serverIndexCodeList(List<String> serverIndexCodeList){
this.serverIndexCodeList = serverIndexCodeList;
return this;
}
/** /**
* 设置 创建人id * 设置 创建人id
* @param createUserId * @param createUserId
......
...@@ -8,7 +8,7 @@ import lombok.Data; ...@@ -8,7 +8,7 @@ import lombok.Data;
* 预约签到记录视图对象 * 预约签到记录视图对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
@Data @Data
public class AppointmentRecordsVo extends BaseEntityLong { public class AppointmentRecordsVo extends BaseEntityLong {
......
package com.mortals.xhx.module.appointment.service; package com.mortals.xhx.module.appointment.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity; import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity;
import org.springframework.web.bind.annotation.RequestBody;
/** /**
* AppointmentRecordsService * AppointmentRecordsService
* *
* 预约签到记录 service接口 * 预约签到记录 service接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
public interface AppointmentRecordsService extends ICRUDService<AppointmentRecordsEntity,Long>{ public interface AppointmentRecordsService extends ICRUDService<AppointmentRecordsEntity,Long>{
/**
* 停止群众预约推送服务
* @param appointmentRecordsEntity
* @param context
* @return
*/
Rest<String> stopService(AppointmentRecordsEntity appointmentRecordsEntity, Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.appointment.service.impl; package com.mortals.xhx.module.appointment.service.impl;
import com.mortals.framework.common.Rest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -12,14 +11,9 @@ import com.mortals.xhx.module.appointment.service.AppointmentRecordsService; ...@@ -12,14 +11,9 @@ import com.mortals.xhx.module.appointment.service.AppointmentRecordsService;
* 预约签到记录 service实现 * 预约签到记录 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
@Service("appointmentRecordsService") @Service("appointmentRecordsService")
public class AppointmentRecordsServiceImpl extends AbstractCRUDServiceImpl<AppointmentRecordsDao, AppointmentRecordsEntity, Long> implements AppointmentRecordsService { public class AppointmentRecordsServiceImpl extends AbstractCRUDServiceImpl<AppointmentRecordsDao, AppointmentRecordsEntity, Long> implements AppointmentRecordsService {
@Override
public Rest<String> stopService(AppointmentRecordsEntity appointmentRecordsEntity, Context context) {
//todo 停止群众推送服务
return Rest.ok("服务停止成功");
}
} }
\ No newline at end of file
package com.mortals.xhx.module.appointment.web; package com.mortals.xhx.module.appointment.web;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.device.model.DeviceEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -32,7 +27,7 @@ import static com.mortals.framework.ap.SysConstains.*; ...@@ -32,7 +27,7 @@ import static com.mortals.framework.ap.SysConstains.*;
* 预约签到记录 * 预约签到记录
* *
* @author zxfei * @author zxfei
* @date 2023-04-09 * @date 2023-04-17
*/ */
@RestController @RestController
@RequestMapping("appointment/records") @RequestMapping("appointment/records")
...@@ -48,35 +43,9 @@ public class AppointmentRecordsController extends BaseCRUDJsonBodyMappingControl ...@@ -48,35 +43,9 @@ public class AppointmentRecordsController extends BaseCRUDJsonBodyMappingControl
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "checkInMethod", paramService.getParamBySecondOrganize("AppointmentRecords","checkInMethod")); this.addDict(model, "checkInMethod", paramService.getParamBySecondOrganize("AppointmentRecords","checkInMethod"));
this.addDict(model, "appointmentStatus", paramService.getParamBySecondOrganize("AppointmentRecords","appointmentStatus"));
super.init(model, context); super.init(model, context);
} }
/**
* 群众停止服务
*/
@PostMapping(value = "stopService")
public String stopService(@RequestBody AppointmentRecordsEntity appointmentRecordsEntity) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = this.getModuleDesc() + "停止服务";
try {
Rest<String> rest = this.service.stopService(appointmentRecordsEntity, getContext());
if(YesNoEnum.YES.getValue()==rest.getCode()){
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, rest.getMsg());
}else {
throw new AppException(rest.getMsg());
}
} catch (Exception e) {
log.error(busiDesc, e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
} }
\ No newline at end of file
package com.mortals.xhx.module.hik.event.model;
import lombok.Data;
/**
* 公用参数
* @author:
* @date: 2023/4/17 9:39
*/
@Data
public class CommonCons {
}
package com.mortals.xhx.module.hik.event.service.impl;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.code.CheckInMethodEnum;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.appointment.model.AppointmentPersonEntity;
import com.mortals.xhx.module.appointment.model.AppointmentPersonQuery;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsEntity;
import com.mortals.xhx.module.appointment.model.AppointmentRecordsQuery;
import com.mortals.xhx.module.appointment.service.AppointmentConfigService;
import com.mortals.xhx.module.appointment.service.AppointmentPersonService;
import com.mortals.xhx.module.appointment.service.AppointmentRecordsService;
import com.mortals.xhx.module.hik.event.model.req.callback.*;
import com.mortals.xhx.module.monitor.model.MonitorAlarmEntity;
import com.mortals.xhx.module.monitor.model.MonitorAlarmQuery;
import com.mortals.xhx.module.monitor.model.MonitorAlarmRecordEntity;
import com.mortals.xhx.module.monitor.service.MonitorAlarmRecordService;
import com.mortals.xhx.module.monitor.service.MonitorAlarmService;
import com.mortals.xhx.module.person.model.PersonEntity;
import com.mortals.xhx.module.person.service.PersonService;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 重点人员识别
* 预约人员识别
*
* @author:
* @date: 2023/4/17 9:27
*/
@Slf4j
public class BlackPlanRecoginze extends EventTypeAbstract {
private AppointmentRecordsService appointmentRecordsService;
private PersonService personService;
private AppointmentPersonService appointmentPersonService;
private RealtimeDataflowService dataflowService;
private MonitorAlarmService monitorAlarmService;
private MonitorAlarmRecordService monitorAlarmRecordService;
public BlackPlanRecoginze(int type) {
super(type);
this.dataflowService = SpringUtils.getBean(RealtimeDataflowService.class);
this.appointmentRecordsService = SpringUtils.getBean(AppointmentRecordsService.class);
this.personService = SpringUtils.getBean(PersonService.class);
this.appointmentPersonService = SpringUtils.getBean(AppointmentPersonService.class);
this.monitorAlarmService = SpringUtils.getBean(MonitorAlarmService.class);
this.monitorAlarmRecordService = SpringUtils.getBean(MonitorAlarmRecordService.class);
}
@Override
int getType() {
return HikEventTypeEnum.重点人员识别事件.getValue();
}
@Override
public void saveEventData(EventsItem event) {
Double similarity = DataUtil.converStr2Double(GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8"), 0);
EventData eventData = event.getData();
//识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
//抓拍信息
Snap snap = faceRecognitionResult.getSnap();
//处理重点人员事件
//匹配的结果
List<FaceMatchItem> faceMatchs = faceRecognitionResult.getFaceMatch();
for (FaceMatchItem faceMatch : faceMatchs) {
//根据匹配结果 保存业务数据
if (faceMatch.getSimilarity() > similarity) {
//判断当前识别是否为注册用户
PersonEntity personCache = personService.getExtCache(faceMatch.getCertificate());
if (ObjectUtils.isEmpty(personCache)) {
throw new AppException("识别人员未在注册库中!");
}
//保存人流信息
RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity();
realtimeDataflowEntity.setDetectTime(event.getHappenTime());
String resIndexCodes = eventData.getResInfo().stream().map(i -> i.getIndexCode()).collect(Collectors.joining(","));
realtimeDataflowEntity.setDevice(resIndexCodes);
realtimeDataflowEntity.setPicUri(snap.getFaceUrl());
realtimeDataflowEntity.setEventId(event.getEventId());
realtimeDataflowEntity.setSiteId(personCache.getSiteId());
realtimeDataflowEntity.setSiteName(personCache.getSiteName());
realtimeDataflowEntity.setIdNumber(personCache.getIdCard());
realtimeDataflowEntity.setName(personCache.getName());
realtimeDataflowEntity.setIsBooking(YesNoEnum.YES.getValue());
realtimeDataflowEntity.setContact(personCache.getPhoto());
realtimeDataflowEntity.setEventType(HikEventTypeEnum.重点人员识别事件.getValue().longValue());
realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(new Date());
realtimeDataflowEntity.setCreateUserName("system");
realtimeDataflowEntity.initAttrValue();
dataflowService.save(realtimeDataflowEntity);
//查询当前是否为当天预约人员
AppointmentPersonQuery appointmentPersonQuery = new AppointmentPersonQuery();
appointmentPersonQuery.setPersonId(personCache.getId());
appointmentPersonQuery.setAppointmentStartTime(DateUtils.getCurrDate());
List<AppointmentPersonEntity> appointmentPersonEntities = appointmentPersonService.find(appointmentPersonQuery);
for (AppointmentPersonEntity appointmentPersonEntity : appointmentPersonEntities) {
//当为预约用户的时候,判断当前用户是否在今天已经存在了业务 如果没有 则新增。
AppointmentRecordsQuery appointmentRecordsQuery = new AppointmentRecordsQuery();
appointmentRecordsQuery.setPersonId(personCache.getId());
appointmentRecordsQuery.setReservationService(appointmentPersonEntity.getBussinessName());
appointmentRecordsQuery.setCreateTime(DateUtils.getCurrDate());
//设置
int count = appointmentRecordsService.count(appointmentRecordsQuery, null);
if (count == 0) {
//当前人员今天不存在次业务 新增预约业务记录数据
//保存当前识别结果到记录表中
AppointmentRecordsEntity appointmentRecordsEntity = new AppointmentRecordsEntity();
appointmentRecordsEntity.initAttrValue();
appointmentRecordsEntity.setSiteId(appointmentPersonEntity.getSiteId());
appointmentRecordsEntity.setSiteName(personCache.getSiteName());
appointmentRecordsEntity.setPersonId(appointmentPersonEntity.getPersonId());
appointmentRecordsEntity.setName(personCache.getName());
appointmentRecordsEntity.setContactInfo(personCache.getPhoto());
appointmentRecordsEntity.setIdNumber(personCache.getIdCard());
appointmentRecordsEntity.setReservationService(appointmentPersonEntity.getBussinessName());
appointmentRecordsEntity.setReservationNumber(appointmentPersonEntity.getAppontmentNumber());
appointmentRecordsEntity.setMonitorTime(event.getHappenTime());
appointmentRecordsEntity.setMonitorDevice(eventData.getResInfo().stream().map(i -> i.getIndexCode()).collect(Collectors.joining(",")));
appointmentRecordsEntity.setCheckInMethod(CheckInMethodEnum.自动签到.getValue());
appointmentRecordsEntity.setPicUri(faceMatch.getFacePicUrl());
appointmentRecordsEntity.setCreateUserId(1L);
appointmentRecordsEntity.setCreateTime(new Date());
appointmentRecordsEntity.setCreateUserName("system");
appointmentRecordsService.save(appointmentRecordsEntity);
//新增当天的访问预警统计信息,如果已存在 则更新频次加1
MonitorAlarmQuery monitorAlarmQuery = new MonitorAlarmQuery();
monitorAlarmQuery.setPersonId(personCache.getId());
monitorAlarmQuery.setYear(DataUtil.converStr2Int(DateUtils.getThisYear(), 2023));
monitorAlarmQuery.setMonth(DataUtil.converStr2Int(DateUtils.getCurrMonth(), 1));
monitorAlarmQuery.setDay(DateUtils.getCurrentMonthDay());
MonitorAlarmEntity monitorAlarm = monitorAlarmService.selectOne(monitorAlarmQuery, null);
if (ObjectUtils.isEmpty(monitorAlarm)) {
//新增
monitorAlarm = new MonitorAlarmEntity();
monitorAlarm.initAttrValue();
monitorAlarm.setSiteId(personCache.getSiteId());
monitorAlarm.setSiteName(personCache.getSiteName());
monitorAlarm.setPersonId(personCache.getId());
monitorAlarm.setName(personCache.getName());
monitorAlarm.setContact(personCache.getPhone());
monitorAlarm.setIdNumber(personCache.getIdCard());
monitorAlarm.setLastIdentifyTime(event.getHappenTime());
monitorAlarm.setYear(DataUtil.converStr2Int(DateUtils.getThisYear(), 2023));
monitorAlarm.setMonth(DataUtil.converStr2Int(DateUtils.getCurrMonth(), 1));
monitorAlarm.setDay(DateUtils.getCurrentMonthDay());
monitorAlarm.setCreateTime(new Date());
monitorAlarm.setCreateUserName("system");
monitorAlarm.setCreateUserId(1L);
monitorAlarmService.save(monitorAlarm);
} else {
MonitorAlarmQuery condition = new MonitorAlarmQuery();
condition.setId(monitorAlarm.getId());
condition.setIdentifyNumIncrement(1);
condition.setUpdateUserId(1L);
condition.setUpdateUserName("system");
condition.setUpdateTime(new Date());
monitorAlarmService.update(condition);
}
//新增当前用户信息告警详细记录
MonitorAlarmRecordEntity monitorAlarmRecordEntity = new MonitorAlarmRecordEntity();
monitorAlarmRecordEntity.setAlarmId(monitorAlarm.getId());
monitorAlarmRecordEntity.setReservationService(appointmentRecordsEntity.getReservationService());
monitorAlarmRecordEntity.setReservationNumber(appointmentRecordsEntity.getReservationNumber());
monitorAlarmRecordEntity.setMonitorTime(event.getHappenTime());
monitorAlarmRecordEntity.setMonitorDevice(eventData.getResInfo().stream().map(i -> i.getIndexCode()).collect(Collectors.joining(",")));
monitorAlarmRecordEntity.setCheckInMethod(CheckInMethodEnum.自动签到.getValue());
monitorAlarmRecordEntity.setPicUri(faceMatch.getFacePicUrl());
monitorAlarmRecordEntity.setCreateTime(new Date());
monitorAlarmRecordEntity.setCreateUserName("system");
monitorAlarmRecordEntity.setCreateUserId(1L);
monitorAlarmRecordService.save(monitorAlarmRecordEntity);
} else {
log.info("当前人员:{}已经存在预约业务:{}记录数据", personCache.getName(), appointmentPersonEntity.getBussinessName());
}
}
}
}
}
}
package com.mortals.xhx.module.hik.event.service.impl;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.module.hik.event.model.req.callback.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.EventsItem;
import java.util.Date;
/**
* @author:
* @date: 2023/4/17 9:22
*/
public abstract class EventTypeAbstract {
private int type;
abstract int getType();
public abstract void saveEventData(EventsItem event);
public static EventTypeAbstract newType(int type) {
if (type == HikEventTypeEnum.重点人员识别事件.getValue()) {
return new BlackPlanRecoginze(type);
} else if (type == HikEventTypeEnum.陌生人员识别事件.getValue()) {
return new StrangerRecoginze(type);
} else {
throw new AppException(String.format("未知的类型码:%s", type));
}
}
public EventTypeAbstract(int type) {
this.type = type;
}
}
...@@ -113,9 +113,15 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -113,9 +113,15 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
//String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8"); //String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8");
Params params = req.getParams(); Params params = req.getParams();
if (HikAbilityEnum.人脸识别事件.getValue().equals(params.getAbility())) { if (HikAbilityEnum.人脸识别事件.getValue().equals(params.getAbility())) {
for (EventsItem event : params.getEvents()) { for (EventsItem event : params.getEvents()) {
EventData eventData = event.getData(); EventTypeAbstract eventTypeAbstract = EventTypeAbstract.newType(event.getEventType());
eventTypeAbstract.saveEventData(event);
// assessmentAbstract.initBidData(projectEntity, entity, supplierEntities);
/* EventData eventData = event.getData();
//识别结果 //识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult(); FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
//抓拍信息 //抓拍信息
...@@ -130,7 +136,6 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -130,7 +136,6 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
//保存当前识别结果到记录表中 //保存当前识别结果到记录表中
} }
} }
} else if (HikEventTypeEnum.陌生人员识别事件.getValue() == event.getEventType()) { } else if (HikEventTypeEnum.陌生人员识别事件.getValue() == event.getEventType()) {
//不论识别结果 保存流量数据 //不论识别结果 保存流量数据
RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity(); RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity();
...@@ -140,17 +145,13 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent ...@@ -140,17 +145,13 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
realtimeDataflowEntity.setPicUri(eventData.getFaceRecognitionResult().getSnap().getFaceUrl()); realtimeDataflowEntity.setPicUri(eventData.getFaceRecognitionResult().getSnap().getFaceUrl());
realtimeDataflowEntity.setEventId(event.getEventId()); realtimeDataflowEntity.setEventId(event.getEventId());
realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue()); realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue());
realtimeDataflowEntity.setCreateUserId(1L); realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(new Date()); realtimeDataflowEntity.setCreateTime(new Date());
realtimeDataflowEntity.setCreateUserName("system"); realtimeDataflowEntity.setCreateUserName("system");
realtimeDataflowEntity.initAttrValue(); realtimeDataflowEntity.initAttrValue();
//dataflowService.save() dataflowService.save(realtimeDataflowEntity);
} }*/
} }
......
package com.mortals.xhx.module.hik.event.service.impl;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.module.hik.event.model.req.callback.EventData;
import com.mortals.xhx.module.hik.event.model.req.callback.EventsItem;
import com.mortals.xhx.module.hik.event.model.req.callback.FaceRecognitionResult;
import com.mortals.xhx.module.hik.event.model.req.callback.Snap;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.stream.Collectors;
/**
* 陌生人员识别
*
* @author:
* @date: 2023/4/17 9:27
*/
@Slf4j
public class StrangerRecoginze extends EventTypeAbstract {
private RealtimeDataflowService dataflowService;
public StrangerRecoginze(int type) {
super(type);
this.dataflowService = SpringUtils.getBean(RealtimeDataflowService.class);
}
@Override
int getType() {
return HikEventTypeEnum.重点人员识别事件.getValue();
}
@Override
public void saveEventData(EventsItem event) {
EventData eventData = event.getData();
//识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
//抓拍信息
Snap snap = faceRecognitionResult.getSnap();
//不论识别结果 保存流量数据
RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity();
realtimeDataflowEntity.setDetectTime(event.getHappenTime());
String resIndexCodes = eventData.getResInfo().stream().map(i -> i.getIndexCode()).collect(Collectors.joining(","));
realtimeDataflowEntity.setDevice(resIndexCodes);
realtimeDataflowEntity.setPicUri(snap.getFaceUrl());
realtimeDataflowEntity.setEventId(event.getEventId());
realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue());
realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(new Date());
realtimeDataflowEntity.setCreateUserName("system");
realtimeDataflowEntity.initAttrValue();
dataflowService.save(realtimeDataflowEntity);
}
}
...@@ -274,7 +274,7 @@ public class MonitorAlarmEntity extends MonitorAlarmVo { ...@@ -274,7 +274,7 @@ public class MonitorAlarmEntity extends MonitorAlarmVo {
this.idNumber = ""; this.idNumber = "";
this.identifyNum = 0; this.identifyNum = 1;
this.lastIdentifyTime = null; this.lastIdentifyTime = null;
......
package com.mortals.xhx.module.person.web; package com.mortals.xhx.module.person.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -13,6 +16,9 @@ import com.mortals.xhx.module.person.model.PersonEntity; ...@@ -13,6 +16,9 @@ import com.mortals.xhx.module.person.model.PersonEntity;
import com.mortals.xhx.module.person.service.PersonService; import com.mortals.xhx.module.person.service.PersonService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,6 +41,8 @@ public class PersonController extends BaseCRUDJsonBodyMappingController<PersonSe ...@@ -35,6 +41,8 @@ public class PersonController extends BaseCRUDJsonBodyMappingController<PersonSe
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private UploadService uploadService;
public PersonController(){ public PersonController(){
super.setModuleDesc( "注册人员"); super.setModuleDesc( "注册人员");
...@@ -48,5 +56,15 @@ public class PersonController extends BaseCRUDJsonBodyMappingController<PersonSe ...@@ -48,5 +56,15 @@ public class PersonController extends BaseCRUDJsonBodyMappingController<PersonSe
super.init(model, context); super.init(model, context);
} }
@Override
public void doExportFileAfter(byte[] data, Context context) throws AppException {
InputStream inputStream = new ByteArrayInputStream(data);
MultipartFile file = ServletUtils.getMultipartFile(inputStream, "photo.jpg");
String filePath = uploadService.saveFileUpload(file, "file/fileupload",null);
}
@Override
public void doImportExcelAfter(MultipartFile file, List<PersonEntity> list, Context context) throws AppException {
String filePath = uploadService.saveFileUpload(file, "file/fileupload",null);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.realtime.model.vo; package com.mortals.xhx.module.realtime.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data; import lombok.Data;
/** /**
* 人员发现记录视图对象 * 人员发现记录视图对象
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
<result property="monitorDevice" column="monitorDevice" /> <result property="monitorDevice" column="monitorDevice" />
<result property="checkInMethod" column="checkInMethod" /> <result property="checkInMethod" column="checkInMethod" />
<result property="monitorCertificate" column="monitorCertificate" /> <result property="monitorCertificate" column="monitorCertificate" />
<result property="appointmentStatus" column="appointmentStatus" />
<result property="flowNum" column="flowNum" />
<result property="flowTime" column="flowTime" />
<result property="picUri" column="picUri" />
<result property="serverIndexCode" column="serverIndexCode" />
<result property="createUserId" column="createUserId" /> <result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" /> <result property="updateUserId" column="updateUserId" />
...@@ -72,6 +77,21 @@ ...@@ -72,6 +77,21 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('monitorCertificate') or colPickMode == 1 and data.containsKey('monitorCertificate')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('monitorCertificate') or colPickMode == 1 and data.containsKey('monitorCertificate')))">
a.monitorCertificate, a.monitorCertificate,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('appointmentStatus') or colPickMode == 1 and data.containsKey('appointmentStatus')))">
a.appointmentStatus,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('flowNum') or colPickMode == 1 and data.containsKey('flowNum')))">
a.flowNum,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('flowTime') or colPickMode == 1 and data.containsKey('flowTime')))">
a.flowTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('picUri') or colPickMode == 1 and data.containsKey('picUri')))">
a.picUri,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('serverIndexCode') or colPickMode == 1 and data.containsKey('serverIndexCode')))">
a.serverIndexCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
a.createUserId, a.createUserId,
</if> </if>
...@@ -89,18 +109,18 @@ ...@@ -89,18 +109,18 @@
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="AppointmentRecordsEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="AppointmentRecordsEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_appointment_records insert into mortals_xhx_appointment_records
(siteId,siteName,personId,name,contactInfo,idNumber,reservationService,reservationNumber,monitorTime,monitorDeviceId,monitorDevice,checkInMethod,monitorCertificate,createUserId,createTime,updateUserId,updateTime) (siteId,siteName,personId,name,contactInfo,idNumber,reservationService,reservationNumber,monitorTime,monitorDeviceId,monitorDevice,checkInMethod,monitorCertificate,appointmentStatus,flowNum,flowTime,picUri,serverIndexCode,createUserId,createTime,updateUserId,updateTime)
VALUES VALUES
(#{siteId},#{siteName},#{personId},#{name},#{contactInfo},#{idNumber},#{reservationService},#{reservationNumber},#{monitorTime},#{monitorDeviceId},#{monitorDevice},#{checkInMethod},#{monitorCertificate},#{createUserId},#{createTime},#{updateUserId},#{updateTime}) (#{siteId},#{siteName},#{personId},#{name},#{contactInfo},#{idNumber},#{reservationService},#{reservationNumber},#{monitorTime},#{monitorDeviceId},#{monitorDevice},#{checkInMethod},#{monitorCertificate},#{appointmentStatus},#{flowNum},#{flowTime},#{picUri},#{serverIndexCode},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_appointment_records insert into mortals_xhx_appointment_records
(siteId,siteName,personId,name,contactInfo,idNumber,reservationService,reservationNumber,monitorTime,monitorDeviceId,monitorDevice,checkInMethod,monitorCertificate,createUserId,createTime,updateUserId,updateTime) (siteId,siteName,personId,name,contactInfo,idNumber,reservationService,reservationNumber,monitorTime,monitorDeviceId,monitorDevice,checkInMethod,monitorCertificate,appointmentStatus,flowNum,flowTime,picUri,serverIndexCode,createUserId,createTime,updateUserId,updateTime)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteId},#{item.siteName},#{item.personId},#{item.name},#{item.contactInfo},#{item.idNumber},#{item.reservationService},#{item.reservationNumber},#{item.monitorTime},#{item.monitorDeviceId},#{item.monitorDevice},#{item.checkInMethod},#{item.monitorCertificate},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime}) (#{item.siteId},#{item.siteName},#{item.personId},#{item.name},#{item.contactInfo},#{item.idNumber},#{item.reservationService},#{item.reservationNumber},#{item.monitorTime},#{item.monitorDeviceId},#{item.monitorDevice},#{item.checkInMethod},#{item.monitorCertificate},#{item.appointmentStatus},#{item.flowNum},#{item.flowTime},#{item.picUri},#{item.serverIndexCode},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
</foreach> </foreach>
</insert> </insert>
...@@ -161,6 +181,24 @@ ...@@ -161,6 +181,24 @@
<if test="(colPickMode==0 and data.containsKey('monitorCertificate')) or (colPickMode==1 and !data.containsKey('monitorCertificate'))"> <if test="(colPickMode==0 and data.containsKey('monitorCertificate')) or (colPickMode==1 and !data.containsKey('monitorCertificate'))">
a.monitorCertificate=#{data.monitorCertificate}, a.monitorCertificate=#{data.monitorCertificate},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('appointmentStatus')) or (colPickMode==1 and !data.containsKey('appointmentStatus'))">
a.appointmentStatus=#{data.appointmentStatus},
</if>
<if test="(colPickMode==0 and data.containsKey('appointmentStatusIncrement')) or (colPickMode==1 and !data.containsKey('appointmentStatusIncrement'))">
a.appointmentStatus=ifnull(a.appointmentStatus,0) + #{data.appointmentStatusIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('flowNum')) or (colPickMode==1 and !data.containsKey('flowNum'))">
a.flowNum=#{data.flowNum},
</if>
<if test="(colPickMode==0 and data.containsKey('flowTime')) or (colPickMode==1 and !data.containsKey('flowTime'))">
a.flowTime=#{data.flowTime},
</if>
<if test="(colPickMode==0 and data.containsKey('picUri')) or (colPickMode==1 and !data.containsKey('picUri'))">
a.picUri=#{data.picUri},
</if>
<if test="(colPickMode==0 and data.containsKey('serverIndexCode')) or (colPickMode==1 and !data.containsKey('serverIndexCode'))">
a.serverIndexCode=#{data.serverIndexCode},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))"> <if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
a.createUserId=#{data.createUserId}, a.createUserId=#{data.createUserId},
</if> </if>
...@@ -301,6 +339,46 @@ ...@@ -301,6 +339,46 @@
when a.id=#{item.id} then #{item.monitorCertificate} when a.id=#{item.id} then #{item.monitorCertificate}
</if> </if>
</foreach> </foreach>
</trim>
<trim prefix="appointmentStatus=(case" suffix="ELSE appointmentStatus end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('appointmentStatus')) or (colPickMode==1 and !item.containsKey('appointmentStatus'))">
when a.id=#{item.id} then #{item.appointmentStatus}
</when>
<when test="(colPickMode==0 and item.containsKey('appointmentStatusIncrement')) or (colPickMode==1 and !item.containsKey('appointmentStatusIncrement'))">
when a.id=#{item.id} then ifnull(a.appointmentStatus,0) + #{item.appointmentStatusIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="flowNum=(case" suffix="ELSE flowNum end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('flowNum')) or (colPickMode==1 and !item.containsKey('flowNum'))">
when a.id=#{item.id} then #{item.flowNum}
</if>
</foreach>
</trim>
<trim prefix="flowTime=(case" suffix="ELSE flowTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('flowTime')) or (colPickMode==1 and !item.containsKey('flowTime'))">
when a.id=#{item.id} then #{item.flowTime}
</if>
</foreach>
</trim>
<trim prefix="picUri=(case" suffix="ELSE picUri end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('picUri')) or (colPickMode==1 and !item.containsKey('picUri'))">
when a.id=#{item.id} then #{item.picUri}
</if>
</foreach>
</trim>
<trim prefix="serverIndexCode=(case" suffix="ELSE serverIndexCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('serverIndexCode')) or (colPickMode==1 and !item.containsKey('serverIndexCode'))">
when a.id=#{item.id} then #{item.serverIndexCode}
</if>
</foreach>
</trim> </trim>
<trim prefix="createUserId=(case" suffix="ELSE createUserId end),"> <trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
...@@ -774,6 +852,111 @@ ...@@ -774,6 +852,111 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('appointmentStatus')">
<if test="conditionParamRef.appointmentStatus != null ">
${_conditionType_} a.appointmentStatus = #{${_conditionParam_}.appointmentStatus}
</if>
<if test="conditionParamRef.appointmentStatus == null">
${_conditionType_} a.appointmentStatus is null
</if>
</if>
<if test="conditionParamRef.containsKey('appointmentStatusList') and conditionParamRef.appointmentStatusList.size() > 0">
${_conditionType_} a.appointmentStatus in
<foreach collection="conditionParamRef.appointmentStatusList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('appointmentStatusNotList') and conditionParamRef.appointmentStatusNotList.size() > 0">
${_conditionType_} a.appointmentStatus not in
<foreach collection="conditionParamRef.appointmentStatusNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('appointmentStatusStart') and conditionParamRef.appointmentStatusStart != null">
${_conditionType_} a.appointmentStatus <![CDATA[ >= ]]> #{${_conditionParam_}.appointmentStatusStart}
</if>
<if test="conditionParamRef.containsKey('appointmentStatusEnd') and conditionParamRef.appointmentStatusEnd != null">
${_conditionType_} a.appointmentStatus <![CDATA[ <= ]]> #{${_conditionParam_}.appointmentStatusEnd}
</if>
<if test="conditionParamRef.containsKey('flowNum')">
<if test="conditionParamRef.flowNum != null and conditionParamRef.flowNum != ''">
${_conditionType_} a.flowNum like #{${_conditionParam_}.flowNum}
</if>
<if test="conditionParamRef.flowNum == null">
${_conditionType_} a.flowNum is null
</if>
</if>
<if test="conditionParamRef.containsKey('flowNumList') and conditionParamRef.flowNumList.size() > 0">
${_conditionType_} a.flowNum in
<foreach collection="conditionParamRef.flowNumList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('flowNumNotList') and conditionParamRef.flowNumNotList.size() > 0">
${_conditionType_} a.flowNum not in
<foreach collection="conditionParamRef.flowNumNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('flowTime')">
<if test="conditionParamRef.flowTime != null ">
${_conditionType_} a.flowTime = #{${_conditionParam_}.flowTime}
</if>
<if test="conditionParamRef.flowTime == null">
${_conditionType_} a.flowTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('flowTimeStart') and conditionParamRef.flowTimeStart != null and conditionParamRef.flowTimeStart!=''">
${_conditionType_} a.flowTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.flowTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('flowTimeEnd') and conditionParamRef.flowTimeEnd != null and conditionParamRef.flowTimeEnd!=''">
${_conditionType_} a.flowTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.flowTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('picUri')">
<if test="conditionParamRef.picUri != null and conditionParamRef.picUri != ''">
${_conditionType_} a.picUri like #{${_conditionParam_}.picUri}
</if>
<if test="conditionParamRef.picUri == null">
${_conditionType_} a.picUri is null
</if>
</if>
<if test="conditionParamRef.containsKey('picUriList') and conditionParamRef.picUriList.size() > 0">
${_conditionType_} a.picUri in
<foreach collection="conditionParamRef.picUriList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('picUriNotList') and conditionParamRef.picUriNotList.size() > 0">
${_conditionType_} a.picUri not in
<foreach collection="conditionParamRef.picUriNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('serverIndexCode')">
<if test="conditionParamRef.serverIndexCode != null and conditionParamRef.serverIndexCode != ''">
${_conditionType_} a.serverIndexCode like #{${_conditionParam_}.serverIndexCode}
</if>
<if test="conditionParamRef.serverIndexCode == null">
${_conditionType_} a.serverIndexCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('serverIndexCodeList') and conditionParamRef.serverIndexCodeList.size() > 0">
${_conditionType_} a.serverIndexCode in
<foreach collection="conditionParamRef.serverIndexCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('serverIndexCodeNotList') and conditionParamRef.serverIndexCodeNotList.size() > 0">
${_conditionType_} a.serverIndexCode not in
<foreach collection="conditionParamRef.serverIndexCodeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserId')"> <if test="conditionParamRef.containsKey('createUserId')">
<if test="conditionParamRef.createUserId != null "> <if test="conditionParamRef.createUserId != null ">
${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId} ${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
...@@ -941,6 +1124,31 @@ ...@@ -941,6 +1124,31 @@
<if test='orderCol.monitorCertificate != null and "DESC".equalsIgnoreCase(orderCol.monitorCertificate)'>DESC</if> <if test='orderCol.monitorCertificate != null and "DESC".equalsIgnoreCase(orderCol.monitorCertificate)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('appointmentStatus')">
a.appointmentStatus
<if test='orderCol.appointmentStatus != null and "DESC".equalsIgnoreCase(orderCol.appointmentStatus)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('flowNum')">
a.flowNum
<if test='orderCol.flowNum != null and "DESC".equalsIgnoreCase(orderCol.flowNum)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('flowTime')">
a.flowTime
<if test='orderCol.flowTime != null and "DESC".equalsIgnoreCase(orderCol.flowTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('picUri')">
a.picUri
<if test='orderCol.picUri != null and "DESC".equalsIgnoreCase(orderCol.picUri)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('serverIndexCode')">
a.serverIndexCode
<if test='orderCol.serverIndexCode != null and "DESC".equalsIgnoreCase(orderCol.serverIndexCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createUserId')"> <if test="orderCol.containsKey('createUserId')">
a.createUserId a.createUserId
<if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if> <if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
......
...@@ -30,19 +30,24 @@ Authorization: {{authToken}} ...@@ -30,19 +30,24 @@ Authorization: {{authToken}}
Content-Type: application/json Content-Type: application/json
{ {
"siteId":771, "siteId":526,
"siteName":"a4pdxm", "siteName":"2pbm62",
"personId":690, "personId":727,
"name":"0i4ese", "name":"jkowci",
"contactInfo":"xh1x2r", "contactInfo":"f0y3am",
"idNumber":"ald5ri", "idNumber":"v9yk7u",
"reservationService":"pxfv7b", "reservationService":"m6ho0v",
"reservationNumber":"zt82er", "reservationNumber":"90im19",
"monitorTime":"1680969600000", "monitorTime":"1681660800000",
"monitorDeviceId":674, "monitorDeviceId":467,
"monitorDevice":"loxzwu", "monitorDevice":"acwtwi",
"checkInMethod":0, "checkInMethod":0,
"monitorCertificate":"4s4yk4", "monitorCertificate":"1p60xj",
"appointmentStatus":0,
"flowNum":"pldacl",
"flowTime":"1681660800000",
"picUri":"8pp1cq",
"serverIndexCode":"tpmae4",
} }
> {% > {%
......
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