Commit 4e429a9d by xmh

初版

1 parent d9f6a1f8
Showing 64 changed files with 2298 additions and 1214 deletions
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
| decoration | VARCHAR(36) | | | 摆件 | | decoration | VARCHAR(36) | | | 摆件 |
| sun_shield | VARCHAR(36) | | | 遮阳板 | | sun_shield | VARCHAR(36) | | | 遮阳板 |
| xcycle_type | VARCHAR(36) | | | 非机动车类型 | | xcycle_type | VARCHAR(36) | | | 非机动车类型 |
| event_id | VARCHAR(36) | | | | | event_id | VARCHAR(64) | | | |
| shoot_time | TIMESTAMP | | | | | shoot_time | TIMESTAMP | | | |
| special_type | VARCHAR(36) | | | | | special_type | VARCHAR(36) | | | |
| with_helmet | INT | | 0 | 是否戴头盔(0不带) | | with_helmet | INT | | 0 | 是否戴头盔(0不带) |
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
| ---------------- | ------------ | -------- | ------ | ---------- | | ---------------- | ------------ | -------- | ------ | ---------- |
| id | BIGINT | 否 | | 自增主键ID | | id | BIGINT | 否 | | 自增主键ID |
| unid | VARCHAR(36) | 否 | uuid() | 唯一ID | | unid | VARCHAR(36) | 否 | uuid() | 唯一ID |
| event_id | VARCHAR(36) | 否 | | | | event_id | VARCHAR(64) | 否 | | |
| task_id | BIGINT | | | | | task_id | BIGINT | | | |
| detection_type | VARCHAR(36) | | | | | detection_type | VARCHAR(36) | | | |
| road_code | VARCHAR(36) | | | | | road_code | VARCHAR(36) | | | |
...@@ -191,14 +191,11 @@ ...@@ -191,14 +191,11 @@
| event_type | VARCHAR(36) | | | | | event_type | VARCHAR(36) | | | |
| event_refid | VARCHAR(36) | | | | | event_refid | VARCHAR(36) | | | |
| event_time | TIMESTAMP | | | | | event_time | TIMESTAMP | | | |
| aux_dev_info | TEXT | | | |
| event_data | TEXT | | | | | event_data | TEXT | | | |
| pics | TEXT | | | | | pics | TEXT | | | |
| video | TEXT | | | | | video | TEXT | | | |
| event_cate | VARCHAR(36) | | | | | event_cate | VARCHAR(36) | | | |
| vchan_ref_id | VARCHAR(36) | | | | | channel_unid | VARCHAR(36) | | | |
| test_pic_file | VARCHAR(256) | | | |
| test_frame_no | VARCHAR(256) | | | |
| task_name | VARCHAR(128) | | | | | task_name | VARCHAR(128) | | | |
| event_data_num | VARCHAR(36) | | | | | event_data_num | VARCHAR(36) | | | |
...@@ -253,6 +250,30 @@ ...@@ -253,6 +250,30 @@
| name | VARCHAR(36) | 否 | | cate名称 | | name | VARCHAR(36) | 否 | | cate名称 |
| note | VARCHAR(128) | | | 注释 | | note | VARCHAR(128) | | | 注释 |
### 运维服务模块
#### s_channel 视频通道表
| 字段名称 | 类型 | 可否为空 | 默认值 | 注释 |
| ------------ | ------------- | -------- | ------ | ------------------ |
| id | BIGINT | 否 | | 自增主键ID |
| unid | VARCHAR(36) | 否 | uuid() | 唯一ID |
| channel_unid | VARCHAR(36) | | | 原通道unid |
| device_unid | VARCHAR(36) | 否 | | 原设备unid |
| type | INT | | | 设备类型 |
| stream_type | INT | | | 设备流类型 |
| stream_path | VARCHAR(1024) | | | 视频流地址 |
| username | varchar(36) | | | 用户名 |
| password | varchar(64) | | | 密码 |
| address_unid | VARCHAR(36) | | | 设备挂载地址的unid |
| name | VARCHAR(128) | | | 设备名称 |
| ip | VARCHAR(36) | | | 设备ip |
| port | INT | | | 设备端口 |
| expand | VARCHAR(128) | | | 扩展字段 |
| longitude | FLOAT | | | 经度 |
| latitude | FLOAT | | | 纬度 |
| status | INT | | | 状态 |
## 接口 ## 接口
### 任务管理模块 ### 任务管理模块
...@@ -406,48 +427,9 @@ ...@@ -406,48 +427,9 @@
#### VAServer心跳接口 #### VAServer心跳接口
- **path** - **path**
- `/fanxing-task-scheduling/keepalive` - `/fanxing-task-scheduling/keepalive/{devId}`
- **verb**
- `POST`
- **body**
```json
{
keepalive: "i am good"
}
```
#### VAServer运行状态推送
- **path**
- `/fanxing-task-scheduling/status`
- **verb** - **verb**
- `POST` - `GET`
- **body**
```json
{
tasks:
[
{
"progress": 0, //进度百分比
"status": "Running", //状态,Running Finished
"task_id": "0821fdac47b04b0d9f85ec4a2f9657eb" //任务id
},
{
"task_id": "0a263320bd274b529e5185e3b05aa157",
"status": "Running",
"progress": 0
}
],
resource:
{
"brief":
{
"video_total":10, //视频资源总数
"video_busy":10, //视频资源占用数
"video_free":0 //视频资源剩余数
}
}
}
```
### 转发服务 ### 转发服务
#### 任务分析结果接收接口 #### 任务分析结果接收接口
...@@ -575,25 +557,71 @@ ...@@ -575,25 +557,71 @@
### VAServer ### VAServer
#### 添加任务 #### 添加任务
- **path**
- `/api/vaserver/v1/task`
- **verb**
- `POST`
- **body**
```json
{
"task_unid": "abcd-xxxx-xxxxxx-xxxxxx", //任务id
"task_name": "任务名称",
"alg_type": "算法类型(交通,客流,违停等)",
"store_config": "存储配置",
"channel_unid": "视频通道unid",
"stream_path": "视频流地址",
"stream_type": 0, //视频流类型
"scene": "场景配置"
}
```
#### 编辑任务 #### 编辑任务
- **path**
- `/api/vaserver/v1/task`
- **verb**
- `PUT`
- **body**
```json
{
"task_unid": "abcd-xxxx-xxxxxx-xxxxxx", //任务id
"task_name": "任务名称",
"alg_type": "算法类型(交通,客流,违停等)",
"store_config": "存储配置",
"channel_unid": "视频通道unid",
"stream_path": "视频流地址",
"stream_type": 0, //视频流类型
"scene": "场景配置"
}
```
#### 删除任务 #### 删除任务
- **path**
- `/api/vaserver/v1/task`
- **verb**
- `DELETE`
- **param**
- task_unid 任务unid
#### 获取算法/运行参数 #### 获取算法/运行参数
#### 分析结果推送
#### 截图 #### 截图
- **path**
- `/api/vaserver/v1/snapshot`
- **verb**
- `GET`
- **param**
- task_unid 任务unid
#### 获取点播地址 #### 获取点播地址
- **path** - **path**
- `/api/vaserver/v1/get_analyze_stream` - `/api/vaserver/v1/get_analyze_stream`
- **verb** - **verb**
- `POST` - `POST`
- **body** - **body**
```json ```json
{ {
"taskID": "task1111111" //任务id "task_unid": "task1111111" //任务id
} }
``` ```
- **response** - **response**
```json ```json
{ {
...@@ -605,7 +633,7 @@ ...@@ -605,7 +633,7 @@
#### 开始输出分析流 #### 开始输出分析流
- **path** - **path**
- `/api/vaserver/v1/get_analyze_stream` - `/api/vaserver/v1/start_analyze_stream`
- **verb** - **verb**
- `POST` - `POST`
- **body** - **body**
...@@ -613,17 +641,105 @@ ...@@ -613,17 +641,105 @@
//开始推送rtmp流 //开始推送rtmp流
//此接口在点播期间30秒钟调用一次,如果超时,分析会关闭编码通道 //此接口在点播期间30秒钟调用一次,如果超时,分析会关闭编码通道
{ {
"taskID": "task1111111", //任务id "task_unid": "task1111111",//任务id
"isDrawRect": 1, //是否画框 "isDrawRect": 1,//是否画框
"mediaServerPushUrl": "rtmp://192.168.9.159:1200/task1111111" //流推送地址 "mediaServerPushUrl": "rtmp://192.168.9.159:1200/task1111111" //流推送地址
}
```
- **response**
```json
{
"code": 200,
"msg": "OK",
}
```
#### 切换场景/预置位
- **path**
- `/api/vaserver/v1/switch_scene`
- **verb**
- `POST`
- **body**
```json
{
"task_unid": "task1111111", // 任务id
"sceneID": "xxxxxxxxxx" // 切换至哪个场景
}
```
- **response**
```json
{
"code": 200,
"msg": "OK",
}
```
#### 任务轮询状态控制
- **path**
- `/api/vaserver/v1/alternate`
- **verb**
- `POST`
- **body**
```json
{
"task_unid": "task1111111",//任务id
"alternateStatus": "0" // 0-开启轮训 1-停止轮训
}
```
- **response**
```json
{
"code": 200,
"msg": "OK",
} }
``` ```
#### 任务轮询状态查询
- **path**
- `/api/vaserver/v1/alternate`
- **verb**
- `GET`
- **param**
- task_unid 任务id
- **response** - **response**
```json ```json
{ {
"code": 400, "code": 200,
"msg": "task not found" "msg": "OK",
}
```
#### 运行状态查询
- **path**
- `/api/vaserver/v1/status`
- **verb**
- `GET`
- **response**
```json
{
{
"tasks": [
{
"progress": 0,
"status": "Running",
"task_unid": "0821fdac47b04b0d9f85ec4a2f9657eb"
},
{
"task_unid": "0a263320bd274b529e5185e3b05aa157",
"status": "Running",
"progress": 0
}
],
"resource": {
"brief": {
"video_total": 10,
"video_busy": 10,
"video_free": 0
}
}
}
} }
``` ```
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -48,12 +57,6 @@ ...@@ -48,12 +57,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
......
package com.viontech.fanxing.commons.constant;
/**
* .
*
* @author 谢明辉
* @date 2021/7/20
*/
public enum TaskStatus {
/** 运行中 */
RUNNING(1),
/** 暂停 */
PAUSE(2),
/** 等待执行 */
AWAIT(0),
/** 资源不足 */
CAN_NOT_RUN(4);
public int val;
TaskStatus(int val) {
this.val = val;
}
}
...@@ -6,6 +6,8 @@ import java.util.Date; ...@@ -6,6 +6,8 @@ import java.util.Date;
public class Behavior extends BaseModel { public class Behavior extends BaseModel {
private Long id; private Long id;
private Date eventTime;
private String unid; private String unid;
private Long taskId; private Long taskId;
...@@ -16,22 +18,14 @@ public class Behavior extends BaseModel { ...@@ -16,22 +18,14 @@ public class Behavior extends BaseModel {
private String eventRefid; private String eventRefid;
private Date eventTime;
private String pics; private String pics;
private String channelUnid; private String channelUnid;
private String testPicFile;
private String testFrameNo;
private String taskName; private String taskName;
private String eventDataNum; private String eventDataNum;
private String auxDevInfo;
private String eventData; private String eventData;
private String video; private String video;
...@@ -44,6 +38,14 @@ public class Behavior extends BaseModel { ...@@ -44,6 +38,14 @@ public class Behavior extends BaseModel {
this.id = id; this.id = id;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getUnid() { public String getUnid() {
return unid; return unid;
} }
...@@ -84,14 +86,6 @@ public class Behavior extends BaseModel { ...@@ -84,14 +86,6 @@ public class Behavior extends BaseModel {
this.eventRefid = eventRefid == null ? null : eventRefid.trim(); this.eventRefid = eventRefid == null ? null : eventRefid.trim();
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getPics() { public String getPics() {
return pics; return pics;
} }
...@@ -108,22 +102,6 @@ public class Behavior extends BaseModel { ...@@ -108,22 +102,6 @@ public class Behavior extends BaseModel {
this.channelUnid = channelUnid == null ? null : channelUnid.trim(); this.channelUnid = channelUnid == null ? null : channelUnid.trim();
} }
public String getTestPicFile() {
return testPicFile;
}
public void setTestPicFile(String testPicFile) {
this.testPicFile = testPicFile == null ? null : testPicFile.trim();
}
public String getTestFrameNo() {
return testFrameNo;
}
public void setTestFrameNo(String testFrameNo) {
this.testFrameNo = testFrameNo == null ? null : testFrameNo.trim();
}
public String getTaskName() { public String getTaskName() {
return taskName; return taskName;
} }
...@@ -140,14 +118,6 @@ public class Behavior extends BaseModel { ...@@ -140,14 +118,6 @@ public class Behavior extends BaseModel {
this.eventDataNum = eventDataNum == null ? null : eventDataNum.trim(); this.eventDataNum = eventDataNum == null ? null : eventDataNum.trim();
} }
public String getAuxDevInfo() {
return auxDevInfo;
}
public void setAuxDevInfo(String auxDevInfo) {
this.auxDevInfo = auxDevInfo == null ? null : auxDevInfo.trim();
}
public String getEventData() { public String getEventData() {
return eventData; return eventData;
} }
......
package com.viontech.fanxing.commons.model;
import com.viontech.fanxing.commons.base.BaseModel;
public class Channel extends BaseModel {
private Long id;
private String unid;
private String channelUnid;
private String deviceUnid;
private Integer type;
private Integer streamType;
private String streamPath;
private String username;
private String password;
private String addressUnid;
private String name;
private String ip;
private Integer port;
private String expand;
private Float longitude;
private Float latitude;
private Integer status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUnid() {
return unid;
}
public void setUnid(String unid) {
this.unid = unid == null ? null : unid.trim();
}
public String getChannelUnid() {
return channelUnid;
}
public void setChannelUnid(String channelUnid) {
this.channelUnid = channelUnid == null ? null : channelUnid.trim();
}
public String getDeviceUnid() {
return deviceUnid;
}
public void setDeviceUnid(String deviceUnid) {
this.deviceUnid = deviceUnid == null ? null : deviceUnid.trim();
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getStreamType() {
return streamType;
}
public void setStreamType(Integer streamType) {
this.streamType = streamType;
}
public String getStreamPath() {
return streamPath;
}
public void setStreamPath(String streamPath) {
this.streamPath = streamPath == null ? null : streamPath.trim();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getAddressUnid() {
return addressUnid;
}
public void setAddressUnid(String addressUnid) {
this.addressUnid = addressUnid == null ? null : addressUnid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip == null ? null : ip.trim();
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getExpand() {
return expand;
}
public void setExpand(String expand) {
this.expand = expand == null ? null : expand.trim();
}
public Float getLongitude() {
return longitude;
}
public void setLongitude(Float longitude) {
this.longitude = longitude;
}
public Float getLatitude() {
return latitude;
}
public void setLatitude(Float latitude) {
this.latitude = latitude;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,8 @@ import java.util.Date; ...@@ -6,6 +6,8 @@ import java.util.Date;
public class FlowData extends BaseModel { public class FlowData extends BaseModel {
private Long id; private Long id;
private Date eventTime;
private String unid; private String unid;
private Long flowEventId; private Long flowEventId;
...@@ -44,8 +46,6 @@ public class FlowData extends BaseModel { ...@@ -44,8 +46,6 @@ public class FlowData extends BaseModel {
private Float sampleNumOut; private Float sampleNumOut;
private Date eventTime;
private Float distTime; private Float distTime;
private Float timeOccupy; private Float timeOccupy;
...@@ -64,6 +64,14 @@ public class FlowData extends BaseModel { ...@@ -64,6 +64,14 @@ public class FlowData extends BaseModel {
this.id = id; this.id = id;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getUnid() { public String getUnid() {
return unid; return unid;
} }
...@@ -216,14 +224,6 @@ public class FlowData extends BaseModel { ...@@ -216,14 +224,6 @@ public class FlowData extends BaseModel {
this.sampleNumOut = sampleNumOut; this.sampleNumOut = sampleNumOut;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public Float getDistTime() { public Float getDistTime() {
return distTime; return distTime;
} }
......
...@@ -149,6 +149,66 @@ public class FlowDataExample extends BaseExample { ...@@ -149,6 +149,66 @@ public class FlowDataExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`flowData`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`flowData`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`flowData`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`flowData`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`flowData`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`flowData`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`flowData`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`flowData`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`flowData`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`flowData`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`flowData`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`flowData`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andUnidIsNull() { public Criteria andUnidIsNull() {
addCriterion("`flowData`.unid is null"); addCriterion("`flowData`.unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -1359,66 +1419,6 @@ public class FlowDataExample extends BaseExample { ...@@ -1359,66 +1419,6 @@ public class FlowDataExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`flowData`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`flowData`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`flowData`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`flowData`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`flowData`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`flowData`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`flowData`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`flowData`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`flowData`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`flowData`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`flowData`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`flowData`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andDistTimeIsNull() { public Criteria andDistTimeIsNull() {
addCriterion("`flowData`.dist_time is null"); addCriterion("`flowData`.dist_time is null");
return (Criteria) this; return (Criteria) this;
...@@ -1611,6 +1611,11 @@ public class FlowDataExample extends BaseExample { ...@@ -1611,6 +1611,11 @@ public class FlowDataExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`flowData`.event_time as flowData_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasUnidColumn() { public ColumnContainer hasUnidColumn() {
addColumnStr("`flowData`.unid as flowData_unid "); addColumnStr("`flowData`.unid as flowData_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
...@@ -1706,11 +1711,6 @@ public class FlowDataExample extends BaseExample { ...@@ -1706,11 +1711,6 @@ public class FlowDataExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`flowData`.event_time as flowData_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasDistTimeColumn() { public ColumnContainer hasDistTimeColumn() {
addColumnStr("`flowData`.dist_time as flowData_dist_time "); addColumnStr("`flowData`.dist_time as flowData_dist_time ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
...@@ -6,14 +6,14 @@ import java.util.Date; ...@@ -6,14 +6,14 @@ import java.util.Date;
public class FlowEvent extends BaseModel { public class FlowEvent extends BaseModel {
private Long id; private Long id;
private Date eventTime;
private String unid; private String unid;
private Long taskId; private Long taskId;
private String eventType; private String eventType;
private Date eventTime;
private String eventId; private String eventId;
private String deviceCode; private String deviceCode;
...@@ -38,6 +38,14 @@ public class FlowEvent extends BaseModel { ...@@ -38,6 +38,14 @@ public class FlowEvent extends BaseModel {
this.id = id; this.id = id;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getUnid() { public String getUnid() {
return unid; return unid;
} }
...@@ -62,14 +70,6 @@ public class FlowEvent extends BaseModel { ...@@ -62,14 +70,6 @@ public class FlowEvent extends BaseModel {
this.eventType = eventType == null ? null : eventType.trim(); this.eventType = eventType == null ? null : eventType.trim();
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getEventId() { public String getEventId() {
return eventId; return eventId;
} }
......
...@@ -149,6 +149,66 @@ public class FlowEventExample extends BaseExample { ...@@ -149,6 +149,66 @@ public class FlowEventExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`flowEvent`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`flowEvent`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`flowEvent`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`flowEvent`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`flowEvent`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`flowEvent`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`flowEvent`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`flowEvent`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`flowEvent`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`flowEvent`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`flowEvent`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`flowEvent`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andUnidIsNull() { public Criteria andUnidIsNull() {
addCriterion("`flowEvent`.unid is null"); addCriterion("`flowEvent`.unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -349,66 +409,6 @@ public class FlowEventExample extends BaseExample { ...@@ -349,66 +409,6 @@ public class FlowEventExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`flowEvent`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`flowEvent`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`flowEvent`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`flowEvent`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`flowEvent`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`flowEvent`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`flowEvent`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`flowEvent`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`flowEvent`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`flowEvent`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`flowEvent`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`flowEvent`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventIdIsNull() { public Criteria andEventIdIsNull() {
addCriterion("`flowEvent`.event_id is null"); addCriterion("`flowEvent`.event_id is null");
return (Criteria) this; return (Criteria) this;
...@@ -911,6 +911,11 @@ public class FlowEventExample extends BaseExample { ...@@ -911,6 +911,11 @@ public class FlowEventExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`flowEvent`.event_time as flowEvent_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasUnidColumn() { public ColumnContainer hasUnidColumn() {
addColumnStr("`flowEvent`.unid as flowEvent_unid "); addColumnStr("`flowEvent`.unid as flowEvent_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
...@@ -926,11 +931,6 @@ public class FlowEventExample extends BaseExample { ...@@ -926,11 +931,6 @@ public class FlowEventExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`flowEvent`.event_time as flowEvent_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasEventIdColumn() { public ColumnContainer hasEventIdColumn() {
addColumnStr("`flowEvent`.event_id as flowEvent_event_id "); addColumnStr("`flowEvent`.event_id as flowEvent_event_id ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
...@@ -6,6 +6,8 @@ import java.util.Date; ...@@ -6,6 +6,8 @@ import java.util.Date;
public class Traffic extends BaseModel { public class Traffic extends BaseModel {
private Long id; private Long id;
private Date eventTime;
private String unid; private String unid;
private Long taskId; private Long taskId;
...@@ -14,8 +16,6 @@ public class Traffic extends BaseModel { ...@@ -14,8 +16,6 @@ public class Traffic extends BaseModel {
private String eventType; private String eventType;
private Date eventDt;
private String channelUnid; private String channelUnid;
private String plateColor; private String plateColor;
...@@ -72,6 +72,14 @@ public class Traffic extends BaseModel { ...@@ -72,6 +72,14 @@ public class Traffic extends BaseModel {
this.id = id; this.id = id;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getUnid() { public String getUnid() {
return unid; return unid;
} }
...@@ -104,14 +112,6 @@ public class Traffic extends BaseModel { ...@@ -104,14 +112,6 @@ public class Traffic extends BaseModel {
this.eventType = eventType == null ? null : eventType.trim(); this.eventType = eventType == null ? null : eventType.trim();
} }
public Date getEventDt() {
return eventDt;
}
public void setEventDt(Date eventDt) {
this.eventDt = eventDt;
}
public String getChannelUnid() { public String getChannelUnid() {
return channelUnid; return channelUnid;
} }
......
...@@ -149,6 +149,66 @@ public class TrafficExample extends BaseExample { ...@@ -149,6 +149,66 @@ public class TrafficExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`traffic`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`traffic`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`traffic`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`traffic`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`traffic`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`traffic`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`traffic`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`traffic`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`traffic`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`traffic`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`traffic`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`traffic`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andUnidIsNull() { public Criteria andUnidIsNull() {
addCriterion("`traffic`.unid is null"); addCriterion("`traffic`.unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -419,66 +479,6 @@ public class TrafficExample extends BaseExample { ...@@ -419,66 +479,6 @@ public class TrafficExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventDtIsNull() {
addCriterion("`traffic`.event_dt is null");
return (Criteria) this;
}
public Criteria andEventDtIsNotNull() {
addCriterion("`traffic`.event_dt is not null");
return (Criteria) this;
}
public Criteria andEventDtEqualTo(Date value) {
addCriterion("`traffic`.event_dt =", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtNotEqualTo(Date value) {
addCriterion("`traffic`.event_dt <>", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtGreaterThan(Date value) {
addCriterion("`traffic`.event_dt >", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtGreaterThanOrEqualTo(Date value) {
addCriterion("`traffic`.event_dt >=", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtLessThan(Date value) {
addCriterion("`traffic`.event_dt <", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtLessThanOrEqualTo(Date value) {
addCriterion("`traffic`.event_dt <=", value, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtIn(List<Date> values) {
addCriterion("`traffic`.event_dt in", values, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtNotIn(List<Date> values) {
addCriterion("`traffic`.event_dt not in", values, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtBetween(Date value1, Date value2) {
addCriterion("`traffic`.event_dt between", value1, value2, "eventDt");
return (Criteria) this;
}
public Criteria andEventDtNotBetween(Date value1, Date value2) {
addCriterion("`traffic`.event_dt not between", value1, value2, "eventDt");
return (Criteria) this;
}
public Criteria andChannelUnidIsNull() { public Criteria andChannelUnidIsNull() {
addCriterion("`traffic`.channel_unid is null"); addCriterion("`traffic`.channel_unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -2031,6 +2031,11 @@ public class TrafficExample extends BaseExample { ...@@ -2031,6 +2031,11 @@ public class TrafficExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`traffic`.event_time as traffic_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasUnidColumn() { public ColumnContainer hasUnidColumn() {
addColumnStr("`traffic`.unid as traffic_unid "); addColumnStr("`traffic`.unid as traffic_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
...@@ -2051,11 +2056,6 @@ public class TrafficExample extends BaseExample { ...@@ -2051,11 +2056,6 @@ public class TrafficExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventDtColumn() {
addColumnStr("`traffic`.event_dt as traffic_event_dt ");
return (ColumnContainer) this;
}
public ColumnContainer hasChannelUnidColumn() { public ColumnContainer hasChannelUnidColumn() {
addColumnStr("`traffic`.channel_unid as traffic_channel_unid "); addColumnStr("`traffic`.channel_unid as traffic_channel_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
package com.viontech.fanxing.commons.model; package com.viontech.fanxing.commons.model;
import com.viontech.fanxing.commons.base.BaseModel; import com.viontech.fanxing.commons.base.BaseModel;
import java.util.Date;
public class TrafficFace extends BaseModel { public class TrafficFace extends BaseModel {
private Long id; private Long id;
private Date eventTime;
private String unid; private String unid;
private Long trafficId; private Long trafficId;
...@@ -25,6 +28,14 @@ public class TrafficFace extends BaseModel { ...@@ -25,6 +28,14 @@ public class TrafficFace extends BaseModel {
this.id = id; this.id = id;
} }
public Date getEventTime() {
return eventTime;
}
public void setEventTime(Date eventTime) {
this.eventTime = eventTime;
}
public String getUnid() { public String getUnid() {
return unid; return unid;
} }
......
...@@ -2,6 +2,7 @@ package com.viontech.fanxing.commons.model; ...@@ -2,6 +2,7 @@ package com.viontech.fanxing.commons.model;
import com.viontech.fanxing.commons.base.BaseExample; import com.viontech.fanxing.commons.base.BaseExample;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -148,6 +149,66 @@ public class TrafficFaceExample extends BaseExample { ...@@ -148,6 +149,66 @@ public class TrafficFaceExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andEventTimeIsNull() {
addCriterion("`trafficFace`.event_time is null");
return (Criteria) this;
}
public Criteria andEventTimeIsNotNull() {
addCriterion("`trafficFace`.event_time is not null");
return (Criteria) this;
}
public Criteria andEventTimeEqualTo(Date value) {
addCriterion("`trafficFace`.event_time =", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotEqualTo(Date value) {
addCriterion("`trafficFace`.event_time <>", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThan(Date value) {
addCriterion("`trafficFace`.event_time >", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeGreaterThanOrEqualTo(Date value) {
addCriterion("`trafficFace`.event_time >=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThan(Date value) {
addCriterion("`trafficFace`.event_time <", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeLessThanOrEqualTo(Date value) {
addCriterion("`trafficFace`.event_time <=", value, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeIn(List<Date> values) {
addCriterion("`trafficFace`.event_time in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotIn(List<Date> values) {
addCriterion("`trafficFace`.event_time not in", values, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeBetween(Date value1, Date value2) {
addCriterion("`trafficFace`.event_time between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andEventTimeNotBetween(Date value1, Date value2) {
addCriterion("`trafficFace`.event_time not between", value1, value2, "eventTime");
return (Criteria) this;
}
public Criteria andUnidIsNull() { public Criteria andUnidIsNull() {
addCriterion("`trafficFace`.unid is null"); addCriterion("`trafficFace`.unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -550,6 +611,11 @@ public class TrafficFaceExample extends BaseExample { ...@@ -550,6 +611,11 @@ public class TrafficFaceExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasEventTimeColumn() {
addColumnStr("`trafficFace`.event_time as trafficFace_event_time ");
return (ColumnContainer) this;
}
public ColumnContainer hasUnidColumn() { public ColumnContainer hasUnidColumn() {
addColumnStr("`trafficFace`.unid as trafficFace_unid "); addColumnStr("`trafficFace`.unid as trafficFace_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
package com.viontech.fanxing.commons.vo;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.vobase.ChannelVoBase;
public class ChannelVo extends ChannelVoBase {
public ChannelVo() {
super();
}
public ChannelVo(Channel channel) {
super(channel);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -25,6 +25,21 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -25,6 +25,21 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private Long id_lte; private Long id_lte;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private ArrayList<String> unid_arr; private ArrayList<String> unid_arr;
@JsonIgnore @JsonIgnore
...@@ -76,24 +91,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -76,24 +91,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private String eventRefid_like; private String eventRefid_like;
@JsonIgnore @JsonIgnore
private Boolean eventTime_null;
@JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private Boolean pics_null; private Boolean pics_null;
@JsonIgnore @JsonIgnore
...@@ -112,24 +109,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -112,24 +109,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private String channelUnid_like; private String channelUnid_like;
@JsonIgnore @JsonIgnore
private Boolean testPicFile_null;
@JsonIgnore
private ArrayList<String> testPicFile_arr;
@JsonIgnore
private String testPicFile_like;
@JsonIgnore
private Boolean testFrameNo_null;
@JsonIgnore
private ArrayList<String> testFrameNo_arr;
@JsonIgnore
private String testFrameNo_like;
@JsonIgnore
private Boolean taskName_null; private Boolean taskName_null;
@JsonIgnore @JsonIgnore
...@@ -148,15 +127,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -148,15 +127,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private String eventDataNum_like; private String eventDataNum_like;
@JsonIgnore @JsonIgnore
private Boolean auxDevInfo_null;
@JsonIgnore
private ArrayList<String> auxDevInfo_arr;
@JsonIgnore
private String auxDevInfo_like;
@JsonIgnore
private Boolean eventData_null; private Boolean eventData_null;
@JsonIgnore @JsonIgnore
...@@ -248,6 +218,60 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -248,6 +218,60 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setId(id); this.getModel().setId(id);
} }
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public ArrayList<String> getUnid_arr() { public ArrayList<String> getUnid_arr() {
return unid_arr; return unid_arr;
} }
...@@ -454,68 +478,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -454,68 +478,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventRefid(eventRefid); this.getModel().setEventRefid(eventRefid);
} }
public Boolean getEventTime_null() {
return eventTime_null;
}
public void setEventTime_null(Boolean eventTime_null) {
this.eventTime_null = eventTime_null;
}
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public Boolean getPics_null() { public Boolean getPics_null() {
return pics_null; return pics_null;
} }
...@@ -592,82 +554,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -592,82 +554,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setChannelUnid(channelUnid); this.getModel().setChannelUnid(channelUnid);
} }
public Boolean getTestPicFile_null() {
return testPicFile_null;
}
public void setTestPicFile_null(Boolean testPicFile_null) {
this.testPicFile_null = testPicFile_null;
}
public ArrayList<String> getTestPicFile_arr() {
return testPicFile_arr;
}
public void setTestPicFile_arr(ArrayList<String> testPicFile_arr) {
this.testPicFile_arr = testPicFile_arr;
}
public String getTestPicFile_like() {
return testPicFile_like;
}
public void setTestPicFile_like(String testPicFile_like) {
this.testPicFile_like = testPicFile_like;
}
public String getTestPicFile() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getTestPicFile();
}
public void setTestPicFile(String testPicFile) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setTestPicFile(testPicFile);
}
public Boolean getTestFrameNo_null() {
return testFrameNo_null;
}
public void setTestFrameNo_null(Boolean testFrameNo_null) {
this.testFrameNo_null = testFrameNo_null;
}
public ArrayList<String> getTestFrameNo_arr() {
return testFrameNo_arr;
}
public void setTestFrameNo_arr(ArrayList<String> testFrameNo_arr) {
this.testFrameNo_arr = testFrameNo_arr;
}
public String getTestFrameNo_like() {
return testFrameNo_like;
}
public void setTestFrameNo_like(String testFrameNo_like) {
this.testFrameNo_like = testFrameNo_like;
}
public String getTestFrameNo() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getTestFrameNo();
}
public void setTestFrameNo(String testFrameNo) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setTestFrameNo(testFrameNo);
}
public Boolean getTaskName_null() { public Boolean getTaskName_null() {
return taskName_null; return taskName_null;
} }
...@@ -744,44 +630,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -744,44 +630,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventDataNum(eventDataNum); this.getModel().setEventDataNum(eventDataNum);
} }
public Boolean getAuxDevInfo_null() {
return auxDevInfo_null;
}
public void setAuxDevInfo_null(Boolean auxDevInfo_null) {
this.auxDevInfo_null = auxDevInfo_null;
}
public ArrayList<String> getAuxDevInfo_arr() {
return auxDevInfo_arr;
}
public void setAuxDevInfo_arr(ArrayList<String> auxDevInfo_arr) {
this.auxDevInfo_arr = auxDevInfo_arr;
}
public String getAuxDevInfo_like() {
return auxDevInfo_like;
}
public void setAuxDevInfo_like(String auxDevInfo_like) {
this.auxDevInfo_like = auxDevInfo_like;
}
public String getAuxDevInfo() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getAuxDevInfo();
}
public void setAuxDevInfo(String auxDevInfo) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setAuxDevInfo(auxDevInfo);
}
public Boolean getEventData_null() { public Boolean getEventData_null() {
return eventData_null; return eventData_null;
} }
......
...@@ -25,6 +25,21 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> { ...@@ -25,6 +25,21 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> {
private Long id_lte; private Long id_lte;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private ArrayList<String> unid_arr; private ArrayList<String> unid_arr;
@JsonIgnore @JsonIgnore
...@@ -301,24 +316,6 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> { ...@@ -301,24 +316,6 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> {
private Float sampleNumOut_lte; private Float sampleNumOut_lte;
@JsonIgnore @JsonIgnore
private Boolean eventTime_null;
@JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private Boolean distTime_null; private Boolean distTime_null;
@JsonIgnore @JsonIgnore
...@@ -461,6 +458,60 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> { ...@@ -461,6 +458,60 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> {
this.getModel().setId(id); this.getModel().setId(id);
} }
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public ArrayList<String> getUnid_arr() { public ArrayList<String> getUnid_arr() {
return unid_arr; return unid_arr;
} }
...@@ -1463,68 +1514,6 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> { ...@@ -1463,68 +1514,6 @@ public class FlowDataVoBase extends FlowData implements VoInterface<FlowData> {
this.getModel().setSampleNumOut(sampleNumOut); this.getModel().setSampleNumOut(sampleNumOut);
} }
public Boolean getEventTime_null() {
return eventTime_null;
}
public void setEventTime_null(Boolean eventTime_null) {
this.eventTime_null = eventTime_null;
}
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public Boolean getDistTime_null() { public Boolean getDistTime_null() {
return distTime_null; return distTime_null;
} }
......
...@@ -25,6 +25,21 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -25,6 +25,21 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
private Long id_lte; private Long id_lte;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private ArrayList<String> unid_arr; private ArrayList<String> unid_arr;
@JsonIgnore @JsonIgnore
...@@ -58,24 +73,6 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -58,24 +73,6 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
private String eventType_like; private String eventType_like;
@JsonIgnore @JsonIgnore
private Boolean eventTime_null;
@JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private Boolean eventId_null; private Boolean eventId_null;
@JsonIgnore @JsonIgnore
...@@ -221,6 +218,60 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -221,6 +218,60 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
this.getModel().setId(id); this.getModel().setId(id);
} }
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public ArrayList<String> getUnid_arr() { public ArrayList<String> getUnid_arr() {
return unid_arr; return unid_arr;
} }
...@@ -351,68 +402,6 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -351,68 +402,6 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
this.getModel().setEventType(eventType); this.getModel().setEventType(eventType);
} }
public Boolean getEventTime_null() {
return eventTime_null;
}
public void setEventTime_null(Boolean eventTime_null) {
this.eventTime_null = eventTime_null;
}
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public Boolean getEventId_null() { public Boolean getEventId_null() {
return eventId_null; return eventId_null;
} }
......
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.viontech.fanxing.commons.base.VoInterface; import com.viontech.fanxing.commons.base.VoInterface;
import com.viontech.fanxing.commons.model.TrafficFace; import com.viontech.fanxing.commons.model.TrafficFace;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
public class TrafficFaceVoBase extends TrafficFace implements VoInterface<TrafficFace> { public class TrafficFaceVoBase extends TrafficFace implements VoInterface<TrafficFace> {
private TrafficFace trafficFace; private TrafficFace trafficFace;
...@@ -24,6 +25,21 @@ public class TrafficFaceVoBase extends TrafficFace implements VoInterface<Traffi ...@@ -24,6 +25,21 @@ public class TrafficFaceVoBase extends TrafficFace implements VoInterface<Traffi
private Long id_lte; private Long id_lte;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private ArrayList<String> unid_arr; private ArrayList<String> unid_arr;
@JsonIgnore @JsonIgnore
...@@ -166,6 +182,60 @@ public class TrafficFaceVoBase extends TrafficFace implements VoInterface<Traffi ...@@ -166,6 +182,60 @@ public class TrafficFaceVoBase extends TrafficFace implements VoInterface<Traffi
this.getModel().setId(id); this.getModel().setId(id);
} }
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public ArrayList<String> getUnid_arr() { public ArrayList<String> getUnid_arr() {
return unid_arr; return unid_arr;
} }
......
...@@ -25,6 +25,21 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -25,6 +25,21 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
private Long id_lte; private Long id_lte;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventTime_arr;
@JsonIgnore
private Date eventTime_gt;
@JsonIgnore
private Date eventTime_lt;
@JsonIgnore
private Date eventTime_gte;
@JsonIgnore
private Date eventTime_lte;
@JsonIgnore
private ArrayList<String> unid_arr; private ArrayList<String> unid_arr;
@JsonIgnore @JsonIgnore
...@@ -67,21 +82,6 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -67,21 +82,6 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
private String eventType_like; private String eventType_like;
@JsonIgnore @JsonIgnore
private ArrayList<Date> eventDt_arr;
@JsonIgnore
private Date eventDt_gt;
@JsonIgnore
private Date eventDt_lt;
@JsonIgnore
private Date eventDt_gte;
@JsonIgnore
private Date eventDt_lte;
@JsonIgnore
private Boolean channelUnid_null; private Boolean channelUnid_null;
@JsonIgnore @JsonIgnore
...@@ -431,6 +431,60 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -431,6 +431,60 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
this.getModel().setId(id); this.getModel().setId(id);
} }
public ArrayList<Date> getEventTime_arr() {
return eventTime_arr;
}
public void setEventTime_arr(ArrayList<Date> eventTime_arr) {
this.eventTime_arr = eventTime_arr;
}
public Date getEventTime_gt() {
return eventTime_gt;
}
public void setEventTime_gt(Date eventTime_gt) {
this.eventTime_gt = eventTime_gt;
}
public Date getEventTime_lt() {
return eventTime_lt;
}
public void setEventTime_lt(Date eventTime_lt) {
this.eventTime_lt = eventTime_lt;
}
public Date getEventTime_gte() {
return eventTime_gte;
}
public void setEventTime_gte(Date eventTime_gte) {
this.eventTime_gte = eventTime_gte;
}
public Date getEventTime_lte() {
return eventTime_lte;
}
public void setEventTime_lte(Date eventTime_lte) {
this.eventTime_lte = eventTime_lte;
}
public Date getEventTime() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventTime();
}
public void setEventTime(Date eventTime) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventTime(eventTime);
}
public ArrayList<String> getUnid_arr() { public ArrayList<String> getUnid_arr() {
return unid_arr; return unid_arr;
} }
...@@ -599,60 +653,6 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -599,60 +653,6 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
this.getModel().setEventType(eventType); this.getModel().setEventType(eventType);
} }
public ArrayList<Date> getEventDt_arr() {
return eventDt_arr;
}
public void setEventDt_arr(ArrayList<Date> eventDt_arr) {
this.eventDt_arr = eventDt_arr;
}
public Date getEventDt_gt() {
return eventDt_gt;
}
public void setEventDt_gt(Date eventDt_gt) {
this.eventDt_gt = eventDt_gt;
}
public Date getEventDt_lt() {
return eventDt_lt;
}
public void setEventDt_lt(Date eventDt_lt) {
this.eventDt_lt = eventDt_lt;
}
public Date getEventDt_gte() {
return eventDt_gte;
}
public void setEventDt_gte(Date eventDt_gte) {
this.eventDt_gte = eventDt_gte;
}
public Date getEventDt_lte() {
return eventDt_lte;
}
public void setEventDt_lte(Date eventDt_lte) {
this.eventDt_lte = eventDt_lte;
}
public Date getEventDt() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getEventDt();
}
public void setEventDt(Date eventDt) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setEventDt(eventDt);
}
public Boolean getChannelUnid_null() { public Boolean getChannelUnid_null() {
return channelUnid_null; return channelUnid_null;
} }
......
...@@ -48,6 +48,15 @@ ...@@ -48,6 +48,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -56,12 +65,6 @@ ...@@ -56,12 +65,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,7 @@ import com.viontech.fanxing.commons.model.Task; ...@@ -7,6 +7,7 @@ import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.forward.util.CacheUtils; import com.viontech.fanxing.forward.util.CacheUtils;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStream;
...@@ -54,9 +55,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject, ...@@ -54,9 +55,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt); Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
JSONObject eventData = item.getJSONObject("event_data"); JSONObject eventData = item.getJSONObject("event_data");
JSONArray video = item.getJSONArray("video"); JSONArray video = item.getJSONArray("video");
JSONArray pics = item.getJSONArray("pics");
JSONObject auxDevInfo = item.getJSONObject("aux_dev_info");
String picArray = item.getString("pic_path_array"); String picArray = item.getString("pic_path_array");
if (StringUtils.isEmpty(eventRefid)) {
eventRefid = eventData.getString("ID");
}
behavior.setEventType(eventType); behavior.setEventType(eventType);
behavior.setEventRefid(eventRefid); behavior.setEventRefid(eventRefid);
...@@ -68,7 +70,6 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject, ...@@ -68,7 +70,6 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
behavior.setEventData(eventData == null ? null : eventData.toJSONString()); behavior.setEventData(eventData == null ? null : eventData.toJSONString());
behavior.setVideo(video == null ? null : video.toJSONString()); behavior.setVideo(video == null ? null : video.toJSONString());
behavior.setAuxDevInfo(auxDevInfo == null ? null : auxDevInfo.toJSONString());
return behavior; return behavior;
} }
......
...@@ -38,12 +38,14 @@ public class PicProcessor implements ItemStream, ItemProcessor<JSONObject, JSONO ...@@ -38,12 +38,14 @@ public class PicProcessor implements ItemStream, ItemProcessor<JSONObject, JSONO
for (int i = 0; i < pics.size(); i++) { for (int i = 0; i < pics.size(); i++) {
JSONObject picObject = pics.getJSONObject(i); JSONObject picObject = pics.getJSONObject(i);
String base64 = picObject.getString("pic_base64"); String base64 = picObject.getString("pic_base64");
String format = picObject.getString("format"); if (base64 != null) {
String picUnid = picObject.getString("pic_unid"); String format = picObject.getString("format");
picObject.remove("pic_base64"); String picUnid = picObject.getString("pic_unid");
picObject.remove("pic_base64");
String path = picUtils.savePicBase64(picUnid, eventTime, format, base64); String path = picUtils.savePicBase64(picUnid, eventTime, format, base64);
picList.add(path); picList.add(path);
}
} }
String picPathArray = String.join(",", picList); String picPathArray = String.join(",", picList);
......
...@@ -8,6 +8,7 @@ import com.viontech.fanxing.forward.model.TrafficFlowContent; ...@@ -8,6 +8,7 @@ import com.viontech.fanxing.forward.model.TrafficFlowContent;
import com.viontech.fanxing.forward.util.CacheUtils; import com.viontech.fanxing.forward.util.CacheUtils;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStream;
...@@ -58,6 +59,10 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl ...@@ -58,6 +59,10 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
String eventDt = item.getString("event_dt"); String eventDt = item.getString("event_dt");
String picArray = item.getString("pic_path_array"); String picArray = item.getString("pic_path_array");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt); Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
JSONObject eventData = item.getJSONObject("event_data");
if (StringUtils.isEmpty(eventRefid)) {
eventRefid = eventData.getString("ID");
}
flowEvent.setEventType(eventType); flowEvent.setEventType(eventType);
flowEvent.setEventId(eventRefid); flowEvent.setEventId(eventRefid);
...@@ -65,7 +70,6 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl ...@@ -65,7 +70,6 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
flowEvent.setPics(picArray); flowEvent.setPics(picArray);
// flowEvent.setTaskId(taskId); // flowEvent.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data");
if (eventData != null) { if (eventData != null) {
// 地理位置 // 地理位置
JSONObject location = eventData.getJSONObject("location"); JSONObject location = eventData.getJSONObject("location");
......
...@@ -8,6 +8,7 @@ import com.viontech.fanxing.forward.model.TrafficContent; ...@@ -8,6 +8,7 @@ import com.viontech.fanxing.forward.model.TrafficContent;
import com.viontech.fanxing.forward.util.CacheUtils; import com.viontech.fanxing.forward.util.CacheUtils;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStream;
...@@ -55,21 +56,26 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -55,21 +56,26 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
String eventType = item.getString("event_type"); String eventType = item.getString("event_type");
String eventCate = item.getString("event_cate"); String eventCate = item.getString("event_cate");
String eventRefid = item.getString("event_refid"); String eventRefid = item.getString("event_refid");
String eventDt = item.getString("event_dt"); String eventDt = item.getString("event_dt");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt); Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
String channelUnid = item.getString("vchan_refid"); String channelUnid = item.getString("vchan_refid");
String picArray = item.getString("pic_path_array"); String picArray = item.getString("pic_path_array");
JSONObject eventData = item.getJSONObject("event_data");
if (StringUtils.isEmpty(eventRefid)) {
eventRefid = eventData.getString("ID");
}
// todo taskId // todo taskId
traffic.setEventCate(eventCate); traffic.setEventCate(eventCate);
traffic.setEventType(eventType); traffic.setEventType(eventType);
traffic.setEventId(eventRefid); traffic.setEventId(eventRefid);
traffic.setEventDt(eventTime); traffic.setEventTime(eventTime);
traffic.setChannelUnid(channelUnid); traffic.setChannelUnid(channelUnid);
traffic.setPics(picArray); traffic.setPics(picArray);
// traffic.setTaskId(taskId); // traffic.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data");
//非机动车类型 //非机动车类型
traffic.setXcycleType(eventData.getString("xcycle_type")); traffic.setXcycleType(eventData.getString("xcycle_type"));
...@@ -163,6 +169,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -163,6 +169,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
if (face != null && face.size() > 0) { if (face != null && face.size() > 0) {
for (int i = 0; i < face.size(); i++) { for (int i = 0; i < face.size(); i++) {
TrafficFace trafficFace = new TrafficFace(); TrafficFace trafficFace = new TrafficFace();
trafficFace.setEventTime(eventTime);
JSONObject faceData = face.getJSONObject(i); JSONObject faceData = face.getJSONObject(i);
Short sex = faceData.getShort("sex"); Short sex = faceData.getShort("sex");
Short state = faceData.getShort("state"); Short state = faceData.getShort("state");
......
...@@ -21,8 +21,8 @@ import java.util.List; ...@@ -21,8 +21,8 @@ import java.util.List;
public class BehaviorWriter implements ItemWriter<Behavior> { public class BehaviorWriter implements ItemWriter<Behavior> {
private static final String INSERT_BEHAVIOR = "insert into d_behavior (" + private static final String INSERT_BEHAVIOR = "insert into d_behavior (" +
"task_id,event_type,event_cate,event_refid,event_time,aux_dev_info,event_data,pics,video,channel_unid,test_pic_file,test_frame_no,task_name,event_data_num) values (" + "task_id,event_type,event_cate,event_refid,event_time,event_data,pics,video,channel_unid,task_name,event_data_num) values (" +
":taskId,:eventType,:eventCate,:eventRefid,:eventTime,:auxDevInfo,:eventData,:pics,:video,:channelUnid,:testPicFile,:testFrameNo,:taskName,:eventDataNum)"; ":taskId,:eventType,:eventCate,:eventRefid,:eventTime,:eventData,:pics,:video,:channelUnid,:taskName,:eventDataNum)";
@Resource @Resource
private NamedParameterJdbcTemplate namedParameterJdbcTemplate; private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
......
...@@ -3,7 +3,7 @@ package com.viontech.fanxing.forward.batch.writer; ...@@ -3,7 +3,7 @@ package com.viontech.fanxing.forward.batch.writer;
import com.viontech.fanxing.commons.model.Forward; import com.viontech.fanxing.commons.model.Forward;
import com.viontech.fanxing.forward.ForwardApp; import com.viontech.fanxing.forward.ForwardApp;
import com.viontech.fanxing.forward.model.ForwardContent; import com.viontech.fanxing.forward.model.ForwardContent;
import org.apache.commons.lang3.tuple.ImmutablePair; import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ItemWriter;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -11,9 +11,7 @@ import org.springframework.stereotype.Component; ...@@ -11,9 +11,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future; import java.util.concurrent.Future;
/** /**
...@@ -31,26 +29,28 @@ public class ForwardWriter implements ItemWriter<ForwardContent> { ...@@ -31,26 +29,28 @@ public class ForwardWriter implements ItemWriter<ForwardContent> {
@Override @Override
public void write(List<? extends ForwardContent> items) { public void write(List<? extends ForwardContent> items) {
RestTemplate restTemplate = restTemplateBuilder.build(); RestTemplate restTemplate = restTemplateBuilder.build();
List<ImmutablePair<Future<ResponseEntity<String>>, HttpCallable>> data = new ArrayList<>(); // List<ImmutablePair<Future<ResponseEntity<String>>, HttpCallable>> data = new ArrayList<>();
for (ForwardContent item : items) { for (ForwardContent item : items) {
List<Forward> forwardList = item.getForwardList(); List<Forward> forwardList = item.getForwardList();
String json = item.getJson(); String json = item.getJson();
for (Forward forward : forwardList) { for (Forward forward : forwardList) {
HttpCallable httpCallable = new HttpCallable(restTemplate, forward, json); HttpCallable httpCallable = new HttpCallable(restTemplate, forward, json);
Future<ResponseEntity<String>> future = ForwardApp.THREAD_POOL_EXECUTOR.submit(httpCallable); ForwardApp.THREAD_POOL_EXECUTOR.submit(httpCallable);
ImmutablePair<Future<ResponseEntity<String>>, HttpCallable> pair = ImmutablePair.of(future, httpCallable); // ImmutablePair<Future<ResponseEntity<String>>, HttpCallable> pair = ImmutablePair.of(future, httpCallable);
data.add(pair); // data.add(pair);
} }
} }
} }
private static class HttpCallable implements Callable<ResponseEntity<String>> { private @Slf4j
static class HttpCallable implements Runnable {
private final RestTemplate restTemplate; private final RestTemplate restTemplate;
private final Forward forward; private final Forward forward;
private final String json; private final String json;
private int failed = 0;
public HttpCallable(RestTemplate restTemplate, Forward forward, String json) { public HttpCallable(RestTemplate restTemplate, Forward forward, String json) {
this.restTemplate = restTemplate; this.restTemplate = restTemplate;
...@@ -59,8 +59,17 @@ public class ForwardWriter implements ItemWriter<ForwardContent> { ...@@ -59,8 +59,17 @@ public class ForwardWriter implements ItemWriter<ForwardContent> {
} }
@Override @Override
public ResponseEntity<String> call() { public void run() {
return restTemplate.postForEntity(forward.getUrl(), json, String.class); try {
ResponseEntity<String> responseEntity = restTemplate.postForEntity(forward.getUrl(), json, String.class);
} catch (Exception e) {
failed += 1;
}
if (failed < 3) {
ForwardApp.THREAD_POOL_EXECUTOR.submit(this);
} else {
log.info("失败次数超过三次,不再发送,forwardId:{}", forward.getId());
}
} }
} }
} }
...@@ -26,10 +26,10 @@ import java.util.stream.Collectors; ...@@ -26,10 +26,10 @@ import java.util.stream.Collectors;
public class TrafficWriter implements ItemWriter<TrafficContent> { public class TrafficWriter implements ItemWriter<TrafficContent> {
private final static String INSERT_TRAFFIC = "insert into d_traffic (" + private final static String INSERT_TRAFFIC = "insert into d_traffic (" +
"event_cate,event_type,event_dt,channel_unid,plate_color,plate_number,location_code,location_name,lane_code,direction_code,vehicle_type,vehicle_color,vehicle_logo,illegal_code,illegal_state,feature_annual_inspection_mark,feature_pendant,feature_decoration,feature_sun_shield,xcycle_type,event_id,special_type,with_helmet,json_data,pics,video_name) values(" + "event_cate,event_type,event_time,channel_unid,plate_color,plate_number,location_code,location_name,lane_code,direction_code,vehicle_type,vehicle_color,vehicle_logo,illegal_code,illegal_state,feature_annual_inspection_mark,feature_pendant,feature_decoration,feature_sun_shield,xcycle_type,event_id,special_type,with_helmet,json_data,pics,video_name) values(" +
":eventCate,:eventType,:eventDt,:channelUnid,:plateColor,:plateNumber,:locationCode,:locationName,:laneCode,:directionCode,:vehicleType,:vehicleColor,:vehicleLogo,:illegalCode,:illegalState,:featureAnnualInspectionMark,:featurePendant,:featureDecoration,:featureSunShield,:xcycleType,:eventId,:specialType,:withHelmet,:jsonData,:pics,:videoName)"; ":eventCate,:eventType,:eventTime,:channelUnid,:plateColor,:plateNumber,:locationCode,:locationName,:laneCode,:directionCode,:vehicleType,:vehicleColor,:vehicleLogo,:illegalCode,:illegalState,:featureAnnualInspectionMark,:featurePendant,:featureDecoration,:featureSunShield,:xcycleType,:eventId,:specialType,:withHelmet,:jsonData,:pics,:videoName)";
private final static String INSERT_TRAFFIC_FACE = "insert into d_traffic_face (" + private final static String INSERT_TRAFFIC_FACE = "insert into d_traffic_face (" +
"traffic_id,state,sex,upper_color,lower_color) values (:trafficId,:state,:sex,:upperColor,:lowerColor)"; "traffic_id,state,sex,upper_color,lower_color,event_time) values (:trafficId,:state,:sex,:upperColor,:lowerColor,:eventTime)";
@Resource @Resource
private NamedParameterJdbcTemplate namedParameterJdbcTemplate; private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
......
...@@ -41,6 +41,15 @@ ...@@ -41,6 +41,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -49,12 +58,6 @@ ...@@ -49,12 +58,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -48,12 +57,6 @@ ...@@ -48,12 +57,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.controller.web;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.model.ChannelExample;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.ops.controller.base.ChannelBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/channels")
public class ChannelController extends ChannelBaseController {
@Override
protected BaseExample getExample(ChannelVo channelVo, int type) {
ChannelExample channelExample = (ChannelExample) super.getExample(channelVo, type);
return channelExample;
}
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.mapper;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.ChannelExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ChannelMapper extends BaseMapper {
int countByExample(ChannelExample example);
int deleteByExample(ChannelExample example);
int deleteByPrimaryKey(Long id);
int insert(Channel record);
int insertSelective(Channel record);
List<Channel> selectByExample(ChannelExample example);
Channel selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Channel record, @Param("example") ChannelExample example);
int updateByExample(@Param("record") Channel record, @Param("example") ChannelExample example);
int updateByPrimaryKeySelective(Channel record);
int updateByPrimaryKey(Channel record);
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.service.adapter;
import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.Channel;
public interface ChannelService extends BaseService<Channel> {
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.service.impl;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseServiceImpl;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.ops.mapper.ChannelMapper;
import com.viontech.fanxing.ops.service.adapter.ChannelService;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements ChannelService {
@Resource
private ChannelMapper channelMapper;
@Override
public BaseMapper<Channel> getMapper() {
return channelMapper;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -48,12 +57,6 @@ ...@@ -48,12 +57,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -37,6 +37,24 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be ...@@ -37,6 +37,24 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getId_lte() != null) { if(behaviorVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(behaviorVo.getId_lte()); criteria.andIdLessThanOrEqualTo(behaviorVo.getId_lte());
} }
if(behaviorVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(behaviorVo.getEventTime());
}
if(behaviorVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(behaviorVo.getEventTime_arr());
}
if(behaviorVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(behaviorVo.getEventTime_gt());
}
if(behaviorVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(behaviorVo.getEventTime_lt());
}
if(behaviorVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(behaviorVo.getEventTime_gte());
}
if(behaviorVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(behaviorVo.getEventTime_lte());
}
if(behaviorVo.getUnid() != null) { if(behaviorVo.getUnid() != null) {
criteria.andUnidEqualTo(behaviorVo.getUnid()); criteria.andUnidEqualTo(behaviorVo.getUnid());
} }
...@@ -119,31 +137,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be ...@@ -119,31 +137,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getEventRefid_like() != null) { if(behaviorVo.getEventRefid_like() != null) {
criteria.andEventRefidLike(behaviorVo.getEventRefid_like()); criteria.andEventRefidLike(behaviorVo.getEventRefid_like());
} }
if(behaviorVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(behaviorVo.getEventTime());
}
if(behaviorVo.getEventTime_null() != null) {
if(behaviorVo.getEventTime_null().booleanValue()) {
criteria.andEventTimeIsNull();
} else {
criteria.andEventTimeIsNotNull();
}
}
if(behaviorVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(behaviorVo.getEventTime_arr());
}
if(behaviorVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(behaviorVo.getEventTime_gt());
}
if(behaviorVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(behaviorVo.getEventTime_lt());
}
if(behaviorVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(behaviorVo.getEventTime_gte());
}
if(behaviorVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(behaviorVo.getEventTime_lte());
}
if(behaviorVo.getPics() != null) { if(behaviorVo.getPics() != null) {
criteria.andPicsEqualTo(behaviorVo.getPics()); criteria.andPicsEqualTo(behaviorVo.getPics());
} }
...@@ -176,38 +169,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be ...@@ -176,38 +169,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getChannelUnid_like() != null) { if(behaviorVo.getChannelUnid_like() != null) {
criteria.andChannelUnidLike(behaviorVo.getChannelUnid_like()); criteria.andChannelUnidLike(behaviorVo.getChannelUnid_like());
} }
if(behaviorVo.getTestPicFile() != null) {
criteria.andTestPicFileEqualTo(behaviorVo.getTestPicFile());
}
if(behaviorVo.getTestPicFile_null() != null) {
if(behaviorVo.getTestPicFile_null().booleanValue()) {
criteria.andTestPicFileIsNull();
} else {
criteria.andTestPicFileIsNotNull();
}
}
if(behaviorVo.getTestPicFile_arr() != null) {
criteria.andTestPicFileIn(behaviorVo.getTestPicFile_arr());
}
if(behaviorVo.getTestPicFile_like() != null) {
criteria.andTestPicFileLike(behaviorVo.getTestPicFile_like());
}
if(behaviorVo.getTestFrameNo() != null) {
criteria.andTestFrameNoEqualTo(behaviorVo.getTestFrameNo());
}
if(behaviorVo.getTestFrameNo_null() != null) {
if(behaviorVo.getTestFrameNo_null().booleanValue()) {
criteria.andTestFrameNoIsNull();
} else {
criteria.andTestFrameNoIsNotNull();
}
}
if(behaviorVo.getTestFrameNo_arr() != null) {
criteria.andTestFrameNoIn(behaviorVo.getTestFrameNo_arr());
}
if(behaviorVo.getTestFrameNo_like() != null) {
criteria.andTestFrameNoLike(behaviorVo.getTestFrameNo_like());
}
if(behaviorVo.getTaskName() != null) { if(behaviorVo.getTaskName() != null) {
criteria.andTaskNameEqualTo(behaviorVo.getTaskName()); criteria.andTaskNameEqualTo(behaviorVo.getTaskName());
} }
......
...@@ -37,6 +37,24 @@ public abstract class FlowDataBaseController extends BaseController<FlowData, Fl ...@@ -37,6 +37,24 @@ public abstract class FlowDataBaseController extends BaseController<FlowData, Fl
if(flowDataVo.getId_lte() != null) { if(flowDataVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(flowDataVo.getId_lte()); criteria.andIdLessThanOrEqualTo(flowDataVo.getId_lte());
} }
if(flowDataVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(flowDataVo.getEventTime());
}
if(flowDataVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(flowDataVo.getEventTime_arr());
}
if(flowDataVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(flowDataVo.getEventTime_gt());
}
if(flowDataVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(flowDataVo.getEventTime_lt());
}
if(flowDataVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(flowDataVo.getEventTime_gte());
}
if(flowDataVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(flowDataVo.getEventTime_lte());
}
if(flowDataVo.getUnid() != null) { if(flowDataVo.getUnid() != null) {
criteria.andUnidEqualTo(flowDataVo.getUnid()); criteria.andUnidEqualTo(flowDataVo.getUnid());
} }
...@@ -442,31 +460,6 @@ public abstract class FlowDataBaseController extends BaseController<FlowData, Fl ...@@ -442,31 +460,6 @@ public abstract class FlowDataBaseController extends BaseController<FlowData, Fl
if(flowDataVo.getSampleNumOut_lte() != null) { if(flowDataVo.getSampleNumOut_lte() != null) {
criteria.andSampleNumOutLessThanOrEqualTo(flowDataVo.getSampleNumOut_lte()); criteria.andSampleNumOutLessThanOrEqualTo(flowDataVo.getSampleNumOut_lte());
} }
if(flowDataVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(flowDataVo.getEventTime());
}
if(flowDataVo.getEventTime_null() != null) {
if(flowDataVo.getEventTime_null().booleanValue()) {
criteria.andEventTimeIsNull();
} else {
criteria.andEventTimeIsNotNull();
}
}
if(flowDataVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(flowDataVo.getEventTime_arr());
}
if(flowDataVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(flowDataVo.getEventTime_gt());
}
if(flowDataVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(flowDataVo.getEventTime_lt());
}
if(flowDataVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(flowDataVo.getEventTime_gte());
}
if(flowDataVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(flowDataVo.getEventTime_lte());
}
if(flowDataVo.getDistTime() != null) { if(flowDataVo.getDistTime() != null) {
criteria.andDistTimeEqualTo(flowDataVo.getDistTime()); criteria.andDistTimeEqualTo(flowDataVo.getDistTime());
} }
......
...@@ -37,6 +37,24 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent, ...@@ -37,6 +37,24 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getId_lte() != null) { if(flowEventVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(flowEventVo.getId_lte()); criteria.andIdLessThanOrEqualTo(flowEventVo.getId_lte());
} }
if(flowEventVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(flowEventVo.getEventTime());
}
if(flowEventVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(flowEventVo.getEventTime_arr());
}
if(flowEventVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(flowEventVo.getEventTime_gt());
}
if(flowEventVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(flowEventVo.getEventTime_lt());
}
if(flowEventVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(flowEventVo.getEventTime_gte());
}
if(flowEventVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(flowEventVo.getEventTime_lte());
}
if(flowEventVo.getUnid() != null) { if(flowEventVo.getUnid() != null) {
criteria.andUnidEqualTo(flowEventVo.getUnid()); criteria.andUnidEqualTo(flowEventVo.getUnid());
} }
...@@ -87,31 +105,6 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent, ...@@ -87,31 +105,6 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getEventType_like() != null) { if(flowEventVo.getEventType_like() != null) {
criteria.andEventTypeLike(flowEventVo.getEventType_like()); criteria.andEventTypeLike(flowEventVo.getEventType_like());
} }
if(flowEventVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(flowEventVo.getEventTime());
}
if(flowEventVo.getEventTime_null() != null) {
if(flowEventVo.getEventTime_null().booleanValue()) {
criteria.andEventTimeIsNull();
} else {
criteria.andEventTimeIsNotNull();
}
}
if(flowEventVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(flowEventVo.getEventTime_arr());
}
if(flowEventVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(flowEventVo.getEventTime_gt());
}
if(flowEventVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(flowEventVo.getEventTime_lt());
}
if(flowEventVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(flowEventVo.getEventTime_gte());
}
if(flowEventVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(flowEventVo.getEventTime_lte());
}
if(flowEventVo.getEventId() != null) { if(flowEventVo.getEventId() != null) {
criteria.andEventIdEqualTo(flowEventVo.getEventId()); criteria.andEventIdEqualTo(flowEventVo.getEventId());
} }
...@@ -224,7 +217,6 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent, ...@@ -224,7 +217,6 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getVideoName_like() != null) { if(flowEventVo.getVideoName_like() != null) {
criteria.andVideoNameLike(flowEventVo.getVideoName_like()); criteria.andVideoNameLike(flowEventVo.getVideoName_like());
} }
return flowEventExample; return flowEventExample;
} }
......
...@@ -37,6 +37,24 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf ...@@ -37,6 +37,24 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf
if(trafficVo.getId_lte() != null) { if(trafficVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(trafficVo.getId_lte()); criteria.andIdLessThanOrEqualTo(trafficVo.getId_lte());
} }
if(trafficVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(trafficVo.getEventTime());
}
if(trafficVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(trafficVo.getEventTime_arr());
}
if(trafficVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(trafficVo.getEventTime_gt());
}
if(trafficVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(trafficVo.getEventTime_lt());
}
if(trafficVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(trafficVo.getEventTime_gte());
}
if(trafficVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(trafficVo.getEventTime_lte());
}
if(trafficVo.getUnid() != null) { if(trafficVo.getUnid() != null) {
criteria.andUnidEqualTo(trafficVo.getUnid()); criteria.andUnidEqualTo(trafficVo.getUnid());
} }
...@@ -103,24 +121,6 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf ...@@ -103,24 +121,6 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf
if(trafficVo.getEventType_like() != null) { if(trafficVo.getEventType_like() != null) {
criteria.andEventTypeLike(trafficVo.getEventType_like()); criteria.andEventTypeLike(trafficVo.getEventType_like());
} }
if(trafficVo.getEventDt() != null) {
criteria.andEventDtEqualTo(trafficVo.getEventDt());
}
if(trafficVo.getEventDt_arr() != null) {
criteria.andEventDtIn(trafficVo.getEventDt_arr());
}
if(trafficVo.getEventDt_gt() != null) {
criteria.andEventDtGreaterThan(trafficVo.getEventDt_gt());
}
if(trafficVo.getEventDt_lt() != null) {
criteria.andEventDtLessThan(trafficVo.getEventDt_lt());
}
if(trafficVo.getEventDt_gte() != null) {
criteria.andEventDtGreaterThanOrEqualTo(trafficVo.getEventDt_gte());
}
if(trafficVo.getEventDt_lte() != null) {
criteria.andEventDtLessThanOrEqualTo(trafficVo.getEventDt_lte());
}
if(trafficVo.getChannelUnid() != null) { if(trafficVo.getChannelUnid() != null) {
criteria.andChannelUnidEqualTo(trafficVo.getChannelUnid()); criteria.andChannelUnidEqualTo(trafficVo.getChannelUnid());
} }
...@@ -545,6 +545,7 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf ...@@ -545,6 +545,7 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf
if(trafficVo.getStatus_lte() != null) { if(trafficVo.getStatus_lte() != null) {
criteria.andStatusLessThanOrEqualTo(trafficVo.getStatus_lte()); criteria.andStatusLessThanOrEqualTo(trafficVo.getStatus_lte());
} }
return trafficExample; return trafficExample;
} }
......
...@@ -2,12 +2,13 @@ package com.viontech.fanxing.query.controller.base; ...@@ -2,12 +2,13 @@ package com.viontech.fanxing.query.controller.base;
import com.viontech.fanxing.commons.base.BaseController; import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.commons.base.BaseExample; import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseService; import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.TrafficFace; import com.viontech.fanxing.commons.model.TrafficFace;
import com.viontech.fanxing.commons.model.TrafficFaceExample; import com.viontech.fanxing.commons.model.TrafficFaceExample;
import com.viontech.fanxing.commons.vo.TrafficFaceVo; import com.viontech.fanxing.commons.vo.TrafficFaceVo;
import com.viontech.fanxing.query.mapper.TrafficFaceMapper;
import com.viontech.fanxing.query.service.adapter.TrafficFaceService; import com.viontech.fanxing.query.service.adapter.TrafficFaceService;
import javax.annotation.Resource; import javax.annotation.Resource;
public abstract class TrafficFaceBaseController extends BaseController<TrafficFace, TrafficFaceVo> { public abstract class TrafficFaceBaseController extends BaseController<TrafficFace, TrafficFaceVo> {
...@@ -18,117 +19,135 @@ public abstract class TrafficFaceBaseController extends BaseController<TrafficFa ...@@ -18,117 +19,135 @@ public abstract class TrafficFaceBaseController extends BaseController<TrafficFa
protected BaseExample getExample(TrafficFaceVo trafficFaceVo, int type) { protected BaseExample getExample(TrafficFaceVo trafficFaceVo, int type) {
TrafficFaceExample trafficFaceExample = new TrafficFaceExample(); TrafficFaceExample trafficFaceExample = new TrafficFaceExample();
TrafficFaceExample.Criteria criteria = trafficFaceExample.createCriteria(); TrafficFaceExample.Criteria criteria = trafficFaceExample.createCriteria();
if (trafficFaceVo.getId() != null) { if(trafficFaceVo.getId() != null) {
criteria.andIdEqualTo(trafficFaceVo.getId()); criteria.andIdEqualTo(trafficFaceVo.getId());
} }
if (trafficFaceVo.getId_arr() != null) { if(trafficFaceVo.getId_arr() != null) {
criteria.andIdIn(trafficFaceVo.getId_arr()); criteria.andIdIn(trafficFaceVo.getId_arr());
} }
if (trafficFaceVo.getId_gt() != null) { if(trafficFaceVo.getId_gt() != null) {
criteria.andIdGreaterThan(trafficFaceVo.getId_gt()); criteria.andIdGreaterThan(trafficFaceVo.getId_gt());
} }
if (trafficFaceVo.getId_lt() != null) { if(trafficFaceVo.getId_lt() != null) {
criteria.andIdLessThan(trafficFaceVo.getId_lt()); criteria.andIdLessThan(trafficFaceVo.getId_lt());
} }
if (trafficFaceVo.getId_gte() != null) { if(trafficFaceVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(trafficFaceVo.getId_gte()); criteria.andIdGreaterThanOrEqualTo(trafficFaceVo.getId_gte());
} }
if (trafficFaceVo.getId_lte() != null) { if(trafficFaceVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(trafficFaceVo.getId_lte()); criteria.andIdLessThanOrEqualTo(trafficFaceVo.getId_lte());
} }
if (trafficFaceVo.getUnid() != null) { if(trafficFaceVo.getEventTime() != null) {
criteria.andEventTimeEqualTo(trafficFaceVo.getEventTime());
}
if(trafficFaceVo.getEventTime_arr() != null) {
criteria.andEventTimeIn(trafficFaceVo.getEventTime_arr());
}
if(trafficFaceVo.getEventTime_gt() != null) {
criteria.andEventTimeGreaterThan(trafficFaceVo.getEventTime_gt());
}
if(trafficFaceVo.getEventTime_lt() != null) {
criteria.andEventTimeLessThan(trafficFaceVo.getEventTime_lt());
}
if(trafficFaceVo.getEventTime_gte() != null) {
criteria.andEventTimeGreaterThanOrEqualTo(trafficFaceVo.getEventTime_gte());
}
if(trafficFaceVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(trafficFaceVo.getEventTime_lte());
}
if(trafficFaceVo.getUnid() != null) {
criteria.andUnidEqualTo(trafficFaceVo.getUnid()); criteria.andUnidEqualTo(trafficFaceVo.getUnid());
} }
if (trafficFaceVo.getUnid_arr() != null) { if(trafficFaceVo.getUnid_arr() != null) {
criteria.andUnidIn(trafficFaceVo.getUnid_arr()); criteria.andUnidIn(trafficFaceVo.getUnid_arr());
} }
if (trafficFaceVo.getUnid_like() != null) { if(trafficFaceVo.getUnid_like() != null) {
criteria.andUnidLike(trafficFaceVo.getUnid_like()); criteria.andUnidLike(trafficFaceVo.getUnid_like());
} }
if (trafficFaceVo.getTrafficId() != null) { if(trafficFaceVo.getTrafficId() != null) {
criteria.andTrafficIdEqualTo(trafficFaceVo.getTrafficId()); criteria.andTrafficIdEqualTo(trafficFaceVo.getTrafficId());
} }
if (trafficFaceVo.getTrafficId_arr() != null) { if(trafficFaceVo.getTrafficId_arr() != null) {
criteria.andTrafficIdIn(trafficFaceVo.getTrafficId_arr()); criteria.andTrafficIdIn(trafficFaceVo.getTrafficId_arr());
} }
if (trafficFaceVo.getTrafficId_gt() != null) { if(trafficFaceVo.getTrafficId_gt() != null) {
criteria.andTrafficIdGreaterThan(trafficFaceVo.getTrafficId_gt()); criteria.andTrafficIdGreaterThan(trafficFaceVo.getTrafficId_gt());
} }
if (trafficFaceVo.getTrafficId_lt() != null) { if(trafficFaceVo.getTrafficId_lt() != null) {
criteria.andTrafficIdLessThan(trafficFaceVo.getTrafficId_lt()); criteria.andTrafficIdLessThan(trafficFaceVo.getTrafficId_lt());
} }
if (trafficFaceVo.getTrafficId_gte() != null) { if(trafficFaceVo.getTrafficId_gte() != null) {
criteria.andTrafficIdGreaterThanOrEqualTo(trafficFaceVo.getTrafficId_gte()); criteria.andTrafficIdGreaterThanOrEqualTo(trafficFaceVo.getTrafficId_gte());
} }
if (trafficFaceVo.getTrafficId_lte() != null) { if(trafficFaceVo.getTrafficId_lte() != null) {
criteria.andTrafficIdLessThanOrEqualTo(trafficFaceVo.getTrafficId_lte()); criteria.andTrafficIdLessThanOrEqualTo(trafficFaceVo.getTrafficId_lte());
} }
if (trafficFaceVo.getState() != null) { if(trafficFaceVo.getState() != null) {
criteria.andStateEqualTo(trafficFaceVo.getState()); criteria.andStateEqualTo(trafficFaceVo.getState());
} }
if (trafficFaceVo.getState_arr() != null) { if(trafficFaceVo.getState_arr() != null) {
criteria.andStateIn(trafficFaceVo.getState_arr()); criteria.andStateIn(trafficFaceVo.getState_arr());
} }
if (trafficFaceVo.getState_gt() != null) { if(trafficFaceVo.getState_gt() != null) {
criteria.andStateGreaterThan(trafficFaceVo.getState_gt()); criteria.andStateGreaterThan(trafficFaceVo.getState_gt());
} }
if (trafficFaceVo.getState_lt() != null) { if(trafficFaceVo.getState_lt() != null) {
criteria.andStateLessThan(trafficFaceVo.getState_lt()); criteria.andStateLessThan(trafficFaceVo.getState_lt());
} }
if (trafficFaceVo.getState_gte() != null) { if(trafficFaceVo.getState_gte() != null) {
criteria.andStateGreaterThanOrEqualTo(trafficFaceVo.getState_gte()); criteria.andStateGreaterThanOrEqualTo(trafficFaceVo.getState_gte());
} }
if (trafficFaceVo.getState_lte() != null) { if(trafficFaceVo.getState_lte() != null) {
criteria.andStateLessThanOrEqualTo(trafficFaceVo.getState_lte()); criteria.andStateLessThanOrEqualTo(trafficFaceVo.getState_lte());
} }
if (trafficFaceVo.getSex() != null) { if(trafficFaceVo.getSex() != null) {
criteria.andSexEqualTo(trafficFaceVo.getSex()); criteria.andSexEqualTo(trafficFaceVo.getSex());
} }
if (trafficFaceVo.getSex_arr() != null) { if(trafficFaceVo.getSex_arr() != null) {
criteria.andSexIn(trafficFaceVo.getSex_arr()); criteria.andSexIn(trafficFaceVo.getSex_arr());
} }
if (trafficFaceVo.getSex_gt() != null) { if(trafficFaceVo.getSex_gt() != null) {
criteria.andSexGreaterThan(trafficFaceVo.getSex_gt()); criteria.andSexGreaterThan(trafficFaceVo.getSex_gt());
} }
if (trafficFaceVo.getSex_lt() != null) { if(trafficFaceVo.getSex_lt() != null) {
criteria.andSexLessThan(trafficFaceVo.getSex_lt()); criteria.andSexLessThan(trafficFaceVo.getSex_lt());
} }
if (trafficFaceVo.getSex_gte() != null) { if(trafficFaceVo.getSex_gte() != null) {
criteria.andSexGreaterThanOrEqualTo(trafficFaceVo.getSex_gte()); criteria.andSexGreaterThanOrEqualTo(trafficFaceVo.getSex_gte());
} }
if (trafficFaceVo.getSex_lte() != null) { if(trafficFaceVo.getSex_lte() != null) {
criteria.andSexLessThanOrEqualTo(trafficFaceVo.getSex_lte()); criteria.andSexLessThanOrEqualTo(trafficFaceVo.getSex_lte());
} }
if (trafficFaceVo.getUpperColor() != null) { if(trafficFaceVo.getUpperColor() != null) {
criteria.andUpperColorEqualTo(trafficFaceVo.getUpperColor()); criteria.andUpperColorEqualTo(trafficFaceVo.getUpperColor());
} }
if (trafficFaceVo.getUpperColor_null() != null) { if(trafficFaceVo.getUpperColor_null() != null) {
if (trafficFaceVo.getUpperColor_null().booleanValue()) { if(trafficFaceVo.getUpperColor_null().booleanValue()) {
criteria.andUpperColorIsNull(); criteria.andUpperColorIsNull();
} else { } else {
criteria.andUpperColorIsNotNull(); criteria.andUpperColorIsNotNull();
} }
} }
if (trafficFaceVo.getUpperColor_arr() != null) { if(trafficFaceVo.getUpperColor_arr() != null) {
criteria.andUpperColorIn(trafficFaceVo.getUpperColor_arr()); criteria.andUpperColorIn(trafficFaceVo.getUpperColor_arr());
} }
if (trafficFaceVo.getUpperColor_like() != null) { if(trafficFaceVo.getUpperColor_like() != null) {
criteria.andUpperColorLike(trafficFaceVo.getUpperColor_like()); criteria.andUpperColorLike(trafficFaceVo.getUpperColor_like());
} }
if (trafficFaceVo.getLowerColor() != null) { if(trafficFaceVo.getLowerColor() != null) {
criteria.andLowerColorEqualTo(trafficFaceVo.getLowerColor()); criteria.andLowerColorEqualTo(trafficFaceVo.getLowerColor());
} }
if (trafficFaceVo.getLowerColor_null() != null) { if(trafficFaceVo.getLowerColor_null() != null) {
if (trafficFaceVo.getLowerColor_null().booleanValue()) { if(trafficFaceVo.getLowerColor_null().booleanValue()) {
criteria.andLowerColorIsNull(); criteria.andLowerColorIsNull();
} else { } else {
criteria.andLowerColorIsNotNull(); criteria.andLowerColorIsNotNull();
} }
} }
if (trafficFaceVo.getLowerColor_arr() != null) { if(trafficFaceVo.getLowerColor_arr() != null) {
criteria.andLowerColorIn(trafficFaceVo.getLowerColor_arr()); criteria.andLowerColorIn(trafficFaceVo.getLowerColor_arr());
} }
if (trafficFaceVo.getLowerColor_like() != null) { if(trafficFaceVo.getLowerColor_like() != null) {
criteria.andLowerColorLike(trafficFaceVo.getLowerColor_like()); criteria.andLowerColorLike(trafficFaceVo.getLowerColor_like());
} }
return trafficFaceExample; return trafficFaceExample;
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<mapper namespace="com.viontech.fanxing.query.mapper.FlowEventMapper" > <mapper namespace="com.viontech.fanxing.query.mapper.FlowEventMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.FlowEvent" > <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.FlowEvent" >
<id column="flowEvent_id" property="id" /> <id column="flowEvent_id" property="id" />
<id column="flowEvent_event_time" property="eventTime" />
<result column="flowEvent_unid" property="unid" /> <result column="flowEvent_unid" property="unid" />
<result column="flowEvent_task_id" property="taskId" /> <result column="flowEvent_task_id" property="taskId" />
<result column="flowEvent_event_type" property="eventType" /> <result column="flowEvent_event_type" property="eventType" />
<result column="flowEvent_event_time" property="eventTime" />
<result column="flowEvent_event_id" property="eventId" /> <result column="flowEvent_event_id" property="eventId" />
<result column="flowEvent_device_code" property="deviceCode" /> <result column="flowEvent_device_code" property="deviceCode" />
<result column="flowEvent_device_name" property="deviceName" /> <result column="flowEvent_device_name" property="deviceName" />
...@@ -78,8 +78,8 @@ ...@@ -78,8 +78,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List_Root" > <sql id="Base_Column_List_Root" >
`flowEvent`.id as flowEvent_id, `flowEvent`.unid as flowEvent_unid, `flowEvent`.task_id as flowEvent_task_id, `flowEvent`.id as flowEvent_id, `flowEvent`.event_time as flowEvent_event_time, `flowEvent`.unid as flowEvent_unid,
`flowEvent`.event_type as flowEvent_event_type, `flowEvent`.event_time as flowEvent_event_time, `flowEvent`.task_id as flowEvent_task_id, `flowEvent`.event_type as flowEvent_event_type,
`flowEvent`.event_id as flowEvent_event_id, `flowEvent`.device_code as flowEvent_device_code, `flowEvent`.event_id as flowEvent_event_id, `flowEvent`.device_code as flowEvent_device_code,
`flowEvent`.device_name as flowEvent_device_name, `flowEvent`.location_code as flowEvent_location_code, `flowEvent`.device_name as flowEvent_device_name, `flowEvent`.location_code as flowEvent_location_code,
`flowEvent`.location_name as flowEvent_location_name, `flowEvent`.pics as flowEvent_pics, `flowEvent`.location_name as flowEvent_location_name, `flowEvent`.pics as flowEvent_pics,
...@@ -143,17 +143,19 @@ ...@@ -143,17 +143,19 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="map" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List" />
from `d_flow_event` `flowEvent` from `d_flow_event` `flowEvent`
where `flowEvent`.id = #{id,jdbcType=BIGINT} where `flowEvent`.id = #{id,jdbcType=BIGINT}
and `flowEvent`.event_time = #{eventTime,jdbcType=TIMESTAMP}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > <delete id="deleteByPrimaryKey" parameterType="map" >
delete from `d_flow_event` `flowEvent` delete from `d_flow_event` `flowEvent`
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.FlowEventExample" > <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.FlowEventExample" >
delete from `d_flow_event` `flowEvent` delete from `d_flow_event` `flowEvent`
...@@ -162,13 +164,13 @@ ...@@ -162,13 +164,13 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insert" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_flow_event` (unid, task_id, event_type, insert into `d_flow_event` (event_time, unid, task_id,
event_time, event_id, device_code, event_type, event_id, device_code,
device_name, location_code, location_name, device_name, location_code, location_name,
pics, video_name, json_data pics, video_name, json_data
) )
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR}, values (#{eventTime,jdbcType=TIMESTAMP}, #{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT},
#{eventTime,jdbcType=TIMESTAMP}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR},
#{deviceName,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR}, #{deviceName,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR},
#{pics,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR} #{pics,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR}
) )
...@@ -176,6 +178,9 @@ ...@@ -176,6 +178,9 @@
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_flow_event` insert into `d_flow_event`
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
event_time,
</if>
<if test="unid != null" > <if test="unid != null" >
unid, unid,
</if> </if>
...@@ -185,9 +190,6 @@ ...@@ -185,9 +190,6 @@
<if test="eventType != null" > <if test="eventType != null" >
event_type, event_type,
</if> </if>
<if test="eventTime != null" >
event_time,
</if>
<if test="eventId != null" > <if test="eventId != null" >
event_id, event_id,
</if> </if>
...@@ -214,6 +216,9 @@ ...@@ -214,6 +216,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="unid != null" > <if test="unid != null" >
#{unid,jdbcType=VARCHAR}, #{unid,jdbcType=VARCHAR},
</if> </if>
...@@ -223,9 +228,6 @@ ...@@ -223,9 +228,6 @@
<if test="eventType != null" > <if test="eventType != null" >
#{eventType,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR},
</if> </if>
<if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="eventId != null" > <if test="eventId != null" >
#{eventId,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR},
</if> </if>
...@@ -264,6 +266,9 @@ ...@@ -264,6 +266,9 @@
<if test="record.id != null" > <if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if test="record.unid != null" > <if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
</if> </if>
...@@ -273,9 +278,6 @@ ...@@ -273,9 +278,6 @@
<if test="record.eventType != null" > <if test="record.eventType != null" >
event_type = #{record.eventType,jdbcType=VARCHAR}, event_type = #{record.eventType,jdbcType=VARCHAR},
</if> </if>
<if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if test="record.eventId != null" > <if test="record.eventId != null" >
event_id = #{record.eventId,jdbcType=VARCHAR}, event_id = #{record.eventId,jdbcType=VARCHAR},
</if> </if>
...@@ -308,10 +310,10 @@ ...@@ -308,10 +310,10 @@
<update id="updateByExampleWithBLOBs" parameterType="map" > <update id="updateByExampleWithBLOBs" parameterType="map" >
update `d_flow_event` `flowEvent` update `d_flow_event` `flowEvent`
set `flowEvent`.id = #{record.id,jdbcType=BIGINT}, set `flowEvent`.id = #{record.id,jdbcType=BIGINT},
`flowEvent`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`flowEvent`.unid = #{record.unid,jdbcType=VARCHAR}, `flowEvent`.unid = #{record.unid,jdbcType=VARCHAR},
`flowEvent`.task_id = #{record.taskId,jdbcType=BIGINT}, `flowEvent`.task_id = #{record.taskId,jdbcType=BIGINT},
`flowEvent`.event_type = #{record.eventType,jdbcType=VARCHAR}, `flowEvent`.event_type = #{record.eventType,jdbcType=VARCHAR},
`flowEvent`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`flowEvent`.event_id = #{record.eventId,jdbcType=VARCHAR}, `flowEvent`.event_id = #{record.eventId,jdbcType=VARCHAR},
`flowEvent`.device_code = #{record.deviceCode,jdbcType=VARCHAR}, `flowEvent`.device_code = #{record.deviceCode,jdbcType=VARCHAR},
`flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR}, `flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR},
...@@ -327,10 +329,10 @@ ...@@ -327,10 +329,10 @@
<update id="updateByExample" parameterType="map" > <update id="updateByExample" parameterType="map" >
update `d_flow_event` `flowEvent` update `d_flow_event` `flowEvent`
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
task_id = #{record.taskId,jdbcType=BIGINT}, task_id = #{record.taskId,jdbcType=BIGINT},
event_type = #{record.eventType,jdbcType=VARCHAR}, event_type = #{record.eventType,jdbcType=VARCHAR},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
event_id = #{record.eventId,jdbcType=VARCHAR}, event_id = #{record.eventId,jdbcType=VARCHAR},
device_code = #{record.deviceCode,jdbcType=VARCHAR}, device_code = #{record.deviceCode,jdbcType=VARCHAR},
device_name = #{record.deviceName,jdbcType=VARCHAR}, device_name = #{record.deviceName,jdbcType=VARCHAR},
...@@ -354,9 +356,6 @@ ...@@ -354,9 +356,6 @@
<if test="eventType != null" > <if test="eventType != null" >
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
</if> </if>
<if test="eventTime != null" >
event_time = #{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="eventId != null" > <if test="eventId != null" >
event_id = #{eventId,jdbcType=VARCHAR}, event_id = #{eventId,jdbcType=VARCHAR},
</if> </if>
...@@ -383,13 +382,13 @@ ...@@ -383,13 +382,13 @@
</if> </if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.viontech.fanxing.commons.model.FlowEvent" > <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.viontech.fanxing.commons.model.FlowEvent" >
update `d_flow_event` update `d_flow_event`
set unid = #{unid,jdbcType=VARCHAR}, set unid = #{unid,jdbcType=VARCHAR},
task_id = #{taskId,jdbcType=BIGINT}, task_id = #{taskId,jdbcType=BIGINT},
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
event_id = #{eventId,jdbcType=VARCHAR}, event_id = #{eventId,jdbcType=VARCHAR},
device_code = #{deviceCode,jdbcType=VARCHAR}, device_code = #{deviceCode,jdbcType=VARCHAR},
device_name = #{deviceName,jdbcType=VARCHAR}, device_name = #{deviceName,jdbcType=VARCHAR},
...@@ -399,13 +398,13 @@ ...@@ -399,13 +398,13 @@
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
json_data = #{jsonData,jdbcType=LONGVARCHAR} json_data = #{jsonData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.FlowEvent" > <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.FlowEvent" >
update `d_flow_event` update `d_flow_event`
set unid = #{unid,jdbcType=VARCHAR}, set unid = #{unid,jdbcType=VARCHAR},
task_id = #{taskId,jdbcType=BIGINT}, task_id = #{taskId,jdbcType=BIGINT},
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
event_id = #{eventId,jdbcType=VARCHAR}, event_id = #{eventId,jdbcType=VARCHAR},
device_code = #{deviceCode,jdbcType=VARCHAR}, device_code = #{deviceCode,jdbcType=VARCHAR},
device_name = #{deviceName,jdbcType=VARCHAR}, device_name = #{deviceName,jdbcType=VARCHAR},
...@@ -414,5 +413,6 @@ ...@@ -414,5 +413,6 @@
pics = #{pics,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR} video_name = #{videoName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<mapper namespace="com.viontech.fanxing.query.mapper.TrafficFaceMapper" > <mapper namespace="com.viontech.fanxing.query.mapper.TrafficFaceMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.TrafficFace" > <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.TrafficFace" >
<id column="trafficFace_id" property="id" /> <id column="trafficFace_id" property="id" />
<id column="trafficFace_event_time" property="eventTime" />
<result column="trafficFace_unid" property="unid" /> <result column="trafficFace_unid" property="unid" />
<result column="trafficFace_traffic_id" property="trafficId" /> <result column="trafficFace_traffic_id" property="trafficId" />
<result column="trafficFace_state" property="state" /> <result column="trafficFace_state" property="state" />
...@@ -70,7 +71,8 @@ ...@@ -70,7 +71,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List_Root" > <sql id="Base_Column_List_Root" >
`trafficFace`.id as trafficFace_id, `trafficFace`.unid as trafficFace_unid, `trafficFace`.traffic_id as trafficFace_traffic_id, `trafficFace`.id as trafficFace_id, `trafficFace`.event_time as trafficFace_event_time,
`trafficFace`.unid as trafficFace_unid, `trafficFace`.traffic_id as trafficFace_traffic_id,
`trafficFace`.`state` as `trafficFace_state`, `trafficFace`.sex as trafficFace_sex, `trafficFace`.`state` as `trafficFace_state`, `trafficFace`.sex as trafficFace_sex,
`trafficFace`.upper_color as trafficFace_upper_color, `trafficFace`.lower_color as trafficFace_lower_color `trafficFace`.upper_color as trafficFace_upper_color, `trafficFace`.lower_color as trafficFace_lower_color
</sql> </sql>
...@@ -110,15 +112,17 @@ ...@@ -110,15 +112,17 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="map" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from `d_traffic_face` `trafficFace` from `d_traffic_face` `trafficFace`
where `trafficFace`.id = #{id,jdbcType=BIGINT} where `trafficFace`.id = #{id,jdbcType=BIGINT}
and `trafficFace`.event_time = #{eventTime,jdbcType=TIMESTAMP}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > <delete id="deleteByPrimaryKey" parameterType="map" >
delete from `d_traffic_face` `trafficFace` delete from `d_traffic_face` `trafficFace`
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.TrafficFaceExample" > <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.TrafficFaceExample" >
delete from `d_traffic_face` `trafficFace` delete from `d_traffic_face` `trafficFace`
...@@ -127,16 +131,19 @@ ...@@ -127,16 +131,19 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insert" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_traffic_face` (unid, traffic_id, `state`, insert into `d_traffic_face` (event_time, unid, traffic_id,
sex, upper_color, lower_color `state`, sex, upper_color,
) lower_color)
values (#{unid,jdbcType=VARCHAR}, #{trafficId,jdbcType=BIGINT}, #{state,jdbcType=SMALLINT}, values (#{eventTime,jdbcType=TIMESTAMP}, #{unid,jdbcType=VARCHAR}, #{trafficId,jdbcType=BIGINT},
#{sex,jdbcType=SMALLINT}, #{upperColor,jdbcType=VARCHAR}, #{lowerColor,jdbcType=VARCHAR} #{state,jdbcType=SMALLINT}, #{sex,jdbcType=SMALLINT}, #{upperColor,jdbcType=VARCHAR},
) #{lowerColor,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.TrafficFace" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_traffic_face` insert into `d_traffic_face`
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
event_time,
</if>
<if test="unid != null" > <if test="unid != null" >
unid, unid,
</if> </if>
...@@ -157,6 +164,9 @@ ...@@ -157,6 +164,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="unid != null" > <if test="unid != null" >
#{unid,jdbcType=VARCHAR}, #{unid,jdbcType=VARCHAR},
</if> </if>
...@@ -189,6 +199,9 @@ ...@@ -189,6 +199,9 @@
<if test="record.id != null" > <if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if test="record.unid != null" > <if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
</if> </if>
...@@ -215,6 +228,7 @@ ...@@ -215,6 +228,7 @@
<update id="updateByExample" parameterType="map" > <update id="updateByExample" parameterType="map" >
update `d_traffic_face` `trafficFace` update `d_traffic_face` `trafficFace`
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
traffic_id = #{record.trafficId,jdbcType=BIGINT}, traffic_id = #{record.trafficId,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=SMALLINT}, `state` = #{record.state,jdbcType=SMALLINT},
...@@ -248,6 +262,7 @@ ...@@ -248,6 +262,7 @@
</if> </if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.TrafficFace" > <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.TrafficFace" >
update `d_traffic_face` update `d_traffic_face`
...@@ -258,5 +273,6 @@ ...@@ -258,5 +273,6 @@
upper_color = #{upperColor,jdbcType=VARCHAR}, upper_color = #{upperColor,jdbcType=VARCHAR},
lower_color = #{lowerColor,jdbcType=VARCHAR} lower_color = #{lowerColor,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
<mapper namespace="com.viontech.fanxing.query.mapper.TrafficMapper" > <mapper namespace="com.viontech.fanxing.query.mapper.TrafficMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.Traffic" > <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.Traffic" >
<id column="traffic_id" property="id" /> <id column="traffic_id" property="id" />
<id column="traffic_event_time" property="eventTime" />
<result column="traffic_unid" property="unid" /> <result column="traffic_unid" property="unid" />
<result column="traffic_task_id" property="taskId" /> <result column="traffic_task_id" property="taskId" />
<result column="traffic_event_cate" property="eventCate" /> <result column="traffic_event_cate" property="eventCate" />
<result column="traffic_event_type" property="eventType" /> <result column="traffic_event_type" property="eventType" />
<result column="traffic_event_dt" property="eventDt" />
<result column="traffic_channel_unid" property="channelUnid" /> <result column="traffic_channel_unid" property="channelUnid" />
<result column="traffic_plate_color" property="plateColor" /> <result column="traffic_plate_color" property="plateColor" />
<result column="traffic_plate_number" property="plateNumber" /> <result column="traffic_plate_number" property="plateNumber" />
...@@ -95,9 +95,9 @@ ...@@ -95,9 +95,9 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List_Root" > <sql id="Base_Column_List_Root" >
`traffic`.id as traffic_id, `traffic`.unid as traffic_unid, `traffic`.task_id as traffic_task_id, `traffic`.id as traffic_id, `traffic`.event_time as traffic_event_time, `traffic`.unid as traffic_unid,
`traffic`.event_cate as traffic_event_cate, `traffic`.event_type as traffic_event_type, `traffic`.task_id as traffic_task_id, `traffic`.event_cate as traffic_event_cate,
`traffic`.event_dt as traffic_event_dt, `traffic`.channel_unid as traffic_channel_unid, `traffic`.event_type as traffic_event_type, `traffic`.channel_unid as traffic_channel_unid,
`traffic`.plate_color as traffic_plate_color, `traffic`.plate_number as traffic_plate_number, `traffic`.plate_color as traffic_plate_color, `traffic`.plate_number as traffic_plate_number,
`traffic`.location_code as traffic_location_code, `traffic`.location_name as traffic_location_name, `traffic`.location_code as traffic_location_code, `traffic`.location_name as traffic_location_name,
`traffic`.lane_code as traffic_lane_code, `traffic`.direction_code as traffic_direction_code, `traffic`.lane_code as traffic_lane_code, `traffic`.direction_code as traffic_direction_code,
...@@ -168,17 +168,19 @@ ...@@ -168,17 +168,19 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="map" >
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List" />
from `d_traffic` `traffic` from `d_traffic` `traffic`
where `traffic`.id = #{id,jdbcType=BIGINT} where `traffic`.id = #{id,jdbcType=BIGINT}
and `traffic`.event_time = #{eventTime,jdbcType=TIMESTAMP}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > <delete id="deleteByPrimaryKey" parameterType="map" >
delete from `d_traffic` `traffic` delete from `d_traffic` `traffic`
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.TrafficExample" > <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.TrafficExample" >
delete from `d_traffic` `traffic` delete from `d_traffic` `traffic`
...@@ -187,8 +189,8 @@ ...@@ -187,8 +189,8 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insert" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_traffic` (unid, task_id, event_cate, insert into `d_traffic` (event_time, unid, task_id,
event_type, event_dt, channel_unid, event_cate, event_type, channel_unid,
plate_color, plate_number, location_code, plate_color, plate_number, location_code,
location_name, lane_code, direction_code, location_name, lane_code, direction_code,
vehicle_type, vehicle_color, vehicle_logo, vehicle_type, vehicle_color, vehicle_logo,
...@@ -197,8 +199,8 @@ ...@@ -197,8 +199,8 @@
xcycle_type, event_id, special_type, xcycle_type, event_id, special_type,
with_helmet, pics, video_name, with_helmet, pics, video_name,
`status`, json_data) `status`, json_data)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventCate,jdbcType=VARCHAR}, values (#{eventTime,jdbcType=TIMESTAMP}, #{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT},
#{eventType,jdbcType=VARCHAR}, #{eventDt,jdbcType=TIMESTAMP}, #{channelUnid,jdbcType=VARCHAR}, #{eventCate,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR},
#{plateColor,jdbcType=VARCHAR}, #{plateNumber,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{plateColor,jdbcType=VARCHAR}, #{plateNumber,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR},
#{locationName,jdbcType=VARCHAR}, #{laneCode,jdbcType=VARCHAR}, #{directionCode,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR}, #{laneCode,jdbcType=VARCHAR}, #{directionCode,jdbcType=VARCHAR},
#{vehicleType,jdbcType=VARCHAR}, #{vehicleColor,jdbcType=VARCHAR}, #{vehicleLogo,jdbcType=VARCHAR}, #{vehicleType,jdbcType=VARCHAR}, #{vehicleColor,jdbcType=VARCHAR}, #{vehicleLogo,jdbcType=VARCHAR},
...@@ -211,6 +213,9 @@ ...@@ -211,6 +213,9 @@
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_traffic` insert into `d_traffic`
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
event_time,
</if>
<if test="unid != null" > <if test="unid != null" >
unid, unid,
</if> </if>
...@@ -223,9 +228,6 @@ ...@@ -223,9 +228,6 @@
<if test="eventType != null" > <if test="eventType != null" >
event_type, event_type,
</if> </if>
<if test="eventDt != null" >
event_dt,
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
channel_unid, channel_unid,
</if> </if>
...@@ -300,6 +302,9 @@ ...@@ -300,6 +302,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="unid != null" > <if test="unid != null" >
#{unid,jdbcType=VARCHAR}, #{unid,jdbcType=VARCHAR},
</if> </if>
...@@ -312,9 +317,6 @@ ...@@ -312,9 +317,6 @@
<if test="eventType != null" > <if test="eventType != null" >
#{eventType,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR},
</if> </if>
<if test="eventDt != null" >
#{eventDt,jdbcType=TIMESTAMP},
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
#{channelUnid,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -401,6 +403,9 @@ ...@@ -401,6 +403,9 @@
<if test="record.id != null" > <if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if test="record.unid != null" > <if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
</if> </if>
...@@ -413,9 +418,6 @@ ...@@ -413,9 +418,6 @@
<if test="record.eventType != null" > <if test="record.eventType != null" >
event_type = #{record.eventType,jdbcType=VARCHAR}, event_type = #{record.eventType,jdbcType=VARCHAR},
</if> </if>
<if test="record.eventDt != null" >
event_dt = #{record.eventDt,jdbcType=TIMESTAMP},
</if>
<if test="record.channelUnid != null" > <if test="record.channelUnid != null" >
channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -496,11 +498,11 @@ ...@@ -496,11 +498,11 @@
<update id="updateByExampleWithBLOBs" parameterType="map" > <update id="updateByExampleWithBLOBs" parameterType="map" >
update `d_traffic` `traffic` update `d_traffic` `traffic`
set `traffic`.id = #{record.id,jdbcType=BIGINT}, set `traffic`.id = #{record.id,jdbcType=BIGINT},
`traffic`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`traffic`.unid = #{record.unid,jdbcType=VARCHAR}, `traffic`.unid = #{record.unid,jdbcType=VARCHAR},
`traffic`.task_id = #{record.taskId,jdbcType=BIGINT}, `traffic`.task_id = #{record.taskId,jdbcType=BIGINT},
`traffic`.event_cate = #{record.eventCate,jdbcType=VARCHAR}, `traffic`.event_cate = #{record.eventCate,jdbcType=VARCHAR},
`traffic`.event_type = #{record.eventType,jdbcType=VARCHAR}, `traffic`.event_type = #{record.eventType,jdbcType=VARCHAR},
`traffic`.event_dt = #{record.eventDt,jdbcType=TIMESTAMP},
`traffic`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, `traffic`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
`traffic`.plate_color = #{record.plateColor,jdbcType=VARCHAR}, `traffic`.plate_color = #{record.plateColor,jdbcType=VARCHAR},
`traffic`.plate_number = #{record.plateNumber,jdbcType=VARCHAR}, `traffic`.plate_number = #{record.plateNumber,jdbcType=VARCHAR},
...@@ -532,11 +534,11 @@ ...@@ -532,11 +534,11 @@
<update id="updateByExample" parameterType="map" > <update id="updateByExample" parameterType="map" >
update `d_traffic` `traffic` update `d_traffic` `traffic`
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
unid = #{record.unid,jdbcType=VARCHAR}, unid = #{record.unid,jdbcType=VARCHAR},
task_id = #{record.taskId,jdbcType=BIGINT}, task_id = #{record.taskId,jdbcType=BIGINT},
event_cate = #{record.eventCate,jdbcType=VARCHAR}, event_cate = #{record.eventCate,jdbcType=VARCHAR},
event_type = #{record.eventType,jdbcType=VARCHAR}, event_type = #{record.eventType,jdbcType=VARCHAR},
event_dt = #{record.eventDt,jdbcType=TIMESTAMP},
channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
plate_color = #{record.plateColor,jdbcType=VARCHAR}, plate_color = #{record.plateColor,jdbcType=VARCHAR},
plate_number = #{record.plateNumber,jdbcType=VARCHAR}, plate_number = #{record.plateNumber,jdbcType=VARCHAR},
...@@ -579,9 +581,6 @@ ...@@ -579,9 +581,6 @@
<if test="eventType != null" > <if test="eventType != null" >
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
</if> </if>
<if test="eventDt != null" >
event_dt = #{eventDt,jdbcType=TIMESTAMP},
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -656,6 +655,7 @@ ...@@ -656,6 +655,7 @@
</if> </if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.viontech.fanxing.commons.model.Traffic" > <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.viontech.fanxing.commons.model.Traffic" >
update `d_traffic` update `d_traffic`
...@@ -663,7 +663,6 @@ ...@@ -663,7 +663,6 @@
task_id = #{taskId,jdbcType=BIGINT}, task_id = #{taskId,jdbcType=BIGINT},
event_cate = #{eventCate,jdbcType=VARCHAR}, event_cate = #{eventCate,jdbcType=VARCHAR},
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
event_dt = #{eventDt,jdbcType=TIMESTAMP},
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
plate_color = #{plateColor,jdbcType=VARCHAR}, plate_color = #{plateColor,jdbcType=VARCHAR},
plate_number = #{plateNumber,jdbcType=VARCHAR}, plate_number = #{plateNumber,jdbcType=VARCHAR},
...@@ -689,6 +688,7 @@ ...@@ -689,6 +688,7 @@
`status` = #{status,jdbcType=INTEGER}, `status` = #{status,jdbcType=INTEGER},
json_data = #{jsonData,jdbcType=LONGVARCHAR} json_data = #{jsonData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.Traffic" > <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.Traffic" >
update `d_traffic` update `d_traffic`
...@@ -696,7 +696,6 @@ ...@@ -696,7 +696,6 @@
task_id = #{taskId,jdbcType=BIGINT}, task_id = #{taskId,jdbcType=BIGINT},
event_cate = #{eventCate,jdbcType=VARCHAR}, event_cate = #{eventCate,jdbcType=VARCHAR},
event_type = #{eventType,jdbcType=VARCHAR}, event_type = #{eventType,jdbcType=VARCHAR},
event_dt = #{eventDt,jdbcType=TIMESTAMP},
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
plate_color = #{plateColor,jdbcType=VARCHAR}, plate_color = #{plateColor,jdbcType=VARCHAR},
plate_number = #{plateNumber,jdbcType=VARCHAR}, plate_number = #{plateNumber,jdbcType=VARCHAR},
...@@ -721,5 +720,6 @@ ...@@ -721,5 +720,6 @@
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER} `status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
and event_time = #{eventTime,jdbcType=TIMESTAMP}
</update> </update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -41,6 +41,15 @@ ...@@ -41,6 +41,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
...@@ -49,12 +58,6 @@ ...@@ -49,12 +58,6 @@
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources> </resources>
</build> </build>
......
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>application.yml</exclude>
</excludes>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.task.scheduling.controller; package com.viontech.fanxing.task.scheduling.controller;
import com.viontech.fanxing.commons.feing.TaskSchedulingTasksAdapter; import com.viontech.fanxing.commons.feing.TaskSchedulingTasksAdapter;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.task.scheduling.feign.TaskClient;
import com.viontech.fanxing.task.scheduling.model.TaskData; import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.scheduling.service.TaskService; import com.viontech.fanxing.task.scheduling.service.TaskService;
import com.viontech.fanxing.task.scheduling.service.VAServerService; import com.viontech.fanxing.task.scheduling.service.VAServerService;
import com.viontech.keliu.util.JsonMessageUtil; import com.viontech.keliu.util.JsonMessageUtil;
...@@ -27,13 +30,24 @@ public class TaskController implements TaskSchedulingTasksAdapter { ...@@ -27,13 +30,24 @@ public class TaskController implements TaskSchedulingTasksAdapter {
private VAServerService vaServerService; private VAServerService vaServerService;
@Resource @Resource
private TaskService taskService; private TaskService taskService;
@Resource
private TaskClient taskClient;
@Override @Override
@PostMapping @PostMapping
public JsonMessageUtil.JsonMessage add(Task task) { public JsonMessageUtil.JsonMessage add(Task task) {
TaskData taskData = new TaskData(task); TaskData taskData = new TaskData(task);
String unid = task.getUnid(); // 获取存储配置
Long storeConfigId = task.getStoreConfigId();
JsonMessageUtil.JsonMessage<StoreConfig> storeConfigRes = taskClient.getStoreConfigById(storeConfigId);
StoreConfig storeConfigVo = (StoreConfig) storeConfigRes.getData();
if (storeConfigVo == null) {
return JsonMessageUtil.getErrorJsonMsg("无法获取对应的存储配置");
}
taskData.setStoreConfig(storeConfigVo.getContent());
// 计算运行时间并生成任务
String unid = task.getUnid();
ImmutablePair<Long, Long> nextTime = taskData.getRuntimeConfig().getNextTimeOfExecutionAndTerminal(); ImmutablePair<Long, Long> nextTime = taskData.getRuntimeConfig().getNextTimeOfExecutionAndTerminal();
Long nextExecuteTime = nextTime.left; Long nextExecuteTime = nextTime.left;
Long nextTerminateTime = nextTime.right; Long nextTerminateTime = nextTime.right;
...@@ -50,21 +64,30 @@ public class TaskController implements TaskSchedulingTasksAdapter { ...@@ -50,21 +64,30 @@ public class TaskController implements TaskSchedulingTasksAdapter {
@Override @Override
@PutMapping @PutMapping
public JsonMessageUtil.JsonMessage update(Task task) { public JsonMessageUtil.JsonMessage update(Task task) {
JsonMessageUtil.JsonMessage delete = delete(task); String taskUnid = task.getUnid();
if (delete.isSuccess()) { VaServerInfo vaServerInfo = taskService.taskRunOn(taskUnid);
JsonMessageUtil.JsonMessage add = add(task);
return add; // vaServerId 为空说明任务未执行可以先删除再建立新任务
if (vaServerInfo == null) {
JsonMessageUtil.JsonMessage delete = delete(task);
if (delete.isSuccess()) {
JsonMessageUtil.JsonMessage add = add(task);
return add;
} else {
return delete;
}
} else { } else {
return delete; taskService.updateTask(task);
return JsonMessageUtil.getSuccessJsonMsg("success");
} }
} }
@Override @Override
@DeleteMapping @DeleteMapping
public JsonMessageUtil.JsonMessage delete(Task task) { public JsonMessageUtil.JsonMessage delete(Task task) {
String unid = task.getUnid(); String taskUnid = task.getUnid();
vaServerService.terminateTask(task); vaServerService.terminateTask(taskUnid);
taskService.removeTaskDataAll(unid); taskService.removeTaskDataAll(taskUnid);
// todo // todo
return JsonMessageUtil.getSuccessJsonMsg("success"); return JsonMessageUtil.getSuccessJsonMsg("success");
} }
......
package com.viontech.fanxing.task.scheduling.controller; package com.viontech.fanxing.task.scheduling.controller;
import com.alibaba.fastjson.JSON;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.scheduling.service.VAServerService; import com.viontech.fanxing.task.scheduling.service.VAServerService;
import org.springframework.web.bind.annotation.PostMapping; import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.web.bind.annotation.RequestBody; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -16,21 +17,72 @@ import javax.annotation.Resource; ...@@ -16,21 +17,72 @@ import javax.annotation.Resource;
*/ */
@RestController @RestController
@Slf4j
public class VAServerController { public class VAServerController {
@Resource @Resource
private VAServerService vaServerService; private VAServerService vaServerService;
/**
* 注册
*/
@PostMapping("/register") @PostMapping("/register")
public Object register(@RequestBody VaServerInfo vaServerInfo) { public Object register(@RequestBody VaServerInfo vaServerInfo) {
log.info("收到注册消息:{}", JSON.toJSONString(vaServerInfo));
vaServerService.registeVAServer(vaServerInfo); vaServerService.registeVAServer(vaServerInfo);
return "success"; return JsonMessageUtil.getSuccessJsonMsg("success");
} }
@PostMapping("/keepalive") /**
public Object keepalive(String devId) { * 心跳
*/
@GetMapping("/keepalive/{devId}")
public Object keepalive(@PathVariable String devId) {
log.info("收到心跳消息:{}", devId);
vaServerService.keepalive(devId); vaServerService.keepalive(devId);
return "success"; return JsonMessageUtil.getSuccessJsonMsg("success");
}
/**
* 获取分析视频点播地址
*/
@GetMapping("/getAnalyzeStream")
public Object getAnalyzeStream(@RequestParam String taskUnid) {
return vaServerService.getAnalyzeStream(taskUnid);
}
/**
* 输出分析流,每30秒调一次,不调用就不再输出视频流
*/
@GetMapping("/startAnalyzeStream")
public Object startAnalyzeStream(@RequestParam String taskUnid) {
return vaServerService.startAnalyzeStream(taskUnid);
}
/**
* 获取vaServer运行状态,配置等信息
*/
@GetMapping("/status")
public Object status(@RequestParam String taskUnid) {
return vaServerService.getStatus(taskUnid);
}
/**
* 切换场景/预置位
*/
@GetMapping("/switchScene")
public Object switchScene(@RequestParam String taskUnid, String sceneId) {
return vaServerService.switchScene(taskUnid, sceneId);
}
/**
* 截图
*/
@GetMapping("/snapshot")
public Object snapshot(@RequestParam String taskUnid) {
return vaServerService.snapshot(taskUnid);
} }
......
package com.viontech.fanxing.task.scheduling.feign;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.vo.StoreConfigVo;
import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* .
*
* @author 谢明辉
* @date 2021/7/20
*/
@Component
@FeignClient(value = "fanxing-task-manager")
public interface TaskClient {
@PostMapping("/tasks/{id}")
JsonMessageUtil.JsonMessage<TaskVo> updateTask(@PathVariable("id") Long taskId, @RequestBody TaskVo taskVo);
@GetMapping("/storeConfigs/{id}")
JsonMessageUtil.JsonMessage<StoreConfig> getStoreConfigById(@PathVariable("id") Long storeConfigId);
}
...@@ -22,6 +22,8 @@ public class TaskData implements Serializable { ...@@ -22,6 +22,8 @@ public class TaskData implements Serializable {
private RuntimeConfig runtimeConfig; private RuntimeConfig runtimeConfig;
private String storeConfig;
public TaskData(Task task) { public TaskData(Task task) {
this.task = task; this.task = task;
......
package com.viontech.fanxing.task.scheduling.model.vaserver;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.task.scheduling.model.TaskData;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* .
*
* @author 谢明辉
* @date 2021/7/20
*/
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@SuppressWarnings("ALL")
public class VATask {
private String task_unid;
private String task_name;
private String alg_type;
private String store_config;
private String channel_unid;
private String stream_path;
private Integer stream_type;
private String scene;
public VATask(TaskData taskData) {
Task task = taskData.getTask();
this.task_unid = task.getUnid();
this.task_name = task.getName();
this.alg_type = task.getAlgType();
this.store_config = taskData.getStoreConfig();
this.channel_unid = task.getChannelUnid();
this.stream_path = task.getStreamPath();
this.stream_type = task.getStreamType();
this.scene = task.getScene();
}
}
package com.viontech.fanxing.task.scheduling.runner; package com.viontech.fanxing.task.scheduling.runner;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.constant.TaskStatus;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.task.scheduling.feign.TaskClient;
import com.viontech.fanxing.task.scheduling.model.RuntimeConfig; import com.viontech.fanxing.task.scheduling.model.RuntimeConfig;
import com.viontech.fanxing.task.scheduling.model.TaskData; import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
...@@ -13,13 +16,11 @@ import org.redisson.api.RLock; ...@@ -13,13 +16,11 @@ import org.redisson.api.RLock;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RScoredSortedSet; import org.redisson.api.RScoredSortedSet;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.redisson.client.protocol.ScoredEntry;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -38,6 +39,8 @@ public class TaskRunner { ...@@ -38,6 +39,8 @@ public class TaskRunner {
private VAServerService vaServerService; private VAServerService vaServerService;
@Resource @Resource
private TaskService taskService; private TaskService taskService;
@Resource
private TaskClient taskClient;
@Scheduled(fixedDelay = 5000) @Scheduled(fixedDelay = 5000)
public void executedTaskListener() { public void executedTaskListener() {
...@@ -53,46 +56,41 @@ public class TaskRunner { ...@@ -53,46 +56,41 @@ public class TaskRunner {
RScoredSortedSet<String> set = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET); RScoredSortedSet<String> set = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET);
RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP); RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP);
RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP); RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
for (; ; ) { Collection<String> entryCollection = set.valueRange(0, true, System.currentTimeMillis(), true);
Collection<ScoredEntry<String>> entryCollection = set.entryRange(0, 0); for (String taskUnid : entryCollection) {
Iterator<ScoredEntry<String>> iterator = entryCollection.iterator(); log.info("开始任务 : {}", taskUnid);
if (iterator.hasNext()) { // TaskData taskData = taskDataMap.get(taskUnid);
ScoredEntry<String> next = iterator.next(); // Task task = taskData.getTask();
Double score = next.getScore(); // String taskVaType = task.getVaType();
String taskUnid = next.getValue(); // Float resourceNeed = task.getResourceNeed();
if (System.currentTimeMillis() < score) { // Collection<VaServerInfo> vaServerInfos = vaServerMap.values();
break; // // todo 暂时先找有可用资源的vaserver,以后再进行算法优化
} else { // VaServerInfo server = null;
TaskData taskData = taskDataMap.get(taskUnid); // for (VaServerInfo vaServerInfo : vaServerInfos) {
Task task = taskData.getTask(); // if (vaServerInfo.getAvailableResources() > resourceNeed) {
String taskVaType = task.getVaType(); // server = vaServerInfo;
Float resourceNeed = task.getResourceNeed(); // break;
Collection<VaServerInfo> vaServerInfos = vaServerMap.values(); // }
// todo 暂时先找有可用资源的vaserver,以后再进行算法优化 // }
Iterator<VaServerInfo> iterator1 = vaServerInfos.iterator(); //
VaServerInfo server = null; // // 找不到可以用来执行的设备,需要修改状态
while (iterator1.hasNext()) { // if (server == null) {
VaServerInfo next1 = iterator1.next(); // TaskVo taskVo = new TaskVo();
if (next1.getAvailableResources() > resourceNeed) { // taskVo.setStatus(TaskStatus.CAN_NOT_RUN.val);
server = next1; // taskClient.updateTask(task.getId(), taskVo);
break; // continue;
} // }
} //
if (server == null) { // boolean success = vaServerService.executeTask(taskData, server);
// todo 没找到可用设备,需要修改任务的状态 //
continue; // // 修改任务状态
} // TaskVo taskVo = new TaskVo();
// taskVo.setStatus(TaskStatus.RUNNING.val);
boolean success = vaServerService.executeTask(task, server); // taskClient.updateTask(task.getId(), taskVo);
// todo 修改任务状态 // // 移除任务
set.remove(taskUnid); set.remove(taskUnid);
}
} else {
return;
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("", e); log.error("", e);
} finally { } finally {
...@@ -118,33 +116,21 @@ public class TaskRunner { ...@@ -118,33 +116,21 @@ public class TaskRunner {
try { try {
RScoredSortedSet<String> set = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET); RScoredSortedSet<String> set = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET);
RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP); RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP);
for (; ; ) { Collection<String> entryCollection = set.valueRange(0, true, System.currentTimeMillis(), true);
Collection<ScoredEntry<String>> entryCollection = set.entryRange(0, 0);
Iterator<ScoredEntry<String>> iterator = entryCollection.iterator();
if (iterator.hasNext()) {
ScoredEntry<String> next = iterator.next();
Double score = next.getScore();
String taskUnid = next.getValue();
if (System.currentTimeMillis() < score) {
return;
} else {
TaskData taskData = taskDataMap.get(taskUnid);
RuntimeConfig runtimeConfig = taskData.getRuntimeConfig();
boolean success = vaServerService.terminateTask(taskData.getTask());
// todo 获取可用的 vaserver ,执行任务终止动作,如果成功,解除 taskData和 vaServer 的关联,并且从 zset 中移除任务,恢复vaserver资源数,计算下次任务执行时间,放入zset中
if (success) {
ImmutablePair<Long, Long> nextTime = runtimeConfig.getNextTimeOfExecutionAndTerminal();
taskService.addExecutableTaskData(taskUnid, nextTime.left);
taskService.addTerminatableTaskData(taskUnid, nextTime.right);
}
set.remove(taskUnid);
}
} else { for (String taskUnid : entryCollection) {
return; log.info("停止任务 : {}", taskUnid);
} // TaskData taskData = taskDataMap.get(taskUnid);
// RuntimeConfig runtimeConfig = taskData.getRuntimeConfig();
// boolean success = vaServerService.terminateTask(taskUnid);
// // todo 获取可用的 vaserver ,执行任务终止动作,如果成功,解除 taskData和 vaServer 的关联,并且从 zset 中移除任务,恢复vaserver资源数,计算下次任务执行时间,放入zset中
// if (success) {
// ImmutablePair<Long, Long> nextTime = runtimeConfig.getNextTimeOfExecutionAndTerminal();
// taskService.addExecutableTaskData(taskUnid, nextTime.left);
// taskService.addTerminatableTaskData(taskUnid, nextTime.right);
// }
set.remove(taskUnid);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("", e); log.error("", e);
} finally { } finally {
......
package com.viontech.fanxing.task.scheduling.service; package com.viontech.fanxing.task.scheduling.service;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.task.scheduling.model.TaskData; import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RScoredSortedSet; import org.redisson.api.RScoredSortedSet;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
...@@ -20,6 +23,8 @@ public class TaskService { ...@@ -20,6 +23,8 @@ public class TaskService {
@Resource @Resource
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Resource
private VAServerService vaServerService;
public boolean addExecutableTaskData(String taskUnid, Long timestamp) { public boolean addExecutableTaskData(String taskUnid, Long timestamp) {
RScoredSortedSet<String> toBeExecutedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET); RScoredSortedSet<String> toBeExecutedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET);
...@@ -36,6 +41,11 @@ public class TaskService { ...@@ -36,6 +41,11 @@ public class TaskService {
taskDataMap.put(taskData.getTask().getUnid(), taskData); taskDataMap.put(taskData.getTask().getUnid(), taskData);
} }
public TaskData getTaskDataByUnid(String taskUnid) {
RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP);
return taskDataMap.get(taskUnid);
}
public void removeTaskDataAll(String taskUnid) { public void removeTaskDataAll(String taskUnid) {
RScoredSortedSet<String> toBeExecutedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET); RScoredSortedSet<String> toBeExecutedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET);
RScoredSortedSet<String> toBeTerminatedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET); RScoredSortedSet<String> toBeTerminatedTaskUnidSet = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET);
...@@ -46,4 +56,41 @@ public class TaskService { ...@@ -46,4 +56,41 @@ public class TaskService {
taskDataMap.remove(taskUnid); taskDataMap.remove(taskUnid);
} }
public VaServerInfo taskRunOn(String taskUnid) {
RMap<String, String> taskVaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
String devId = taskVaServerMap.get(taskUnid);
if (devId != null) {
return vaServerService.getVaServerInfoByDevId(devId);
} else {
return null;
}
}
/**
* 解绑任务和设备的关联状态
*
* @return ImmutablePair<String, String>
* <li>left <code>taskUnid</code></li>
* <li>right <code>devId</code></li>
*/
public ImmutablePair<String, String> unlinkTaskAndVaServer(String taskUnid) {
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
String devId = map.get(taskUnid);
map.remove(taskUnid);
return ImmutablePair.of(taskUnid, devId);
}
public void linkTaskAndVaServer(String taskUnid, String devId) {
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
map.put(taskUnid, devId);
}
public void updateTask(Task task) {
RMap<String, TaskData> taskDataMap = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_DATA_MAP);
TaskData taskData = new TaskData(task);
// 需要更新taskData,并且向vaServer更新任务信息
taskDataMap.put(task.getUnid(), taskData);
vaServerService.updateTask(taskData);
}
} }
package com.viontech.fanxing.task.scheduling.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VATask;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import java.time.Duration;
/**
* .
*
* @author 谢明辉
* @date 2021/7/20
*/
@Service
@Slf4j
public class VAServerHttpService {
/**
* 下发任务
*/
public Object addTask(TaskData taskData, VaServerInfo vaServerInfo) {
VATask vaTask = new VATask(taskData);
String path = "/api/vaserver/v1/task";
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.post()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(vaTask)
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("下发任务结果:{}", response);
return null;
}
/**
* 编辑任务
*/
public Object updateTask(TaskData taskData, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/task";
VATask vaTask = new VATask(taskData);
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.put()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(vaTask)
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("下发任务结果:{}", response);
return null;
}
/**
* 删除任务
*/
public Object rmTask(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/task}";
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.delete()
.uri(uriBuilder -> uriBuilder
.path(path)
.queryParam("task_unid", taskUnid)
.build())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("删除任务结果:{}", response);
return null;
}
/**
* 截图
*/
public Object snapshot(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/snapshot";
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.get()
.uri(uriBuilder -> uriBuilder
.path(path)
.queryParam("task_unid", taskUnid)
.build())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("截图结果:{}", response);
return null;
}
/**
* 获取点播地址
*/
public String getAnalyzeStream(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/get_analyze_stream";
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_unid", taskUnid);
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.post()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(jsonObject.toString())
.retrieve()
.bodyToMono(String.class);
JSONObject response = stringMono.blockOptional(Duration.ofSeconds(10)).map(JSON::parseObject).get();
Integer code = response.getInteger("code");
if (code == null || -1 == code) {
throw new RuntimeException(response.getString("msg"));
} else {
return response.getString("stream_url");
}
}
/**
* 开始输出分析流
*/
public Object startAnalyzeStream(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/start_analyze_stream";
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_unid", taskUnid);
jsonObject.put("isDrawRect", 1);
jsonObject.put("mediaServerPushUrl", "rtmp://192.168.9.159:1200/task1111111");
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.post()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(jsonObject.toString())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("输出分析流结果:{}", response);
return null;
}
/**
* 切换预置位
*/
public Object switchScene(String taskUnid, VaServerInfo vaServerInfo,String sceneId) {
String path = "/api/vaserver/v1/switch_scene";
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_unid", taskUnid);
jsonObject.put("sceneID", sceneId);
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.post()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(jsonObject.toString())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("场景切换结果:{}", response);
return null;
}
/**
* 任务状态轮询控制
*/
public Object updateAlternate(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/alternate";
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_unid", taskUnid);
jsonObject.put("alternateStatus", "1");
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.post()
.uri(uriBuilder -> uriBuilder.path(path).build())
.bodyValue(jsonObject.toString())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("轮训状态控制结果:{}", response);
return null;
}
/**
* 获取轮询状态
*/
public Object getAlternate(String taskUnid, VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/alternate";
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.get()
.uri(uriBuilder -> uriBuilder
.path(path)
.queryParam("task_unid", taskUnid)
.build())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("轮训状态控制结果:{}", response);
return null;
}
/**
* 运行状态查询
*/
public Object status(VaServerInfo vaServerInfo) {
String path = "/api/vaserver/v1/status";
Mono<String> stringMono = WebClient.create(vaServerInfo.getServiceBaseUrl())
.get()
.uri(uriBuilder -> uriBuilder
.path(path)
.build())
.retrieve()
.bodyToMono(String.class);
String response = stringMono.block(Duration.ofSeconds(20));
log.info("轮训状态控制结果:{}", response);
return null;
}
}
...@@ -2,15 +2,15 @@ package com.viontech.fanxing.task.scheduling.service; ...@@ -2,15 +2,15 @@ package com.viontech.fanxing.task.scheduling.service;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.redisson.api.RBucket; import org.redisson.api.RBucket;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -24,9 +24,11 @@ import java.util.concurrent.TimeUnit; ...@@ -24,9 +24,11 @@ import java.util.concurrent.TimeUnit;
public class VAServerService { public class VAServerService {
@Resource @Resource
private RestTemplateBuilder restTemplateBuilder;
@Resource
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Resource
private TaskService taskService;
@Resource
private VAServerHttpService vaServerHttpService;
/** /**
* 设备注册 * 设备注册
...@@ -34,49 +36,40 @@ public class VAServerService { ...@@ -34,49 +36,40 @@ public class VAServerService {
public void registeVAServer(VaServerInfo vaServerInfo) { public void registeVAServer(VaServerInfo vaServerInfo) {
String devID = vaServerInfo.getDevID(); String devID = vaServerInfo.getDevID();
RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP); RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
RBucket<Object> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devID)); RBucket<Date> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devID));
bucket.set(1); bucket.set(new Date());
bucket.expire(3, TimeUnit.MINUTES); bucket.expire(2, TimeUnit.MINUTES);
map.put(devID, vaServerInfo); map.put(devID, vaServerInfo);
} }
public VaServerInfo getVaServerInfoByDevId(String devId) {
RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
return map.get(devId);
}
/** /**
* 设备心跳 * 设备心跳
*/ */
public void keepalive(String devId) { public void keepalive(String devId) {
RBucket<Object> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devId)); RBucket<Date> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devId));
bucket.set(1); bucket.set(new Date());
bucket.expire(3, TimeUnit.MINUTES); bucket.expire(2, TimeUnit.MINUTES);
}
public void linkTaskAndVaServer(String taskUnid, String devId) {
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
map.put(taskUnid, devId);
} }
/**
* 解绑任务和设备的关联状态
*
* @return ImmutablePair<String, String>
* <li>left <code>taskUnid</code></li>
* <li>right <code>devId</code></li>
*/
public ImmutablePair<String, String> unlinkTaskAndVaServer(String taskUnid) {
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
String devId = map.get(taskUnid);
map.remove(taskUnid);
return ImmutablePair.of(taskUnid, devId);
}
/** /**
* 下发任务,关联任务和vaServer,修改vaServer可用资源数 * 下发任务,关联任务和vaServer,修改vaServer可用资源数
*/ */
public boolean executeTask(Task task, VaServerInfo server) { public boolean executeTask(TaskData taskData, VaServerInfo server) {
Task task = taskData.getTask();
// todo 执行任务下发,成功后关联任务和vaServer,减少vaServer的可用资源数量
// todo 执行任务下发 vaServerHttpService.addTask(taskData, server);
linkTaskAndVaServer(task.getUnid(), server.getDevID()); taskService.linkTaskAndVaServer(task.getUnid(), server.getDevID());
server.setAvailableResources(server.getAvailableResources() - task.getResourceNeed()); server.setAvailableResources(server.getAvailableResources() - task.getResourceNeed());
RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
vaServerMap.put(server.getDevID(), server);
return false; return false;
} }
...@@ -87,49 +80,71 @@ public class VAServerService { ...@@ -87,49 +80,71 @@ public class VAServerService {
* <p> * <p>
* 删除任务 * 删除任务
*/ */
public boolean terminateTask(Task task) { public boolean terminateTask(String taskUnid) {
String taskUnid = task.getUnid(); TaskData taskData = taskService.getTaskDataByUnid(taskUnid);
Task task = taskData.getTask();
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP); RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
String vaServerId = map.get(taskUnid); String vaServerId = map.get(taskUnid);
// todo 下发终止任务请求 // 如果vaServerId不为空,需要终止任务
if (vaServerId != null) {
// 解除任务和 vaServer 关联 RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
map.remove(taskUnid); VaServerInfo vaServerInfo = vaServerMap.get(vaServerId);
RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP); // 下发终止任务请求
VaServerInfo vaServerInfo = vaServerMap.get(vaServerId); vaServerHttpService.rmTask(taskUnid, vaServerInfo);
vaServerInfo.setAvailableResources(vaServerInfo.getAvailableResources() + task.getResourceNeed()); // 解除任务和 vaServer 关联, 恢复资源数量
vaServerMap.put(vaServerId, vaServerInfo); map.remove(taskUnid);
return false; vaServerInfo.setAvailableResources(vaServerInfo.getAvailableResources() + task.getResourceNeed());
vaServerMap.put(vaServerId, vaServerInfo);
return true;
}
return true;
} }
/** /**
* 修改任务 * 修改任务
*/ */
public boolean modifyTask(Task task) { public boolean updateTask(TaskData taskData) {
VaServerInfo vaServerInfo = taskService.taskRunOn(taskData.getTask().getUnid());
return false; vaServerHttpService.updateTask(taskData, vaServerInfo);
return true;
} }
/** /**
* 截图 * 截图
*/ */
public Object snapshot(Task task) { public Object snapshot(String taskUnid) {
VaServerInfo vaServerInfo = taskService.taskRunOn(taskUnid);
return null; if (vaServerInfo != null) {
return vaServerHttpService.snapshot(taskUnid, vaServerInfo);
} else {
throw new RuntimeException("任务不在运行状态");
}
} }
/** /**
* 获取点播地址 * 获取点播地址
*/ */
public Object getVideoOnDemandAddress(Task task) { public Object getAnalyzeStream(String taskUnid) {
return null; VaServerInfo vaServerInfo = taskService.taskRunOn(taskUnid);
if (vaServerInfo != null) {
return vaServerHttpService.getAnalyzeStream(taskUnid, vaServerInfo);
} else {
throw new RuntimeException("任务不在运行状态");
}
} }
/** /**
* 输出分析流 * 输出分析流
*/ */
public void outputAnalysisStream(Task task) { public Object startAnalyzeStream(String taskUnid) {
VaServerInfo vaServerInfo = taskService.taskRunOn(taskUnid);
if (vaServerInfo != null) {
return vaServerHttpService.startAnalyzeStream(taskUnid, vaServerInfo);
} else {
throw new RuntimeException("任务不在运行状态");
}
} }
...@@ -143,9 +158,25 @@ public class VAServerService { ...@@ -143,9 +158,25 @@ public class VAServerService {
/** /**
* 获取 VAServer 运行状态配置参数等 * 获取 VAServer 运行状态配置参数等
*/ */
public Object getVAServerStatus(String devId) { public Object getStatus(String devId) {
VaServerInfo vaServerInfo = getVaServerInfoByDevId(devId);
if (vaServerInfo != null) {
return vaServerHttpService.status(vaServerInfo);
} else {
throw new RuntimeException("任务不在运行状态");
}
}
return null; /**
* 场景切换
*/
public Object switchScene(String taskUnid, String sceneId) {
VaServerInfo vaServerInfo = taskService.taskRunOn(taskUnid);
if (vaServerInfo != null) {
return vaServerHttpService.switchScene(taskUnid, vaServerInfo, sceneId);
} else {
throw new RuntimeException("任务不在运行状态");
}
} }
} }
package com.viontech.fanxing.task.scheduling;
/**
* .
*
* @author 谢明辉
* @date 2021/7/21
*/
public class MainTest {
}
package com.viontech.fanxing.task.scheduling.service;
import com.alibaba.fastjson.JSON;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.StoreConfigVo;
import com.viontech.fanxing.task.scheduling.feign.TaskClient;
import com.viontech.fanxing.task.scheduling.model.TaskData;
import com.viontech.fanxing.task.scheduling.model.vaserver.VaServerInfo;
import com.viontech.keliu.util.DateUtil;
import com.viontech.keliu.util.JsonMessageUtil;
import io.micrometer.core.instrument.Statistic;
import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.builder.ToStringExclude;
import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.redisson.api.RMap;
import org.redisson.api.RScoredSortedSet;
import org.redisson.api.RedissonClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Date;
/**
* .
*
* @author 谢明辉
* @date 2021/7/21
*/
@SpringBootTest
@RunWith(SpringRunner.class)
class VAServerHttpServiceTest {
@Resource
VAServerHttpService vaServerHttpService;
@Resource
private RedissonClient redissonClient;
@Resource
private TaskClient taskClient;
private VaServerInfo vaServerInfo;
private TaskData taskData;
private static final String TASK_UNID = "8af60a07c86d4571b037af3f4ccf681c";
@BeforeEach
public void before() {
RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
this.vaServerInfo = map.get("xxx-xx");
this.taskData = new TaskData();
Task task = new Task();
task.setUnid(TASK_UNID);
this.taskData.setTask(task);
}
@Test
void snapshot() {
vaServerHttpService.snapshot(TASK_UNID, vaServerInfo);
}
@Test
void getAnalyzeStream() {
String analyzeStream = vaServerHttpService.getAnalyzeStream(TASK_UNID, vaServerInfo);
System.out.println(analyzeStream);
}
@Test
void startAnalyzeStream() {
vaServerHttpService.startAnalyzeStream(TASK_UNID, vaServerInfo);
}
@Test
void switchScene() {
vaServerHttpService.switchScene(TASK_UNID, vaServerInfo,"1");
}
@Test
void updateAlternate() {
vaServerHttpService.updateAlternate(TASK_UNID, vaServerInfo);
}
@Test
void getAlternate() {
vaServerHttpService.getAlternate(TASK_UNID, vaServerInfo);
}
@Test
void status() {
vaServerHttpService.status(vaServerInfo);
}
@Test
void storeConfig() {
JsonMessageUtil.JsonMessage<StoreConfig> storeConfigById = taskClient.getStoreConfigById(3L);
System.out.println(JSON.toJSONString(storeConfigById.getData()));
}
@Test
void test() throws ParseException {
RScoredSortedSet<String> set = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET);
RScoredSortedSet<String> set2 = redissonClient.getScoredSortedSet(RedisKeys.SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET);
set.add(DateUtil.parse("yyyy-MM-dd HH:mm:ss", "2021-07-22 16:15:00").getTime(), "tttttttttttttttttt");
set2.add(DateUtil.parse("yyyy-MM-dd HH:mm:ss", "2021-07-22 16:16:00").getTime(), "tttttttttttttttttt");
}
}
\ No newline at end of file \ No newline at end of file
...@@ -64,12 +64,12 @@ CREATE TABLE IF NOT EXISTS s_forward_config( ...@@ -64,12 +64,12 @@ CREATE TABLE IF NOT EXISTS s_forward_config(
-- d_traffic -- d_traffic
CREATE TABLE IF NOT EXISTS d_traffic( CREATE TABLE IF NOT EXISTS d_traffic(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
task_id BIGINT COMMENT '任务id', task_id BIGINT COMMENT '任务id',
event_cate VARCHAR(36), event_cate VARCHAR(36),
event_type VARCHAR(36), event_type VARCHAR(36),
event_dt TIMESTAMP NOT NULL COMMENT '事件时间', event_time TIMESTAMP NOT NULL COMMENT '事件时间',
channel_unid VARCHAR(36) COMMENT '通道unid', channel_unid VARCHAR(36) COMMENT '通道unid',
plate_color VARCHAR(36) COMMENT '车牌颜色', plate_color VARCHAR(36) COMMENT '车牌颜色',
plate_number VARCHAR(36) COMMENT '车牌号码', plate_number VARCHAR(36) COMMENT '车牌号码',
...@@ -87,32 +87,35 @@ CREATE TABLE IF NOT EXISTS d_traffic( ...@@ -87,32 +87,35 @@ CREATE TABLE IF NOT EXISTS d_traffic(
feature_decoration SMALLINT DEFAULT 0 COMMENT '摆件', feature_decoration SMALLINT DEFAULT 0 COMMENT '摆件',
feature_sun_shield SMALLINT DEFAULT 0 COMMENT '遮阳板', feature_sun_shield SMALLINT DEFAULT 0 COMMENT '遮阳板',
xcycle_type VARCHAR(36) COMMENT '非机动车类型', xcycle_type VARCHAR(36) COMMENT '非机动车类型',
event_id VARCHAR(36) COMMENT '事件唯一id' , event_id VARCHAR(64) COMMENT '事件唯一id' ,
special_type VARCHAR(36), special_type VARCHAR(36),
with_helmet INT COMMENT '是否戴头盔0不带', with_helmet INT COMMENT '是否戴头盔0不带',
json_data TEXT COMMENT '原始数据', json_data TEXT COMMENT '原始数据',
pic_name VARCHAR(256), pics VARCHAR(2048),
video_name VARCHAR(256), video_name VARCHAR(256),
status INT NOT NULL DEFAULT 0 COMMENT '状态' status INT NOT NULL DEFAULT 0 COMMENT '状态',
PRIMARY KEY(id,event_time)
); );
-- d_traffic_face -- d_traffic_face
CREATE TABLE IF NOT EXISTS d_traffic_face( CREATE TABLE IF NOT EXISTS d_traffic_face(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
traffic_id BIGINT NOT NULL COMMENT 'trafficId', traffic_id BIGINT NOT NULL COMMENT 'trafficId',
event_time TIMESTAMP NOT NULL COMMENT '事件时间',
state SMALLINT NOT NULL DEFAULT 1, state SMALLINT NOT NULL DEFAULT 1,
sex SMALLINT NOT NULL DEFAULT 0, sex SMALLINT NOT NULL DEFAULT 0,
upper_color VARCHAR(36), upper_color VARCHAR(36),
lower_color VARCHAR(36), lower_color VARCHAR(36),
INDEX s_task_name(traffic_id) INDEX s_task_name(traffic_id),
PRIMARY KEY(id,event_time)
); );
-- d_flow_data -- d_flow_data
CREATE TABLE IF NOT EXISTS d_flow_data( CREATE TABLE IF NOT EXISTS d_flow_data(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
flow_event_id BIGINT COMMENT 'eventId', flow_event_id BIGINT COMMENT 'eventId',
task_id BIGINT, task_id BIGINT,
...@@ -137,48 +140,48 @@ CREATE TABLE IF NOT EXISTS d_flow_data( ...@@ -137,48 +140,48 @@ CREATE TABLE IF NOT EXISTS d_flow_data(
event_time TIMESTAMP, event_time TIMESTAMP,
dist_time FLOAT, dist_time FLOAT,
time_occupy FLOAT, time_occupy FLOAT,
status INT NOT NULL DEFAULT 0 COMMENT '状态' status INT NOT NULL DEFAULT 0 COMMENT '状态',
PRIMARY KEY(id,event_time)
); );
-- d_flow_event -- d_flow_event
CREATE TABLE IF NOT EXISTS d_flow_event( CREATE TABLE IF NOT EXISTS d_flow_event(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
task_id BIGINT COMMENT '任务id', task_id BIGINT COMMENT '任务id',
event_type VARCHAR(36), event_type VARCHAR(36),
event_time TIMESTAMP COMMENT '事件时间', event_time TIMESTAMP COMMENT '事件时间',
event_id VARCHAR(36) COMMENT '事件唯一id', event_id VARCHAR(64) COMMENT '事件唯一id',
device_code VARCHAR(36), device_code VARCHAR(36),
device_name VARCHAR(64), device_name VARCHAR(64),
location_code VARCHAR(36), location_code VARCHAR(36),
location_name VARCHAR(64), location_name VARCHAR(64),
json_data TEXT, json_data TEXT,
pic_name VARCHAR(256), pics VARCHAR(2048),
video_name VARCHAR(256) video_name VARCHAR(256),
PRIMARY KEY(id,event_time)
); );
-- d_behavior -- d_behavior
CREATE TABLE IF NOT EXISTS d_behavior( CREATE TABLE IF NOT EXISTS d_behavior(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
task_id BIGINT, task_id BIGINT,
event_type VARCHAR(36), event_type VARCHAR(36),
event_cate VARCHAR(36), event_cate VARCHAR(36),
event_refid VARCHAR(36), event_refid VARCHAR(64),
event_time TIMESTAMP, event_time TIMESTAMP,
aux_dev_info TEXT,
event_data TEXT, event_data TEXT,
pics TEXT, pics VARCHAR(2048),
video TEXT, video TEXT,
channel_unid VARCHAR(36), channel_unid VARCHAR(36),
test_pic_file VARCHAR(256),
test_frame_no VARCHAR(256),
task_name VARCHAR(128), task_name VARCHAR(128),
event_data_num VARCHAR(36) event_data_num VARCHAR(36),
PRIMARY KEY(id,event_time)
); );
-- s_dict_cate -- s_dict_cate
...@@ -204,4 +207,116 @@ CREATE TABLE IF NOT EXISTS s_dict_code( ...@@ -204,4 +207,116 @@ CREATE TABLE IF NOT EXISTS s_dict_code(
name VARCHAR(36) NOT NULL COMMENT 'code名称', name VARCHAR(36) NOT NULL COMMENT 'code名称',
note VARCHAR(36) COMMENT '注释', note VARCHAR(36) COMMENT '注释',
INDEX s_dict_code(cate_id) INDEX s_dict_code(cate_id)
);
\ No newline at end of file \ No newline at end of file
);
-- s_channel
CREATE TABLE IF NOT EXISTS s_channel(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
channel_unid VARCHAR(64) NOT NULL,
device_unid VARCHAR(64) NOT NULL,
type INT NOT NULL default 0,
stream_type INT,
stream_path VARCHAR(1024),
username VARCHAR(36),
password VARCHAR(64),
address_unid VARCHAR(36),
name VARCHAR(128),
ip VARCHAR(36),
port INT,
expand VARCHAR(128),
longitude FLOAT,
latitude FLOAT,
status INT NOT NULL DEFAULT 0,
INDEX s_channel(channel_unid)
);
-- 分表
alter TABLE d_traffic PARTITION by RANGE(UNIX_TIMESTAMP(event_time))(
PARTITION d_traffic20210701 VALUES less than (UNIX_TIMESTAMP('2021-07-02'))
);
alter TABLE d_traffic_face PARTITION by RANGE(UNIX_TIMESTAMP(event_time))(
PARTITION d_traffic_face20210701 VALUES less than (UNIX_TIMESTAMP('2021-07-02'))
);
alter TABLE d_flow_event PARTITION by RANGE(UNIX_TIMESTAMP(event_time))(
PARTITION d_flow_event20210701 VALUES less than (UNIX_TIMESTAMP('2021-07-02'))
);
alter TABLE d_flow_data PARTITION by RANGE(UNIX_TIMESTAMP(event_time))(
PARTITION d_flow_data20210701 VALUES less than (UNIX_TIMESTAMP('2021-07-02'))
);
alter TABLE d_behavior PARTITION by RANGE(UNIX_TIMESTAMP(event_time))(
PARTITION d_behavior20210701 VALUES less than (UNIX_TIMESTAMP('2021-07-02'))
);
delimiter $$
DROP PROCEDURE IF EXISTS timestamp_partition
$$
CREATE PROCEDURE timestamp_partition(v_table_name VARCHAR(128),v_schema VARCHAR(128))
BEGIN
DECLARE v_sysdate date; # 声明 当前时间
DECLARE v_mindate date; # 声明 目前分区的最小值
DECLARE v_maxdate date; # 声明 目前分区值中的最大值
DECLARE v_pt varchar(20); # 声明 分区名称 数字部分
DECLARE v_maxval varchar(20); # 声明 最大值
DECLARE i int; # 声明 ??
-- 增加新分区
SELECT max(CAST(FROM_UNIXTIME(partition_description) as date)) AS val
INTO v_maxdate
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = v_table_name AND TABLE_SCHEMA = v_schema;
set v_sysdate = sysdate(); # 赋值v_sysdate为当前时间
-- INTERVAL 时间计算的关键字
WHILE v_maxdate <= (v_sysdate + INTERVAL 7 DAY) DO
SET v_pt = date_format(v_maxdate ,'%Y%m%d');
SET v_maxval = date_format(v_maxdate + INTERVAL 1 DAY, '%Y-%m-%d');
SET @sql = concat('alter table ',v_table_name,' add partition (partition ',v_table_name, v_pt, ' values less than(UNIX_TIMESTAMP(''', v_maxval , ''')))');
PREPARE stmt FROM @sql;
EXECUTE stmt;
-- 删除预处理
DEALLOCATE PREPARE stmt;
SET v_maxdate = v_maxdate + INTERVAL 1 DAY; # 最大值 加一操作
END WHILE;
-- 删除旧分区
SELECT min(CAST(FROM_UNIXTIME(partition_description) as date)) AS val
INTO v_mindate
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = v_table_name AND TABLE_SCHEMA = v_schema;
-- 删除7天前的旧分区
WHILE v_mindate <= (v_sysdate - INTERVAL 7 DAY) DO
SET v_pt = date_format(v_mindate - INTERVAL 1 DAY,'%Y%m%d');
SET @sql = concat('alter table ',v_table_name,' drop partition ',v_table_name, v_pt);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET v_mindate = v_mindate + INTERVAL 1 DAY;
END WHILE;
END$$
delimiter ;
-- 创建定时任务
delimiter $$
drop event if exists auto_pt $$
create event auto_pt
on schedule
every 1 day
do
BEGIN
call timestamp_partition('d_traffic','{schema}');
call timestamp_partition('d_behavior','{schema}');
call timestamp_partition('d_flow_event','{schema}');
call timestamp_partition('d_flow_data','{schema}');
call timestamp_partition('d_traffic_face','{schema}');
END$$
delimiter ;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!