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

添加同步预约和注册用户类

parent d83cebef
......@@ -16,12 +16,17 @@ CREATE TABLE mortals_xhx_realtime_dataflow(
`queueNum` varchar(255) NOT NULL COMMENT '排队编码',
`location` varchar(255) NOT NULL COMMENT '办理位置',
`picture` varchar(255) COMMENT '识别截图',
`picUri` varchar(255) COMMENT '相对图片pic',
`serverIndexCode` varchar(255) COMMENT '图片资源唯一标识',
`eventId` varchar(255) COMMENT '事件id',
`eventType` bigint(20) NOT NULL COMMENT '事件类型',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建人id',
`updateTime` datetime COMMENT '更新时间',
`updateUserId` bigint(20) COMMENT '更新人id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='人员发现记录';
-- ----------------------------
-- 预约签到记录表
-- ----------------------------
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 海康事件类型
*
* @author zxfei
*/
public enum HikAbilityEnum {
人脸识别事件("event_face_recognition", "人脸识别事件");
private String value;
private String desc;
HikAbilityEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static HikAbilityEnum getByValue(String value) {
for (HikAbilityEnum recognitionPlanTypeEnum : HikAbilityEnum.values()) {
if (recognitionPlanTypeEnum.getValue() == value) {
return recognitionPlanTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HikAbilityEnum item : HikAbilityEnum.values()) {
try {
boolean hasE = false;
for (String 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
......@@ -4,21 +4,22 @@ import java.util.LinkedHashMap;
import java.util.Map;
/**
* 海康事件类型
* 周五是否监测(0.否,1.是)枚举类
*
* @author zxfei
*/
public enum HikEventTypeEnum {
重点人员识别事件("event_face_recognition", "重点人员识别事件");
private String value;
重点人员识别事件(1644175361, "重点人员识别事件"),
陌生人员识别事件(1644171265, "陌生人员识别事件");
private Integer value;
private String desc;
HikEventTypeEnum(String value, String desc) {
HikEventTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
public Integer getValue() {
return this.value;
}
......@@ -26,10 +27,10 @@ public enum HikEventTypeEnum {
return this.desc;
}
public static HikEventTypeEnum getByValue(String value) {
for (HikEventTypeEnum recognitionPlanTypeEnum : HikEventTypeEnum.values()) {
if (recognitionPlanTypeEnum.getValue() == value) {
return recognitionPlanTypeEnum;
public static HikEventTypeEnum getByValue(Integer value) {
for (HikEventTypeEnum fridayEnum : HikEventTypeEnum.values()) {
if (fridayEnum.getValue() == value) {
return fridayEnum;
}
}
return null;
......@@ -41,12 +42,12 @@ public enum HikEventTypeEnum {
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (HikEventTypeEnum item : HikEventTypeEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
......
......@@ -44,6 +44,7 @@ import java.util.stream.Collectors;
/**
* 同步预约人数。
* 定时每日执行,执行前删除当天已经同步的预约人
*/
@Slf4j
@Service("SyncAppointmentPersonTask")
......@@ -93,7 +94,6 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService {
if (restTotal.getCode() == YesNoEnum.YES.getValue()) {
//同步今天预约用户
List<AppointmentDataItem> appointUserList = restTotal.getData().getData();
log.info("预约用户总数量:{}", appointUserList.size());
if (!ObjectUtils.isEmpty(appointUserList)) {
//查询今天添加的预约 并删除
......@@ -124,9 +124,8 @@ public class SyncAppointmentPersonTaskImpl implements ITaskExcuteService {
return appointmentPersonEntity;
}).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(newUserList)) {
log.info("注册用户新增,size:{}", newUserList.size());
log.info("预约用户新增,size:{}", newUserList.size());
appointmentPersonService.save(newUserList);
}
}
......
......@@ -29,7 +29,7 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* 同步注册用户与预约人数
* 同步注册用户的证件照片
*/
@Slf4j
@Service("SyncRegisterUserPicTask")
......
......@@ -57,7 +57,8 @@ import java.util.Map;
import java.util.stream.Collectors;
/**
* 同步注册用户与预约人数。
* 同步注册用户。
* 定时以一定时间间隔进行人员获取 定时时间要早于每日预约人数的同步时间
*/
@Slf4j
@Service("SyncRegisterUserTask")
......@@ -181,10 +182,10 @@ public class SyncRegisterUserTaskImpl implements ITaskExcuteService {
personService.save(saveUserList);
}
if (!ObjectUtils.isEmpty(delUserList)) {
log.info("注册用户删除,size:{}", delUserList.size());
personService.remove(delUserList, null);
}
// if (!ObjectUtils.isEmpty(delUserList)) {
// log.info("注册用户删除,size:{}", delUserList.size());
// personService.remove(delUserList, null);
// }
}
......
......@@ -22,7 +22,7 @@ import org.springframework.util.ObjectUtils;
import java.util.List;
/**
* 同步用户,唯一标识为用户名。
* 同步门户用户,唯一标识为用户名。
*/
@Slf4j
@Service("SyncUserTask")
......
......@@ -41,7 +41,9 @@ import java.util.Date;
import java.util.List;
/**
* 同步用户到海康指定库。
* 同步用户人脸数据到海康指定库。
* 时间间隔以同步注册用户之后
* 默认同步到一个人脸用户组,如要其它用户组 则页面上进行添加
*/
@Slf4j
@Service("SyncUserToHikTask")
......
......@@ -17,7 +17,6 @@ public abstract class AbstractHikService {
@Value("${hik.appSecret:''}")
protected String appSecret;
@Value("${hik.protocol:http://}")
protected String protocol;
......
......@@ -7,6 +7,7 @@ import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.util.DataUtil;
import com.mortals.xhx.common.code.HikAbilityEnum;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.hik.AbstractHikService;
......@@ -24,6 +25,7 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 海康人员接口类
......@@ -111,35 +113,34 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
//String similarity = GlobalSysInfo.getParamValue(ParamKey.PARAM_FACE_SIMILARITY, "0.8");
Params params = req.getParams();
if (HikEventTypeEnum.重点人员识别事件.getValue().equals(params.getAbility())) {
params.getEvents();
if (HikAbilityEnum.人脸识别事件.getValue().equals(params.getAbility())) {
for (EventsItem event : params.getEvents()) {
//事件详细
String eventId = event.getEventId();
int eventType = event.getEventType();
EventData eventData = event.getData();
//识别结果
FaceRecognitionResult faceRecognitionResult = eventData.getFaceRecognitionResult();
//抓拍信息
Snap snap = faceRecognitionResult.getSnap();
if (HikEventTypeEnum.重点人员识别事件.getValue() == event.getEventType()) {
//处理重点人员事件
//匹配的结果
List<FaceMatchItem> faceMatchs = faceRecognitionResult.getFaceMatch();
for (FaceMatchItem faceMatch : faceMatchs) {
//根据匹配结果 保存业务数据 todo
if (faceMatch.getSimilarity() > similarity) {
//保存当前识别结果到记录表中
}
}
} else if (HikEventTypeEnum.陌生人员识别事件.getValue() == event.getEventType()) {
//不论识别结果 保存流量数据
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(eventData.getFaceRecognitionResult().getSnap().getFaceUrl());
realtimeDataflowEntity.setEventId(event.getEventId());
realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue());
// realtimeDataflowEntity.setPersonId();
// realtimeDataflowEntity.setName();
// realtimeDataflowEntity.setDevice();
// realtimeDataflowEntity.setDetectTime();
// realtimeDataflowEntity.setContact();
// realtimeDataflowEntity.setIdNumber();
// realtimeDataflowEntity.setIsBooking();
// realtimeDataflowEntity.setQueueNum();
// realtimeDataflowEntity.setLocation();
// realtimeDataflowEntity.setPicture();
// realtimeDataflowEntity.setOrderCols();
// realtimeDataflowEntity.setOrderColList();
realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(new Date());
......@@ -149,14 +150,6 @@ public class HikEventServiceImpl extends AbstractHikService implements IHikEvent
realtimeDataflowEntity.initAttrValue();
//dataflowService.save()
//根据匹配结果 保存业务数据 todo
if(faceMatch.getSimilarity()>similarity){
//保存当前识别结果到记录表中
}else {
//识别为陌生人 保存
}
}
......
......@@ -33,8 +33,6 @@ import static com.mortals.framework.ap.SysConstains.*;
@RequestMapping("monitor/alarm")
public class MonitorAlarmController extends BaseCRUDJsonBodyMappingController<MonitorAlarmService,MonitorAlarmEntity,Long> {
@Autowired
private ParamService paramService;
public MonitorAlarmController(){
super.setModuleDesc( "监测预警记录");
......
......@@ -8,11 +8,11 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.realtime.model.vo.RealtimeDataflowVo;
/**
* 人员发现记录实体对象
*
* @author zxfei
* @date 2023-04-09
*/
* 人员发现记录实体对象
*
* @author zxfei
* @date 2023-04-16
*/
public class RealtimeDataflowEntity extends RealtimeDataflowVo {
private static final long serialVersionUID = 1L;
......@@ -75,6 +75,23 @@ public class RealtimeDataflowEntity extends RealtimeDataflowVo {
*/
@Excel(name = "识别截图")
private String picture;
/**
* 相对图片pic
*/
private String picUri;
/**
* 图片资源唯一标识
*/
private String serverIndexCode;
/**
* 事件id
*/
private String eventId;
/**
* 事件类型
*/
@Excel(name = "事件类型")
private Long eventType;
......@@ -247,6 +264,62 @@ public class RealtimeDataflowEntity extends RealtimeDataflowVo {
public void setPicture(String picture){
this.picture = picture;
}
/**
* 获取 相对图片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;
}
/**
* 获取 事件id
* @return String
*/
public String getEventId(){
return eventId;
}
/**
* 设置 事件id
* @param eventId
*/
public void setEventId(String eventId){
this.eventId = eventId;
}
/**
* 获取 事件类型
* @return Long
*/
public Long getEventType(){
return eventType;
}
/**
* 设置 事件类型
* @param eventType
*/
public void setEventType(Long eventType){
this.eventType = eventType;
}
......@@ -281,6 +354,10 @@ public class RealtimeDataflowEntity extends RealtimeDataflowVo {
sb.append(",queueNum:").append(getQueueNum());
sb.append(",location:").append(getLocation());
sb.append(",picture:").append(getPicture());
sb.append(",picUri:").append(getPicUri());
sb.append(",serverIndexCode:").append(getServerIndexCode());
sb.append(",eventId:").append(getEventId());
sb.append(",eventType:").append(getEventType());
return sb.toString();
}
......@@ -309,5 +386,13 @@ public class RealtimeDataflowEntity extends RealtimeDataflowVo {
this.location = "";
this.picture = "";
this.picUri = "";
this.serverIndexCode = "";
this.eventId = "";
this.eventType = null;
}
}
\ No newline at end of file
......@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
/**
* 人员发现记录查询对象
*
* @author zxfei
* @date 2023-04-09
*/
* 人员发现记录查询对象
*
* @author zxfei
* @date 2023-04-16
*/
public class RealtimeDataflowQuery extends RealtimeDataflowEntity {
/** 开始 主键ID,主键,自增长 */
private Long idStart;
......@@ -116,6 +116,36 @@ public class RealtimeDataflowQuery extends RealtimeDataflowEntity {
/** 识别截图排除列表 */
private List <String> pictureNotList;
/** 相对图片pic */
private List<String> picUriList;
/** 相对图片pic排除列表 */
private List <String> picUriNotList;
/** 图片资源唯一标识 */
private List<String> serverIndexCodeList;
/** 图片资源唯一标识排除列表 */
private List <String> serverIndexCodeNotList;
/** 事件id */
private List<String> eventIdList;
/** 事件id排除列表 */
private List <String> eventIdNotList;
/** 开始 事件类型 */
private Long eventTypeStart;
/** 结束 事件类型 */
private Long eventTypeEnd;
/** 增加 事件类型 */
private Long eventTypeIncrement;
/** 事件类型列表 */
private List <Long> eventTypeList;
/** 事件类型排除列表 */
private List <Long> eventTypeNotList;
/** 开始 创建时间 */
private String createTimeStart;
......@@ -778,6 +808,183 @@ public class RealtimeDataflowQuery extends RealtimeDataflowEntity {
this.pictureNotList = pictureNotList;
}
/**
* 获取 相对图片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
* @return eventIdList
*/
public List<String> getEventIdList(){
return this.eventIdList;
}
/**
* 设置 事件id
* @param eventIdList
*/
public void setEventIdList(List<String> eventIdList){
this.eventIdList = eventIdList;
}
/**
* 获取 事件id
* @return eventIdNotList
*/
public List<String> getEventIdNotList(){
return this.eventIdNotList;
}
/**
* 设置 事件id
* @param eventIdNotList
*/
public void setEventIdNotList(List<String> eventIdNotList){
this.eventIdNotList = eventIdNotList;
}
/**
* 获取 开始 事件类型
* @return eventTypeStart
*/
public Long getEventTypeStart(){
return this.eventTypeStart;
}
/**
* 设置 开始 事件类型
* @param eventTypeStart
*/
public void setEventTypeStart(Long eventTypeStart){
this.eventTypeStart = eventTypeStart;
}
/**
* 获取 结束 事件类型
* @return $eventTypeEnd
*/
public Long getEventTypeEnd(){
return this.eventTypeEnd;
}
/**
* 设置 结束 事件类型
* @param eventTypeEnd
*/
public void setEventTypeEnd(Long eventTypeEnd){
this.eventTypeEnd = eventTypeEnd;
}
/**
* 获取 增加 事件类型
* @return eventTypeIncrement
*/
public Long getEventTypeIncrement(){
return this.eventTypeIncrement;
}
/**
* 设置 增加 事件类型
* @param eventTypeIncrement
*/
public void setEventTypeIncrement(Long eventTypeIncrement){
this.eventTypeIncrement = eventTypeIncrement;
}
/**
* 获取 事件类型
* @return eventTypeList
*/
public List<Long> getEventTypeList(){
return this.eventTypeList;
}
/**
* 设置 事件类型
* @param eventTypeList
*/
public void setEventTypeList(List<Long> eventTypeList){
this.eventTypeList = eventTypeList;
}
/**
* 获取 事件类型
* @return eventTypeNotList
*/
public List<Long> getEventTypeNotList(){
return this.eventTypeNotList;
}
/**
* 设置 事件类型
* @param eventTypeNotList
*/
public void setEventTypeNotList(List<Long> eventTypeNotList){
this.eventTypeNotList = eventTypeNotList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
......@@ -1374,6 +1581,117 @@ public class RealtimeDataflowQuery extends RealtimeDataflowEntity {
}
/**
* 设置 相对图片pic
* @param picUri
*/
public RealtimeDataflowQuery picUri(String picUri){
setPicUri(picUri);
return this;
}
/**
* 设置 相对图片pic
* @param picUriList
*/
public RealtimeDataflowQuery picUriList(List<String> picUriList){
this.picUriList = picUriList;
return this;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCode
*/
public RealtimeDataflowQuery serverIndexCode(String serverIndexCode){
setServerIndexCode(serverIndexCode);
return this;
}
/**
* 设置 图片资源唯一标识
* @param serverIndexCodeList
*/
public RealtimeDataflowQuery serverIndexCodeList(List<String> serverIndexCodeList){
this.serverIndexCodeList = serverIndexCodeList;
return this;
}
/**
* 设置 事件id
* @param eventId
*/
public RealtimeDataflowQuery eventId(String eventId){
setEventId(eventId);
return this;
}
/**
* 设置 事件id
* @param eventIdList
*/
public RealtimeDataflowQuery eventIdList(List<String> eventIdList){
this.eventIdList = eventIdList;
return this;
}
/**
* 设置 事件类型
* @param eventType
*/
public RealtimeDataflowQuery eventType(Long eventType){
setEventType(eventType);
return this;
}
/**
* 设置 开始 事件类型
* @param eventTypeStart
*/
public RealtimeDataflowQuery eventTypeStart(Long eventTypeStart){
this.eventTypeStart = eventTypeStart;
return this;
}
/**
* 设置 结束 事件类型
* @param eventTypeEnd
*/
public RealtimeDataflowQuery eventTypeEnd(Long eventTypeEnd){
this.eventTypeEnd = eventTypeEnd;
return this;
}
/**
* 设置 增加 事件类型
* @param eventTypeIncrement
*/
public RealtimeDataflowQuery eventTypeIncrement(Long eventTypeIncrement){
this.eventTypeIncrement = eventTypeIncrement;
return this;
}
/**
* 设置 事件类型
* @param eventTypeList
*/
public RealtimeDataflowQuery eventTypeList(List<Long> eventTypeList){
this.eventTypeList = eventTypeList;
return this;
}
/**
* 设置 事件类型
* @param eventTypeNotList
*/
public RealtimeDataflowQuery eventTypeNotList(List<Long> eventTypeNotList){
this.eventTypeNotList = eventTypeNotList;
return this;
}
/**
* 设置 创建人id
* @param createUserId
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.realtime.dao.ibatis.RealtimeDataflowDaoImpl">
<!-- 字段和属性映射 -->
......@@ -18,6 +18,10 @@
<result property="queueNum" column="queueNum" />
<result property="location" column="location" />
<result property="picture" column="picture" />
<result property="picUri" column="picUri" />
<result property="serverIndexCode" column="serverIndexCode" />
<result property="eventId" column="eventId" />
<result property="eventType" column="eventType" />
<result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" />
......@@ -68,6 +72,18 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('picture') or colPickMode == 1 and data.containsKey('picture')))">
a.picture,
</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('eventId') or colPickMode == 1 and data.containsKey('eventId')))">
a.eventId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('eventType') or colPickMode == 1 and data.containsKey('eventType')))">
a.eventType,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
......@@ -85,18 +101,18 @@
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="RealtimeDataflowEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_realtime_dataflow
(siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,createTime,createUserId,updateTime,updateUserId)
(siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,picUri,serverIndexCode,eventId,eventType,createTime,createUserId,updateTime,updateUserId)
VALUES
(#{siteId},#{siteName},#{personId},#{name},#{device},#{detectTime},#{contact},#{idNumber},#{isBooking},#{queueNum},#{location},#{picture},#{createTime},#{createUserId},#{updateTime},#{updateUserId})
(#{siteId},#{siteName},#{personId},#{name},#{device},#{detectTime},#{contact},#{idNumber},#{isBooking},#{queueNum},#{location},#{picture},#{picUri},#{serverIndexCode},#{eventId},#{eventType},#{createTime},#{createUserId},#{updateTime},#{updateUserId})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_realtime_dataflow
(siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,createTime,createUserId,updateTime,updateUserId)
(siteId,siteName,personId,name,device,detectTime,contact,idNumber,isBooking,queueNum,location,picture,picUri,serverIndexCode,eventId,eventType,createTime,createUserId,updateTime,updateUserId)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteId},#{item.siteName},#{item.personId},#{item.name},#{item.device},#{item.detectTime},#{item.contact},#{item.idNumber},#{item.isBooking},#{item.queueNum},#{item.location},#{item.picture},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.updateUserId})
(#{item.siteId},#{item.siteName},#{item.personId},#{item.name},#{item.device},#{item.detectTime},#{item.contact},#{item.idNumber},#{item.isBooking},#{item.queueNum},#{item.location},#{item.picture},#{item.picUri},#{item.serverIndexCode},#{item.eventId},#{item.eventType},#{item.createTime},#{item.createUserId},#{item.updateTime},#{item.updateUserId})
</foreach>
</insert>
......@@ -151,6 +167,21 @@
<if test="(colPickMode==0 and data.containsKey('picture')) or (colPickMode==1 and !data.containsKey('picture'))">
a.picture=#{data.picture},
</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('eventId')) or (colPickMode==1 and !data.containsKey('eventId'))">
a.eventId=#{data.eventId},
</if>
<if test="(colPickMode==0 and data.containsKey('eventType')) or (colPickMode==1 and !data.containsKey('eventType'))">
a.eventType=#{data.eventType},
</if>
<if test="(colPickMode==0 and data.containsKey('eventTypeIncrement')) or (colPickMode==1 and !data.containsKey('eventTypeIncrement'))">
a.eventType=ifnull(a.eventType,0) + #{data.eventTypeIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
......@@ -280,6 +311,39 @@
</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 prefix="eventId=(case" suffix="ELSE eventId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('eventId')) or (colPickMode==1 and !item.containsKey('eventId'))">
when a.id=#{item.id} then #{item.eventId}
</if>
</foreach>
</trim>
<trim prefix="eventType=(case" suffix="ELSE eventType end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('eventType')) or (colPickMode==1 and !item.containsKey('eventType'))">
when a.id=#{item.id} then #{item.eventType}
</when>
<when test="(colPickMode==0 and item.containsKey('eventTypeIncrement')) or (colPickMode==1 and !item.containsKey('eventTypeIncrement'))">
when a.id=#{item.id} then ifnull(a.eventType,0) + #{item.eventTypeIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
......@@ -726,6 +790,96 @@
</foreach>
</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('eventId')">
<if test="conditionParamRef.eventId != null and conditionParamRef.eventId != ''">
${_conditionType_} a.eventId like #{${_conditionParam_}.eventId}
</if>
<if test="conditionParamRef.eventId == null">
${_conditionType_} a.eventId is null
</if>
</if>
<if test="conditionParamRef.containsKey('eventIdList') and conditionParamRef.eventIdList.size() > 0">
${_conditionType_} a.eventId in
<foreach collection="conditionParamRef.eventIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('eventIdNotList') and conditionParamRef.eventIdNotList.size() > 0">
${_conditionType_} a.eventId not in
<foreach collection="conditionParamRef.eventIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('eventType')">
<if test="conditionParamRef.eventType != null ">
${_conditionType_} a.eventType = #{${_conditionParam_}.eventType}
</if>
<if test="conditionParamRef.eventType == null">
${_conditionType_} a.eventType is null
</if>
</if>
<if test="conditionParamRef.containsKey('eventTypeList') and conditionParamRef.eventTypeList.size() > 0">
${_conditionType_} a.eventType in
<foreach collection="conditionParamRef.eventTypeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('eventTypeNotList') and conditionParamRef.eventTypeNotList.size() > 0">
${_conditionType_} a.eventType not in
<foreach collection="conditionParamRef.eventTypeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('eventTypeStart') and conditionParamRef.eventTypeStart != null">
${_conditionType_} a.eventType <![CDATA[ >= ]]> #{${_conditionParam_}.eventTypeStart}
</if>
<if test="conditionParamRef.containsKey('eventTypeEnd') and conditionParamRef.eventTypeEnd != null">
${_conditionType_} a.eventType <![CDATA[ <= ]]> #{${_conditionParam_}.eventTypeEnd}
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
......@@ -887,6 +1041,26 @@
<if test='orderCol.picture != null and "DESC".equalsIgnoreCase(orderCol.picture)'>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('eventId')">
a.eventId
<if test='orderCol.eventId != null and "DESC".equalsIgnoreCase(orderCol.eventId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('eventType')">
a.eventType
<if test='orderCol.eventType != null and "DESC".equalsIgnoreCase(orderCol.eventType)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
......
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