Commit d9f6a1f8 by xmh

修改

1 parent d0a7414b
Showing 42 changed files with 804 additions and 512 deletions
......@@ -26,10 +26,10 @@ spring:
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
......@@ -9,18 +9,34 @@ package com.viontech.fanxing.commons.constant;
public class RedisKeys {
/** 将要被执行的任务的 unid 有序集合,执行时间作为分数 */
public static final String SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET = "scheduling:toBeExecutedTaskUnidSet";
/** 将要被终止的任务的 unid 有序集合,执行时间作为分数 */
public static final String SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET = "scheduling:toBeTerminatedTaskUnidSet";
/** 用来存储 TaskData 的 map, taskUnid 作为 key, taskData 作为 value */
public static final String SCHEDULING_TASK_DATA_MAP = "scheduling:taskDataMap";
/** 用来存储 VaServerInfo 的 map, devId 作为 key, vaServerInfo 作为 value */
public static final String SCHEDULING_VASERVER_MAP = "scheduling:vaServerMap";
/** 用来关联任务和 vaServer 的 map, 表示任务在哪个vaServer上运行, taskUnid 作为 key, devId 作为 value */
public static final String SCHEDULING_TASK_VASERVER_MAP = "scheduling:taskVAServerMap";
/** 用来接收 traffic 数据的队列 */
public static final String FORWARD_TRAFFIC_QUEUE = "forward:trafficQueue";
/** 用来接收 flow 数据的队列 */
public static final String FORWARD_FLOW_QUEUE = "forward:flowQueue";
/** 用来接收 behavior 数据的队列 */
public static final String FORWARD_BEHAVIOR_QUEUE = "forward:behaviorQueue";
/** 用来接收所有数据的队列,用于转发 */
public static final String FORWARD_FORWARD_QUEUE = "forward:forwardQueue";
/**
* 用来获取 vaServer 的心跳在 redis 中对应的 key
*
* @param devId vaServer 的 devId
*
* @return redis 中的 key
*/
public static String getVAServerKeepAliveKey(String devId) {
return devId == null ? "scheduling:keepalive" : "scheduling:keepalive" + ":" + devId;
}
......
......@@ -18,6 +18,8 @@ public class Behavior extends BaseModel {
private Date eventTime;
private String pics;
private String channelUnid;
private String testPicFile;
......@@ -32,8 +34,6 @@ public class Behavior extends BaseModel {
private String eventData;
private String pics;
private String video;
public Long getId() {
......@@ -92,6 +92,14 @@ public class Behavior extends BaseModel {
this.eventTime = eventTime;
}
public String getPics() {
return pics;
}
public void setPics(String pics) {
this.pics = pics == null ? null : pics.trim();
}
public String getChannelUnid() {
return channelUnid;
}
......@@ -148,14 +156,6 @@ public class Behavior extends BaseModel {
this.eventData = eventData == null ? null : eventData.trim();
}
public String getPics() {
return pics;
}
public void setPics(String pics) {
this.pics = pics == null ? null : pics.trim();
}
public String getVideo() {
return video;
}
......
......@@ -549,6 +549,76 @@ public class BehaviorExample extends BaseExample {
return (Criteria) this;
}
public Criteria andPicsIsNull() {
addCriterion("`behavior`.pics is null");
return (Criteria) this;
}
public Criteria andPicsIsNotNull() {
addCriterion("`behavior`.pics is not null");
return (Criteria) this;
}
public Criteria andPicsEqualTo(String value) {
addCriterion("`behavior`.pics =", value, "pics");
return (Criteria) this;
}
public Criteria andPicsNotEqualTo(String value) {
addCriterion("`behavior`.pics <>", value, "pics");
return (Criteria) this;
}
public Criteria andPicsGreaterThan(String value) {
addCriterion("`behavior`.pics >", value, "pics");
return (Criteria) this;
}
public Criteria andPicsGreaterThanOrEqualTo(String value) {
addCriterion("`behavior`.pics >=", value, "pics");
return (Criteria) this;
}
public Criteria andPicsLessThan(String value) {
addCriterion("`behavior`.pics <", value, "pics");
return (Criteria) this;
}
public Criteria andPicsLessThanOrEqualTo(String value) {
addCriterion("`behavior`.pics <=", value, "pics");
return (Criteria) this;
}
public Criteria andPicsLike(String value) {
addCriterion("`behavior`.pics like", value, "pics");
return (Criteria) this;
}
public Criteria andPicsNotLike(String value) {
addCriterion("`behavior`.pics not like", value, "pics");
return (Criteria) this;
}
public Criteria andPicsIn(List<String> values) {
addCriterion("`behavior`.pics in", values, "pics");
return (Criteria) this;
}
public Criteria andPicsNotIn(List<String> values) {
addCriterion("`behavior`.pics not in", values, "pics");
return (Criteria) this;
}
public Criteria andPicsBetween(String value1, String value2) {
addCriterion("`behavior`.pics between", value1, value2, "pics");
return (Criteria) this;
}
public Criteria andPicsNotBetween(String value1, String value2) {
addCriterion("`behavior`.pics not between", value1, value2, "pics");
return (Criteria) this;
}
public Criteria andChannelUnidIsNull() {
addCriterion("`behavior`.channel_unid is null");
return (Criteria) this;
......@@ -941,6 +1011,11 @@ public class BehaviorExample extends BaseExample {
return (ColumnContainer) this;
}
public ColumnContainer hasPicsColumn() {
addColumnStr("`behavior`.pics as behavior_pics ");
return (ColumnContainer) this;
}
public ColumnContainer hasChannelUnidColumn() {
addColumnStr("`behavior`.channel_unid as behavior_channel_unid ");
return (ColumnContainer) this;
......
......@@ -24,7 +24,7 @@ public class FlowEvent extends BaseModel {
private String locationName;
private String picName;
private String pics;
private String videoName;
......@@ -110,12 +110,12 @@ public class FlowEvent extends BaseModel {
this.locationName = locationName == null ? null : locationName.trim();
}
public String getPicName() {
return picName;
public String getPics() {
return pics;
}
public void setPicName(String picName) {
this.picName = picName == null ? null : picName.trim();
public void setPics(String pics) {
this.pics = pics == null ? null : pics.trim();
}
public String getVideoName() {
......
......@@ -759,73 +759,73 @@ public class FlowEventExample extends BaseExample {
return (Criteria) this;
}
public Criteria andPicNameIsNull() {
addCriterion("`flowEvent`.pic_name is null");
public Criteria andPicsIsNull() {
addCriterion("`flowEvent`.pics is null");
return (Criteria) this;
}
public Criteria andPicNameIsNotNull() {
addCriterion("`flowEvent`.pic_name is not null");
public Criteria andPicsIsNotNull() {
addCriterion("`flowEvent`.pics is not null");
return (Criteria) this;
}
public Criteria andPicNameEqualTo(String value) {
addCriterion("`flowEvent`.pic_name =", value, "picName");
public Criteria andPicsEqualTo(String value) {
addCriterion("`flowEvent`.pics =", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotEqualTo(String value) {
addCriterion("`flowEvent`.pic_name <>", value, "picName");
public Criteria andPicsNotEqualTo(String value) {
addCriterion("`flowEvent`.pics <>", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameGreaterThan(String value) {
addCriterion("`flowEvent`.pic_name >", value, "picName");
public Criteria andPicsGreaterThan(String value) {
addCriterion("`flowEvent`.pics >", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameGreaterThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pic_name >=", value, "picName");
public Criteria andPicsGreaterThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pics >=", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLessThan(String value) {
addCriterion("`flowEvent`.pic_name <", value, "picName");
public Criteria andPicsLessThan(String value) {
addCriterion("`flowEvent`.pics <", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLessThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pic_name <=", value, "picName");
public Criteria andPicsLessThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pics <=", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLike(String value) {
addCriterion("`flowEvent`.pic_name like", value, "picName");
public Criteria andPicsLike(String value) {
addCriterion("`flowEvent`.pics like", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotLike(String value) {
addCriterion("`flowEvent`.pic_name not like", value, "picName");
public Criteria andPicsNotLike(String value) {
addCriterion("`flowEvent`.pics not like", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameIn(List<String> values) {
addCriterion("`flowEvent`.pic_name in", values, "picName");
public Criteria andPicsIn(List<String> values) {
addCriterion("`flowEvent`.pics in", values, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotIn(List<String> values) {
addCriterion("`flowEvent`.pic_name not in", values, "picName");
public Criteria andPicsNotIn(List<String> values) {
addCriterion("`flowEvent`.pics not in", values, "pics");
return (Criteria) this;
}
public Criteria andPicNameBetween(String value1, String value2) {
addCriterion("`flowEvent`.pic_name between", value1, value2, "picName");
public Criteria andPicsBetween(String value1, String value2) {
addCriterion("`flowEvent`.pics between", value1, value2, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotBetween(String value1, String value2) {
addCriterion("`flowEvent`.pic_name not between", value1, value2, "picName");
public Criteria andPicsNotBetween(String value1, String value2) {
addCriterion("`flowEvent`.pics not between", value1, value2, "pics");
return (Criteria) this;
}
......@@ -956,8 +956,8 @@ public class FlowEventExample extends BaseExample {
return (ColumnContainer) this;
}
public ColumnContainer hasPicNameColumn() {
addColumnStr("`flowEvent`.pic_name as flowEvent_pic_name ");
public ColumnContainer hasPicsColumn() {
addColumnStr("`flowEvent`.pics as flowEvent_pics ");
return (ColumnContainer) this;
}
......
......@@ -56,7 +56,7 @@ public class Traffic extends BaseModel {
private Integer withHelmet;
private String picName;
private String pics;
private String videoName;
......@@ -272,12 +272,12 @@ public class Traffic extends BaseModel {
this.withHelmet = withHelmet;
}
public String getPicName() {
return picName;
public String getPics() {
return pics;
}
public void setPicName(String picName) {
this.picName = picName == null ? null : picName.trim();
public void setPics(String pics) {
this.pics = pics == null ? null : pics.trim();
}
public String getVideoName() {
......
......@@ -1819,73 +1819,73 @@ public class TrafficExample extends BaseExample {
return (Criteria) this;
}
public Criteria andPicNameIsNull() {
addCriterion("`traffic`.pic_name is null");
public Criteria andPicsIsNull() {
addCriterion("`traffic`.pics is null");
return (Criteria) this;
}
public Criteria andPicNameIsNotNull() {
addCriterion("`traffic`.pic_name is not null");
public Criteria andPicsIsNotNull() {
addCriterion("`traffic`.pics is not null");
return (Criteria) this;
}
public Criteria andPicNameEqualTo(String value) {
addCriterion("`traffic`.pic_name =", value, "picName");
public Criteria andPicsEqualTo(String value) {
addCriterion("`traffic`.pics =", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotEqualTo(String value) {
addCriterion("`traffic`.pic_name <>", value, "picName");
public Criteria andPicsNotEqualTo(String value) {
addCriterion("`traffic`.pics <>", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameGreaterThan(String value) {
addCriterion("`traffic`.pic_name >", value, "picName");
public Criteria andPicsGreaterThan(String value) {
addCriterion("`traffic`.pics >", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameGreaterThanOrEqualTo(String value) {
addCriterion("`traffic`.pic_name >=", value, "picName");
public Criteria andPicsGreaterThanOrEqualTo(String value) {
addCriterion("`traffic`.pics >=", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLessThan(String value) {
addCriterion("`traffic`.pic_name <", value, "picName");
public Criteria andPicsLessThan(String value) {
addCriterion("`traffic`.pics <", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLessThanOrEqualTo(String value) {
addCriterion("`traffic`.pic_name <=", value, "picName");
public Criteria andPicsLessThanOrEqualTo(String value) {
addCriterion("`traffic`.pics <=", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameLike(String value) {
addCriterion("`traffic`.pic_name like", value, "picName");
public Criteria andPicsLike(String value) {
addCriterion("`traffic`.pics like", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotLike(String value) {
addCriterion("`traffic`.pic_name not like", value, "picName");
public Criteria andPicsNotLike(String value) {
addCriterion("`traffic`.pics not like", value, "pics");
return (Criteria) this;
}
public Criteria andPicNameIn(List<String> values) {
addCriterion("`traffic`.pic_name in", values, "picName");
public Criteria andPicsIn(List<String> values) {
addCriterion("`traffic`.pics in", values, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotIn(List<String> values) {
addCriterion("`traffic`.pic_name not in", values, "picName");
public Criteria andPicsNotIn(List<String> values) {
addCriterion("`traffic`.pics not in", values, "pics");
return (Criteria) this;
}
public Criteria andPicNameBetween(String value1, String value2) {
addCriterion("`traffic`.pic_name between", value1, value2, "picName");
public Criteria andPicsBetween(String value1, String value2) {
addCriterion("`traffic`.pics between", value1, value2, "pics");
return (Criteria) this;
}
public Criteria andPicNameNotBetween(String value1, String value2) {
addCriterion("`traffic`.pic_name not between", value1, value2, "picName");
public Criteria andPicsNotBetween(String value1, String value2) {
addCriterion("`traffic`.pics not between", value1, value2, "pics");
return (Criteria) this;
}
......@@ -2156,8 +2156,8 @@ public class TrafficExample extends BaseExample {
return (ColumnContainer) this;
}
public ColumnContainer hasPicNameColumn() {
addColumnStr("`traffic`.pic_name as traffic_pic_name ");
public ColumnContainer hasPicsColumn() {
addColumnStr("`traffic`.pics as traffic_pics ");
return (ColumnContainer) this;
}
......
......@@ -94,6 +94,15 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private Date eventTime_lte;
@JsonIgnore
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> pics_arr;
@JsonIgnore
private String pics_like;
@JsonIgnore
private Boolean channelUnid_null;
@JsonIgnore
......@@ -157,15 +166,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private String eventData_like;
@JsonIgnore
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> pics_arr;
@JsonIgnore
private String pics_like;
@JsonIgnore
private Boolean video_null;
@JsonIgnore
......@@ -516,6 +516,44 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventTime(eventTime);
}
public Boolean getPics_null() {
return pics_null;
}
public void setPics_null(Boolean pics_null) {
this.pics_null = pics_null;
}
public ArrayList<String> getPics_arr() {
return pics_arr;
}
public void setPics_arr(ArrayList<String> pics_arr) {
this.pics_arr = pics_arr;
}
public String getPics_like() {
return pics_like;
}
public void setPics_like(String pics_like) {
this.pics_like = pics_like;
}
public String getPics() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getPics();
}
public void setPics(String pics) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setPics(pics);
}
public Boolean getChannelUnid_null() {
return channelUnid_null;
}
......@@ -782,44 +820,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventData(eventData);
}
public Boolean getPics_null() {
return pics_null;
}
public void setPics_null(Boolean pics_null) {
this.pics_null = pics_null;
}
public ArrayList<String> getPics_arr() {
return pics_arr;
}
public void setPics_arr(ArrayList<String> pics_arr) {
this.pics_arr = pics_arr;
}
public String getPics_like() {
return pics_like;
}
public void setPics_like(String pics_like) {
this.pics_like = pics_like;
}
public String getPics() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getPics();
}
public void setPics(String pics) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setPics(pics);
}
public Boolean getVideo_null() {
return video_null;
}
......
......@@ -121,13 +121,13 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
private String locationName_like;
@JsonIgnore
private Boolean picName_null;
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> picName_arr;
private ArrayList<String> pics_arr;
@JsonIgnore
private String picName_like;
private String pics_like;
@JsonIgnore
private Boolean videoName_null;
......@@ -603,42 +603,42 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
this.getModel().setLocationName(locationName);
}
public Boolean getPicName_null() {
return picName_null;
public Boolean getPics_null() {
return pics_null;
}
public void setPicName_null(Boolean picName_null) {
this.picName_null = picName_null;
public void setPics_null(Boolean pics_null) {
this.pics_null = pics_null;
}
public ArrayList<String> getPicName_arr() {
return picName_arr;
public ArrayList<String> getPics_arr() {
return pics_arr;
}
public void setPicName_arr(ArrayList<String> picName_arr) {
this.picName_arr = picName_arr;
public void setPics_arr(ArrayList<String> pics_arr) {
this.pics_arr = pics_arr;
}
public String getPicName_like() {
return picName_like;
public String getPics_like() {
return pics_like;
}
public void setPicName_like(String picName_like) {
this.picName_like = picName_like;
public void setPics_like(String pics_like) {
this.pics_like = pics_like;
}
public String getPicName() {
public String getPics() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getPicName();
return this.getModel().getPics();
}
public void setPicName(String picName) {
public void setPics(String pics) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setPicName(picName);
this.getModel().setPics(pics);
}
public Boolean getVideoName_null() {
......
......@@ -316,13 +316,13 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
private Integer withHelmet_lte;
@JsonIgnore
private Boolean picName_null;
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> picName_arr;
private ArrayList<String> pics_arr;
@JsonIgnore
private String picName_like;
private String pics_like;
@JsonIgnore
private Boolean videoName_null;
......@@ -1557,42 +1557,42 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
this.getModel().setWithHelmet(withHelmet);
}
public Boolean getPicName_null() {
return picName_null;
public Boolean getPics_null() {
return pics_null;
}
public void setPicName_null(Boolean picName_null) {
this.picName_null = picName_null;
public void setPics_null(Boolean pics_null) {
this.pics_null = pics_null;
}
public ArrayList<String> getPicName_arr() {
return picName_arr;
public ArrayList<String> getPics_arr() {
return pics_arr;
}
public void setPicName_arr(ArrayList<String> picName_arr) {
this.picName_arr = picName_arr;
public void setPics_arr(ArrayList<String> pics_arr) {
this.pics_arr = pics_arr;
}
public String getPicName_like() {
return picName_like;
public String getPics_like() {
return pics_like;
}
public void setPicName_like(String picName_like) {
this.picName_like = picName_like;
public void setPics_like(String pics_like) {
this.pics_like = pics_like;
}
public String getPicName() {
public String getPics() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getPicName();
return this.getModel().getPics();
}
public void setPicName(String picName) {
public void setPics(String pics) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setPicName(picName);
this.getModel().setPics(pics);
}
public Boolean getVideoName_null() {
......
......@@ -7,15 +7,15 @@ singleServerConfig:
timeout: 3000
retryAttempts: 3
retryInterval: 1500
password: vionredis
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
subscriptionsPerConnection: 5
clientName: null
address: "redis://127.0.0.1:6379"
address: "redis://192.168.9.233:6379"
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 32
connectionPoolSize: 64
database: 2
database: 15
dnsMonitoringInterval: 5000
# 集群配置
#clusterServersConfig:
......
......@@ -33,6 +33,8 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public class ForwardApp {
public static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(50, 50, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(5000), new ThreadPoolExecutor.CallerRunsPolicy());
public static void main(String[] args) {
try {
SpringApplication.run(ForwardApp.class, args);
......@@ -41,8 +43,6 @@ public class ForwardApp {
}
}
public static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(50, 50, 1, TimeUnit.MINUTES, new LinkedBlockingDeque<>(5000), new ThreadPoolExecutor.CallerRunsPolicy());
@Bean
public TaskExecutor taskExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
......
package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.model.Behavior;
......@@ -8,6 +7,8 @@ import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener
import com.viontech.fanxing.forward.batch.listener.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener;
import com.viontech.fanxing.forward.batch.processor.BehaviorProcessor;
import com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor;
import com.viontech.fanxing.forward.batch.processor.PicProcessor;
import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
import lombok.extern.slf4j.Slf4j;
......@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.*;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport;
......@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.util.LinkedList;
/**
* .
......@@ -58,7 +58,7 @@ public class BehaviorJobConfiguration {
}
@Bean(name = "behaviorStep")
public Step behaviorStep(ItemReader<JSONObject> behaviorReader, ItemWriter<Behavior> behaviorWriter, BehaviorProcessor behaviorProcessor) {
public Step behaviorStep(ItemReader<JSONObject> behaviorReader, ItemWriter<Behavior> behaviorWriter, ItemProcessor<JSONObject, Behavior> behaviorProcessorCompose) {
RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override
......@@ -76,13 +76,14 @@ public class BehaviorJobConfiguration {
.listener(new ExecutionContextClearListener())
.<JSONObject, Behavior>chunk(1)
.reader(behaviorReader)
.processor(behaviorProcessor)
.processor(behaviorProcessorCompose)
.writer(behaviorWriter)
.stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener())
.build();
}
@Bean(name = "behaviorReader")
public ItemReader<JSONObject> behaviorReader(RedissonClient redissonClient, @Value("${spring.cloud.consul.discovery.instance-id}") String instanceId) {
return new ConcurrencyReader<JSONObject>() {
......@@ -97,4 +98,16 @@ public class BehaviorJobConfiguration {
}
};
}
@Bean(name = "behaviorProcessorCompose")
public ItemProcessor<JSONObject, Behavior> behaviorProcessorCompose(BehaviorProcessor behaviorProcessor, PicProcessor picProcessor) {
LinkedList delegates = new LinkedList<>();
delegates.add(picProcessor);
delegates.add(behaviorProcessor);
CompositeItemStreamProcessor<JSONObject, Behavior> item = new CompositeItemStreamProcessor<>();
item.setDelegates(delegates);
return item;
}
}
package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
......@@ -15,9 +14,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
......@@ -30,8 +31,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
/**
* .
*
......@@ -92,27 +91,10 @@ public class ForwardJobConfiguration {
RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>();
redisPopReader.setRedissonClient(redissonClient);
redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH);
redisPopReader.setKey(RedisKeys.FORWARD_BEHAVIOR_QUEUE);
redisPopReader.setKey(RedisKeys.FORWARD_FORWARD_QUEUE);
redisPopReader.setInstanceId(instanceId);
return redisPopReader;
}
};
}
@Bean(name = "forwardWriter")
public ItemWriter<ForwardContent> forwardWriter(DataSource dataSource) {
return list -> {
for (ForwardContent item : list) {
log.info(JSON.toJSONString(item));
}
};
// JdbcBatchItemWriter<ForwardData> writer = new JdbcBatchItemWriter<>();
// writer.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>());
// String sql = "";
// writer.setSql(sql);
// writer.setDataSource(dataSource);
// return writer;
}
}
package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
import com.viontech.fanxing.forward.batch.listener.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener;
import com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor;
import com.viontech.fanxing.forward.batch.processor.PicProcessor;
import com.viontech.fanxing.forward.batch.processor.TrafficFlowProcessor;
import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
......@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.*;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport;
......@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.util.LinkedList;
/**
* .
......@@ -58,7 +58,7 @@ public class TrafficFlowJobConfiguration {
}
@Bean(name = "trafficFlowStep")
public Step trafficFlowStep(ItemReader<JSONObject> trafficFlowReader, ItemWriter<TrafficFlowContent> trafficFlowWriter, TrafficFlowProcessor trafficFlowProcessor) {
public Step trafficFlowStep(ItemReader<JSONObject> trafficFlowReader, ItemWriter<TrafficFlowContent> trafficFlowWriter, ItemProcessor<JSONObject, TrafficFlowContent> trafficFlowProcessorCompose) {
RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override
......@@ -76,7 +76,7 @@ public class TrafficFlowJobConfiguration {
.listener(new ExecutionContextClearListener())
.<JSONObject, TrafficFlowContent>chunk(1)
.reader(trafficFlowReader)
.processor(trafficFlowProcessor)
.processor(trafficFlowProcessorCompose)
.writer(trafficFlowWriter)
.stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener())
......@@ -91,10 +91,22 @@ public class TrafficFlowJobConfiguration {
RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>();
redisPopReader.setRedissonClient(redissonClient);
redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH);
redisPopReader.setKey(RedisKeys.FORWARD_BEHAVIOR_QUEUE);
redisPopReader.setKey(RedisKeys.FORWARD_FLOW_QUEUE);
redisPopReader.setInstanceId(instanceId);
return redisPopReader;
}
};
}
@Bean(name = "trafficFlowProcessorCompose")
public ItemProcessor<JSONObject, TrafficFlowContent> trafficFlowProcessorCompose(TrafficFlowProcessor trafficFlowProcessor, PicProcessor picProcessor) {
LinkedList delegates = new LinkedList<>();
delegates.add(picProcessor);
delegates.add(trafficFlowProcessor);
CompositeItemStreamProcessor<JSONObject, TrafficFlowContent> item = new CompositeItemStreamProcessor<>();
item.setDelegates(delegates);
return item;
}
}
package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
import com.viontech.fanxing.forward.batch.listener.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener;
import com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor;
import com.viontech.fanxing.forward.batch.processor.PicProcessor;
import com.viontech.fanxing.forward.batch.processor.TrafficProcessor;
import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
......@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.JobScope;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.*;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport;
......@@ -30,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.LinkedList;
/**
* .
*
......@@ -57,7 +59,7 @@ public class TrafficJobConfiguration {
}
@Bean(name = "trafficStep")
public Step trafficStep(ItemReader<JSONObject> trafficReader, ItemWriter<TrafficContent> trafficWriter, TrafficProcessor trafficProcessor) {
public Step trafficStep(ItemReader<JSONObject> trafficReader, ItemWriter<TrafficContent> trafficWriter, ItemProcessor<JSONObject, TrafficContent> trafficProcessorCompose) {
RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override
......@@ -75,7 +77,7 @@ public class TrafficJobConfiguration {
.listener(new ExecutionContextClearListener())
.<JSONObject, TrafficContent>chunk(1)
.reader(trafficReader)
.processor(trafficProcessor)
.processor(trafficProcessorCompose)
.writer(trafficWriter)
.stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener())
......@@ -96,4 +98,16 @@ public class TrafficJobConfiguration {
}
};
}
@Bean(name = "trafficProcessorCompose")
public ItemProcessor<JSONObject, TrafficContent> trafficFlowProcessorCompose(TrafficProcessor trafficProcessor, PicProcessor picProcessor) {
LinkedList delegates = new LinkedList<>();
delegates.add(picProcessor);
delegates.add(trafficProcessor);
CompositeItemStreamProcessor<JSONObject, TrafficContent> item = new CompositeItemStreamProcessor<>();
item.setDelegates(delegates);
return item;
}
}
......@@ -31,6 +31,8 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
@Override
public Behavior process(JSONObject item) throws Exception {
log.info("收到 behavior 消息 , eventId:{}",item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid);
......@@ -54,6 +56,7 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
JSONArray video = item.getJSONArray("video");
JSONArray pics = item.getJSONArray("pics");
JSONObject auxDevInfo = item.getJSONObject("aux_dev_info");
String picArray = item.getString("pic_path_array");
behavior.setEventType(eventType);
behavior.setEventRefid(eventRefid);
......@@ -61,10 +64,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
behavior.setEventCate(eventCate);
behavior.setChannelUnid(channelUnid);
behavior.setTaskName(taskName);
behavior.setPics(picArray);
behavior.setEventData(eventData == null ? null : eventData.toJSONString());
behavior.setVideo(video == null ? null : video.toJSONString());
behavior.setPics(pics == null ? null : pics.toJSONString());
behavior.setAuxDevInfo(auxDevInfo == null ? null : auxDevInfo.toJSONString());
return behavior;
......
package com.viontech.fanxing.forward.batch.processor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.forward.util.PicUtils;
import com.viontech.keliu.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
/**
* .
*
* @author 谢明辉
* @date 2021/7/19
*/
@Component
@Slf4j
public class PicProcessor implements ItemStream, ItemProcessor<JSONObject, JSONObject> {
@Resource
private PicUtils picUtils;
@Override
public JSONObject process(JSONObject item) throws Exception {
JSONArray pics = item.getJSONArray("pics");
if (pics != null && pics.size() > 0) {
String eventDt = item.getString("event_dt");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
ArrayList<String> picList = new ArrayList<>();
for (int i = 0; i < pics.size(); i++) {
JSONObject picObject = pics.getJSONObject(i);
String base64 = picObject.getString("pic_base64");
String format = picObject.getString("format");
String picUnid = picObject.getString("pic_unid");
picObject.remove("pic_base64");
String path = picUtils.savePicBase64(picUnid, eventTime, format, base64);
picList.add(path);
}
String picPathArray = String.join(",", picList);
item.put("pic_path_array", picPathArray);
}
return item;
}
@Override
public void open(ExecutionContext executionContext) throws ItemStreamException {
}
@Override
public void update(ExecutionContext executionContext) throws ItemStreamException {
}
@Override
public void close() throws ItemStreamException {
}
}
......@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.FlowData;
import com.viontech.fanxing.commons.model.FlowEvent;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.forward.model.TrafficFlowContent;
import com.viontech.fanxing.forward.util.CacheUtils;
import com.viontech.keliu.util.DateUtil;
......@@ -19,7 +18,6 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* .
......@@ -36,6 +34,8 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
@Override
public TrafficFlowContent process(JSONObject item) throws Exception {
log.info("收到 flow 消息 , eventId:{}", item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid);
......@@ -56,11 +56,13 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
String eventType = item.getString("event_type");
String eventRefid = item.getString("event_refid");
String eventDt = item.getString("event_dt");
String picArray = item.getString("pic_path_array");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
flowEvent.setEventType(eventType);
flowEvent.setEventId(eventRefid);
flowEvent.setEventTime(eventTime);
flowEvent.setPics(picArray);
// flowEvent.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data");
......@@ -89,7 +91,7 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
flowDataList.addAll(getFlowData(eventTime, taskId, "xcycle", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "pedestrian", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "density", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "Bus", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "bus", eventData));
}
......
......@@ -2,7 +2,6 @@ package com.viontech.fanxing.forward.batch.processor;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.model.Traffic;
import com.viontech.fanxing.commons.model.TrafficFace;
import com.viontech.fanxing.forward.model.TrafficContent;
......@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
/**
* .
......@@ -36,6 +34,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
@Override
public TrafficContent process(JSONObject item) throws Exception {
log.info("收到 traffic 消息 , eventId:{}", item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
//
// String taskUnid = item.getString("task_id");
......@@ -59,6 +58,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
String eventDt = item.getString("event_dt");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
String channelUnid = item.getString("vchan_refid");
String picArray = item.getString("pic_path_array");
// todo taskId
traffic.setEventCate(eventCate);
......@@ -66,6 +66,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
traffic.setEventId(eventRefid);
traffic.setEventDt(eventTime);
traffic.setChannelUnid(channelUnid);
traffic.setPics(picArray);
// traffic.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data");
......@@ -169,12 +170,12 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
trafficFace.setState(state);
JSONObject upbody = faceData.getJSONObject("upbody");
if (upbody != null) {
String upperColor = upbody.getString("color");
String upperColor = upbody.getString("code");
trafficFace.setUpperColor(upperColor);
}
JSONObject lobody = faceData.getJSONObject("lobody");
if (lobody != null) {
String lowerColor = lobody.getString("color");
String lowerColor = lobody.getString("code");
trafficFace.setLowerColor(lowerColor);
}
trafficFaces.add(trafficFace);
......
......@@ -30,6 +30,5 @@ public class BehaviorWriter implements ItemWriter<Behavior> {
public void write(List<? extends Behavior> items) throws Exception {
SqlParameterSource[] batchParam = SqlParameterSourceUtils.createBatch(items);
namedParameterJdbcTemplate.batchUpdate(INSERT_BEHAVIOR, batchParam);
}
}
......@@ -24,8 +24,8 @@ import java.util.List;
public class TrafficFlowWriter implements ItemWriter<TrafficFlowContent> {
private final static String INSERT_FLOW_EVENT = "insert into d_flow_event (" +
"task_id,event_type,event_time,event_id,device_code,device_name,location_code,location_name,json_data,pic_name,video_name) values(" +
":taskId,:eventType,:eventTime,:eventId,,:deviceCode,:deviceName,:locationCode,:locationName,:jsonData,:picName,:videoName)";
"task_id,event_type,event_time,event_id,device_code,device_name,location_code,location_name,json_data,pics,video_name) values(" +
":taskId,:eventType,:eventTime,:eventId,:deviceCode,:deviceName,:locationCode,:locationName,:jsonData,:pics,:videoName)";
private final static String INSERT_FLOW_DATA = "insert into d_flow_data (" +
"flow_event_id,task_id,detection_type,road_code,direction_code,sample_dura,sample_num,velocity,velocity_unit,occupy,distance,queue_length,region_id,region_name,position_content,head_content,area,density,sample_num_in,sample_num_out,event_time,dist_time,time_occupy) values (" +
":flowEventId,:taskId,:detectionType,:roadCode,:directionCode,:sampleDura,:sampleNum,:velocity,:velocityUnit,:occupy,:distance,:queueLength,:regionId,:regionName,:positionContent,:headContent,:area,:density,:sampleNumIn,:sampleNumOut,:eventTime,:distTime,:timeOccupy)";
......
package com.viontech.fanxing.forward.batch.writer;
import com.viontech.fanxing.commons.model.Traffic;
import com.viontech.fanxing.commons.model.TrafficFace;
import com.viontech.fanxing.forward.model.TrafficContent;
import org.springframework.batch.item.ItemWriter;
......@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* .
......@@ -24,8 +26,8 @@ import java.util.List;
public class TrafficWriter implements ItemWriter<TrafficContent> {
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,pic_name,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,:picName,:videoName)";
"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(" +
":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)";
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)";
......@@ -55,7 +57,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
}
for (TrafficContent item : list) {
List<TrafficFace> trafficFaces = item.getTrafficFaces();
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(item);
Traffic traffic = item.getTraffic();
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(traffic);
SqlParameterSource param = batch[0];
GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();
namedParameterJdbcTemplate.update(INSERT_TRAFFIC, param, generatedKeyHolder);
......@@ -73,7 +76,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
if (list == null || list.size() == 0) {
return;
}
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(list);
List<Traffic> trafficList = list.stream().map(TrafficContent::getTraffic).collect(Collectors.toList());
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(trafficList);
namedParameterJdbcTemplate.batchUpdate(INSERT_TRAFFIC, batch);
}
}
package com.viontech.fanxing.forward.util;
import com.viontech.keliu.util.DateUtil;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.util.Base64;
import java.util.Date;
import java.util.UUID;
/**
* .
*
* @author 谢明辉
* @date 2021/7/19
*/
@Component
public class PicUtils {
@Value("${vion.pic.path:/images}")
private String basePath;
public String savePic(String unid, Date date, String format, byte[] data) throws IOException {
if (unid == null || "".equals(unid)) {
unid = UUID.randomUUID().toString();
}
int i = unid.hashCode();
i ^= (i >>> 16);
i = 15 & i;
String dateStr = DateUtil.format("yyyyMMdd", date);
String path = basePath + File.separator + dateStr + File.separator + i + File.separator + unid + "." + format;
File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
FileUtils.writeByteArrayToFile(file, data);
return path;
}
public String savePicBase64(String unid, Date date, String format, String base64) throws IOException {
byte[] decode = Base64.getDecoder().decode(base64);
return savePic(unid, date, format, decode);
}
}
......@@ -22,14 +22,14 @@ spring:
ip-address: 192.168.9.146
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.9.233:3306/fanxing3
url: jdbc:mysql://192.168.9.233:3306/fanxing3?serverTimezone=Asia/Shanghai
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......@@ -48,6 +48,8 @@ pagehelper:
supportMethodsArguments: true
params: count=countByExample
vion:
pic:
path: G:\data
redisson:
path: F:\myIDEAworkspace\jt\fanxing3\fanxing-commons\src\main\resources\redisson.yml
debug: true
\ No newline at end of file
......@@ -37,10 +37,10 @@ spring:
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
......@@ -26,10 +26,10 @@ spring:
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
package com.viontech.fanxing.query;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
......@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients
@MapperScan(basePackages = "com.viontech.fanxing.query.mapper")
@Slf4j
public class QueryApp {
......
......@@ -4,11 +4,11 @@ import com.viontech.fanxing.commons.base.BaseController;
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.query.mapper.BehaviorMapper;
import com.viontech.fanxing.commons.model.Behavior;
import com.viontech.fanxing.commons.model.BehaviorExample;
import com.viontech.fanxing.query.service.adapter.BehaviorService;
import com.viontech.fanxing.commons.vo.BehaviorVo;
import com.viontech.fanxing.query.mapper.BehaviorMapper;
import com.viontech.fanxing.query.service.adapter.BehaviorService;
import javax.annotation.Resource;
public abstract class BehaviorBaseController extends BaseController<Behavior, BehaviorVo> {
......@@ -144,6 +144,22 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(behaviorVo.getEventTime_lte());
}
if(behaviorVo.getPics() != null) {
criteria.andPicsEqualTo(behaviorVo.getPics());
}
if(behaviorVo.getPics_null() != null) {
if(behaviorVo.getPics_null().booleanValue()) {
criteria.andPicsIsNull();
} else {
criteria.andPicsIsNotNull();
}
}
if(behaviorVo.getPics_arr() != null) {
criteria.andPicsIn(behaviorVo.getPics_arr());
}
if(behaviorVo.getPics_like() != null) {
criteria.andPicsLike(behaviorVo.getPics_like());
}
if(behaviorVo.getChannelUnid() != null) {
criteria.andChannelUnidEqualTo(behaviorVo.getChannelUnid());
}
......@@ -224,7 +240,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getEventDataNum_like() != null) {
criteria.andEventDataNumLike(behaviorVo.getEventDataNum_like());
}
return behaviorExample;
}
......
......@@ -192,21 +192,21 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getLocationName_like() != null) {
criteria.andLocationNameLike(flowEventVo.getLocationName_like());
}
if(flowEventVo.getPicName() != null) {
criteria.andPicNameEqualTo(flowEventVo.getPicName());
if(flowEventVo.getPics() != null) {
criteria.andPicsEqualTo(flowEventVo.getPics());
}
if(flowEventVo.getPicName_null() != null) {
if(flowEventVo.getPicName_null().booleanValue()) {
criteria.andPicNameIsNull();
if(flowEventVo.getPics_null() != null) {
if(flowEventVo.getPics_null().booleanValue()) {
criteria.andPicsIsNull();
} else {
criteria.andPicNameIsNotNull();
criteria.andPicsIsNotNull();
}
}
if(flowEventVo.getPicName_arr() != null) {
criteria.andPicNameIn(flowEventVo.getPicName_arr());
if(flowEventVo.getPics_arr() != null) {
criteria.andPicsIn(flowEventVo.getPics_arr());
}
if(flowEventVo.getPicName_like() != null) {
criteria.andPicNameLike(flowEventVo.getPicName_like());
if(flowEventVo.getPics_like() != null) {
criteria.andPicsLike(flowEventVo.getPics_like());
}
if(flowEventVo.getVideoName() != null) {
criteria.andVideoNameEqualTo(flowEventVo.getVideoName());
......@@ -224,6 +224,7 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getVideoName_like() != null) {
criteria.andVideoNameLike(flowEventVo.getVideoName_like());
}
return flowEventExample;
}
......
......@@ -2,12 +2,13 @@ package com.viontech.fanxing.query.controller.base;
import com.viontech.fanxing.commons.base.BaseController;
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.model.Traffic;
import com.viontech.fanxing.commons.model.TrafficExample;
import com.viontech.fanxing.commons.vo.TrafficVo;
import com.viontech.fanxing.query.mapper.TrafficMapper;
import com.viontech.fanxing.query.service.adapter.TrafficService;
import javax.annotation.Resource;
public abstract class TrafficBaseController extends BaseController<Traffic, TrafficVo> {
......@@ -18,530 +19,530 @@ public abstract class TrafficBaseController extends BaseController<Traffic, Traf
protected BaseExample getExample(TrafficVo trafficVo, int type) {
TrafficExample trafficExample = new TrafficExample();
TrafficExample.Criteria criteria = trafficExample.createCriteria();
if (trafficVo.getId() != null) {
if(trafficVo.getId() != null) {
criteria.andIdEqualTo(trafficVo.getId());
}
if (trafficVo.getId_arr() != null) {
if(trafficVo.getId_arr() != null) {
criteria.andIdIn(trafficVo.getId_arr());
}
if (trafficVo.getId_gt() != null) {
if(trafficVo.getId_gt() != null) {
criteria.andIdGreaterThan(trafficVo.getId_gt());
}
if (trafficVo.getId_lt() != null) {
if(trafficVo.getId_lt() != null) {
criteria.andIdLessThan(trafficVo.getId_lt());
}
if (trafficVo.getId_gte() != null) {
if(trafficVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(trafficVo.getId_gte());
}
if (trafficVo.getId_lte() != null) {
if(trafficVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(trafficVo.getId_lte());
}
if (trafficVo.getUnid() != null) {
if(trafficVo.getUnid() != null) {
criteria.andUnidEqualTo(trafficVo.getUnid());
}
if (trafficVo.getUnid_arr() != null) {
if(trafficVo.getUnid_arr() != null) {
criteria.andUnidIn(trafficVo.getUnid_arr());
}
if (trafficVo.getUnid_like() != null) {
if(trafficVo.getUnid_like() != null) {
criteria.andUnidLike(trafficVo.getUnid_like());
}
if (trafficVo.getTaskId() != null) {
if(trafficVo.getTaskId() != null) {
criteria.andTaskIdEqualTo(trafficVo.getTaskId());
}
if (trafficVo.getTaskId_null() != null) {
if (trafficVo.getTaskId_null().booleanValue()) {
if(trafficVo.getTaskId_null() != null) {
if(trafficVo.getTaskId_null().booleanValue()) {
criteria.andTaskIdIsNull();
} else {
criteria.andTaskIdIsNotNull();
}
}
if (trafficVo.getTaskId_arr() != null) {
if(trafficVo.getTaskId_arr() != null) {
criteria.andTaskIdIn(trafficVo.getTaskId_arr());
}
if (trafficVo.getTaskId_gt() != null) {
if(trafficVo.getTaskId_gt() != null) {
criteria.andTaskIdGreaterThan(trafficVo.getTaskId_gt());
}
if (trafficVo.getTaskId_lt() != null) {
if(trafficVo.getTaskId_lt() != null) {
criteria.andTaskIdLessThan(trafficVo.getTaskId_lt());
}
if (trafficVo.getTaskId_gte() != null) {
if(trafficVo.getTaskId_gte() != null) {
criteria.andTaskIdGreaterThanOrEqualTo(trafficVo.getTaskId_gte());
}
if (trafficVo.getTaskId_lte() != null) {
if(trafficVo.getTaskId_lte() != null) {
criteria.andTaskIdLessThanOrEqualTo(trafficVo.getTaskId_lte());
}
if (trafficVo.getEventCate() != null) {
if(trafficVo.getEventCate() != null) {
criteria.andEventCateEqualTo(trafficVo.getEventCate());
}
if (trafficVo.getEventCate_null() != null) {
if (trafficVo.getEventCate_null().booleanValue()) {
if(trafficVo.getEventCate_null() != null) {
if(trafficVo.getEventCate_null().booleanValue()) {
criteria.andEventCateIsNull();
} else {
criteria.andEventCateIsNotNull();
}
}
if (trafficVo.getEventCate_arr() != null) {
if(trafficVo.getEventCate_arr() != null) {
criteria.andEventCateIn(trafficVo.getEventCate_arr());
}
if (trafficVo.getEventCate_like() != null) {
if(trafficVo.getEventCate_like() != null) {
criteria.andEventCateLike(trafficVo.getEventCate_like());
}
if (trafficVo.getEventType() != null) {
if(trafficVo.getEventType() != null) {
criteria.andEventTypeEqualTo(trafficVo.getEventType());
}
if (trafficVo.getEventType_null() != null) {
if (trafficVo.getEventType_null().booleanValue()) {
if(trafficVo.getEventType_null() != null) {
if(trafficVo.getEventType_null().booleanValue()) {
criteria.andEventTypeIsNull();
} else {
criteria.andEventTypeIsNotNull();
}
}
if (trafficVo.getEventType_arr() != null) {
if(trafficVo.getEventType_arr() != null) {
criteria.andEventTypeIn(trafficVo.getEventType_arr());
}
if (trafficVo.getEventType_like() != null) {
if(trafficVo.getEventType_like() != null) {
criteria.andEventTypeLike(trafficVo.getEventType_like());
}
if (trafficVo.getEventDt() != null) {
if(trafficVo.getEventDt() != null) {
criteria.andEventDtEqualTo(trafficVo.getEventDt());
}
if (trafficVo.getEventDt_arr() != null) {
if(trafficVo.getEventDt_arr() != null) {
criteria.andEventDtIn(trafficVo.getEventDt_arr());
}
if (trafficVo.getEventDt_gt() != null) {
if(trafficVo.getEventDt_gt() != null) {
criteria.andEventDtGreaterThan(trafficVo.getEventDt_gt());
}
if (trafficVo.getEventDt_lt() != null) {
if(trafficVo.getEventDt_lt() != null) {
criteria.andEventDtLessThan(trafficVo.getEventDt_lt());
}
if (trafficVo.getEventDt_gte() != null) {
if(trafficVo.getEventDt_gte() != null) {
criteria.andEventDtGreaterThanOrEqualTo(trafficVo.getEventDt_gte());
}
if (trafficVo.getEventDt_lte() != null) {
if(trafficVo.getEventDt_lte() != null) {
criteria.andEventDtLessThanOrEqualTo(trafficVo.getEventDt_lte());
}
if (trafficVo.getChannelUnid() != null) {
if(trafficVo.getChannelUnid() != null) {
criteria.andChannelUnidEqualTo(trafficVo.getChannelUnid());
}
if (trafficVo.getChannelUnid_null() != null) {
if (trafficVo.getChannelUnid_null().booleanValue()) {
if(trafficVo.getChannelUnid_null() != null) {
if(trafficVo.getChannelUnid_null().booleanValue()) {
criteria.andChannelUnidIsNull();
} else {
criteria.andChannelUnidIsNotNull();
}
}
if (trafficVo.getChannelUnid_arr() != null) {
if(trafficVo.getChannelUnid_arr() != null) {
criteria.andChannelUnidIn(trafficVo.getChannelUnid_arr());
}
if (trafficVo.getChannelUnid_like() != null) {
if(trafficVo.getChannelUnid_like() != null) {
criteria.andChannelUnidLike(trafficVo.getChannelUnid_like());
}
if (trafficVo.getPlateColor() != null) {
if(trafficVo.getPlateColor() != null) {
criteria.andPlateColorEqualTo(trafficVo.getPlateColor());
}
if (trafficVo.getPlateColor_null() != null) {
if (trafficVo.getPlateColor_null().booleanValue()) {
if(trafficVo.getPlateColor_null() != null) {
if(trafficVo.getPlateColor_null().booleanValue()) {
criteria.andPlateColorIsNull();
} else {
criteria.andPlateColorIsNotNull();
}
}
if (trafficVo.getPlateColor_arr() != null) {
if(trafficVo.getPlateColor_arr() != null) {
criteria.andPlateColorIn(trafficVo.getPlateColor_arr());
}
if (trafficVo.getPlateColor_like() != null) {
if(trafficVo.getPlateColor_like() != null) {
criteria.andPlateColorLike(trafficVo.getPlateColor_like());
}
if (trafficVo.getPlateNumber() != null) {
if(trafficVo.getPlateNumber() != null) {
criteria.andPlateNumberEqualTo(trafficVo.getPlateNumber());
}
if (trafficVo.getPlateNumber_null() != null) {
if (trafficVo.getPlateNumber_null().booleanValue()) {
if(trafficVo.getPlateNumber_null() != null) {
if(trafficVo.getPlateNumber_null().booleanValue()) {
criteria.andPlateNumberIsNull();
} else {
criteria.andPlateNumberIsNotNull();
}
}
if (trafficVo.getPlateNumber_arr() != null) {
if(trafficVo.getPlateNumber_arr() != null) {
criteria.andPlateNumberIn(trafficVo.getPlateNumber_arr());
}
if (trafficVo.getPlateNumber_like() != null) {
if(trafficVo.getPlateNumber_like() != null) {
criteria.andPlateNumberLike(trafficVo.getPlateNumber_like());
}
if (trafficVo.getLocationCode() != null) {
if(trafficVo.getLocationCode() != null) {
criteria.andLocationCodeEqualTo(trafficVo.getLocationCode());
}
if (trafficVo.getLocationCode_null() != null) {
if (trafficVo.getLocationCode_null().booleanValue()) {
if(trafficVo.getLocationCode_null() != null) {
if(trafficVo.getLocationCode_null().booleanValue()) {
criteria.andLocationCodeIsNull();
} else {
criteria.andLocationCodeIsNotNull();
}
}
if (trafficVo.getLocationCode_arr() != null) {
if(trafficVo.getLocationCode_arr() != null) {
criteria.andLocationCodeIn(trafficVo.getLocationCode_arr());
}
if (trafficVo.getLocationCode_like() != null) {
if(trafficVo.getLocationCode_like() != null) {
criteria.andLocationCodeLike(trafficVo.getLocationCode_like());
}
if (trafficVo.getLocationName() != null) {
if(trafficVo.getLocationName() != null) {
criteria.andLocationNameEqualTo(trafficVo.getLocationName());
}
if (trafficVo.getLocationName_null() != null) {
if (trafficVo.getLocationName_null().booleanValue()) {
if(trafficVo.getLocationName_null() != null) {
if(trafficVo.getLocationName_null().booleanValue()) {
criteria.andLocationNameIsNull();
} else {
criteria.andLocationNameIsNotNull();
}
}
if (trafficVo.getLocationName_arr() != null) {
if(trafficVo.getLocationName_arr() != null) {
criteria.andLocationNameIn(trafficVo.getLocationName_arr());
}
if (trafficVo.getLocationName_like() != null) {
if(trafficVo.getLocationName_like() != null) {
criteria.andLocationNameLike(trafficVo.getLocationName_like());
}
if (trafficVo.getLaneCode() != null) {
if(trafficVo.getLaneCode() != null) {
criteria.andLaneCodeEqualTo(trafficVo.getLaneCode());
}
if (trafficVo.getLaneCode_null() != null) {
if (trafficVo.getLaneCode_null().booleanValue()) {
if(trafficVo.getLaneCode_null() != null) {
if(trafficVo.getLaneCode_null().booleanValue()) {
criteria.andLaneCodeIsNull();
} else {
criteria.andLaneCodeIsNotNull();
}
}
if (trafficVo.getLaneCode_arr() != null) {
if(trafficVo.getLaneCode_arr() != null) {
criteria.andLaneCodeIn(trafficVo.getLaneCode_arr());
}
if (trafficVo.getLaneCode_like() != null) {
if(trafficVo.getLaneCode_like() != null) {
criteria.andLaneCodeLike(trafficVo.getLaneCode_like());
}
if (trafficVo.getDirectionCode() != null) {
if(trafficVo.getDirectionCode() != null) {
criteria.andDirectionCodeEqualTo(trafficVo.getDirectionCode());
}
if (trafficVo.getDirectionCode_null() != null) {
if (trafficVo.getDirectionCode_null().booleanValue()) {
if(trafficVo.getDirectionCode_null() != null) {
if(trafficVo.getDirectionCode_null().booleanValue()) {
criteria.andDirectionCodeIsNull();
} else {
criteria.andDirectionCodeIsNotNull();
}
}
if (trafficVo.getDirectionCode_arr() != null) {
if(trafficVo.getDirectionCode_arr() != null) {
criteria.andDirectionCodeIn(trafficVo.getDirectionCode_arr());
}
if (trafficVo.getDirectionCode_like() != null) {
if(trafficVo.getDirectionCode_like() != null) {
criteria.andDirectionCodeLike(trafficVo.getDirectionCode_like());
}
if (trafficVo.getVehicleType() != null) {
if(trafficVo.getVehicleType() != null) {
criteria.andVehicleTypeEqualTo(trafficVo.getVehicleType());
}
if (trafficVo.getVehicleType_null() != null) {
if (trafficVo.getVehicleType_null().booleanValue()) {
if(trafficVo.getVehicleType_null() != null) {
if(trafficVo.getVehicleType_null().booleanValue()) {
criteria.andVehicleTypeIsNull();
} else {
criteria.andVehicleTypeIsNotNull();
}
}
if (trafficVo.getVehicleType_arr() != null) {
if(trafficVo.getVehicleType_arr() != null) {
criteria.andVehicleTypeIn(trafficVo.getVehicleType_arr());
}
if (trafficVo.getVehicleType_like() != null) {
if(trafficVo.getVehicleType_like() != null) {
criteria.andVehicleTypeLike(trafficVo.getVehicleType_like());
}
if (trafficVo.getVehicleColor() != null) {
if(trafficVo.getVehicleColor() != null) {
criteria.andVehicleColorEqualTo(trafficVo.getVehicleColor());
}
if (trafficVo.getVehicleColor_null() != null) {
if (trafficVo.getVehicleColor_null().booleanValue()) {
if(trafficVo.getVehicleColor_null() != null) {
if(trafficVo.getVehicleColor_null().booleanValue()) {
criteria.andVehicleColorIsNull();
} else {
criteria.andVehicleColorIsNotNull();
}
}
if (trafficVo.getVehicleColor_arr() != null) {
if(trafficVo.getVehicleColor_arr() != null) {
criteria.andVehicleColorIn(trafficVo.getVehicleColor_arr());
}
if (trafficVo.getVehicleColor_like() != null) {
if(trafficVo.getVehicleColor_like() != null) {
criteria.andVehicleColorLike(trafficVo.getVehicleColor_like());
}
if (trafficVo.getVehicleLogo() != null) {
if(trafficVo.getVehicleLogo() != null) {
criteria.andVehicleLogoEqualTo(trafficVo.getVehicleLogo());
}
if (trafficVo.getVehicleLogo_null() != null) {
if (trafficVo.getVehicleLogo_null().booleanValue()) {
if(trafficVo.getVehicleLogo_null() != null) {
if(trafficVo.getVehicleLogo_null().booleanValue()) {
criteria.andVehicleLogoIsNull();
} else {
criteria.andVehicleLogoIsNotNull();
}
}
if (trafficVo.getVehicleLogo_arr() != null) {
if(trafficVo.getVehicleLogo_arr() != null) {
criteria.andVehicleLogoIn(trafficVo.getVehicleLogo_arr());
}
if (trafficVo.getVehicleLogo_like() != null) {
if(trafficVo.getVehicleLogo_like() != null) {
criteria.andVehicleLogoLike(trafficVo.getVehicleLogo_like());
}
if (trafficVo.getIllegalCode() != null) {
if(trafficVo.getIllegalCode() != null) {
criteria.andIllegalCodeEqualTo(trafficVo.getIllegalCode());
}
if (trafficVo.getIllegalCode_null() != null) {
if (trafficVo.getIllegalCode_null().booleanValue()) {
if(trafficVo.getIllegalCode_null() != null) {
if(trafficVo.getIllegalCode_null().booleanValue()) {
criteria.andIllegalCodeIsNull();
} else {
criteria.andIllegalCodeIsNotNull();
}
}
if (trafficVo.getIllegalCode_arr() != null) {
if(trafficVo.getIllegalCode_arr() != null) {
criteria.andIllegalCodeIn(trafficVo.getIllegalCode_arr());
}
if (trafficVo.getIllegalCode_like() != null) {
if(trafficVo.getIllegalCode_like() != null) {
criteria.andIllegalCodeLike(trafficVo.getIllegalCode_like());
}
if (trafficVo.getIllegalState() != null) {
if(trafficVo.getIllegalState() != null) {
criteria.andIllegalStateEqualTo(trafficVo.getIllegalState());
}
if (trafficVo.getIllegalState_null() != null) {
if (trafficVo.getIllegalState_null().booleanValue()) {
if(trafficVo.getIllegalState_null() != null) {
if(trafficVo.getIllegalState_null().booleanValue()) {
criteria.andIllegalStateIsNull();
} else {
criteria.andIllegalStateIsNotNull();
}
}
if (trafficVo.getIllegalState_arr() != null) {
if(trafficVo.getIllegalState_arr() != null) {
criteria.andIllegalStateIn(trafficVo.getIllegalState_arr());
}
if (trafficVo.getIllegalState_gt() != null) {
if(trafficVo.getIllegalState_gt() != null) {
criteria.andIllegalStateGreaterThan(trafficVo.getIllegalState_gt());
}
if (trafficVo.getIllegalState_lt() != null) {
if(trafficVo.getIllegalState_lt() != null) {
criteria.andIllegalStateLessThan(trafficVo.getIllegalState_lt());
}
if (trafficVo.getIllegalState_gte() != null) {
if(trafficVo.getIllegalState_gte() != null) {
criteria.andIllegalStateGreaterThanOrEqualTo(trafficVo.getIllegalState_gte());
}
if (trafficVo.getIllegalState_lte() != null) {
if(trafficVo.getIllegalState_lte() != null) {
criteria.andIllegalStateLessThanOrEqualTo(trafficVo.getIllegalState_lte());
}
if (trafficVo.getFeatureAnnualInspectionMark() != null) {
if(trafficVo.getFeatureAnnualInspectionMark() != null) {
criteria.andFeatureAnnualInspectionMarkEqualTo(trafficVo.getFeatureAnnualInspectionMark());
}
if (trafficVo.getFeatureAnnualInspectionMark_null() != null) {
if (trafficVo.getFeatureAnnualInspectionMark_null().booleanValue()) {
if(trafficVo.getFeatureAnnualInspectionMark_null() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_null().booleanValue()) {
criteria.andFeatureAnnualInspectionMarkIsNull();
} else {
criteria.andFeatureAnnualInspectionMarkIsNotNull();
}
}
if (trafficVo.getFeatureAnnualInspectionMark_arr() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_arr() != null) {
criteria.andFeatureAnnualInspectionMarkIn(trafficVo.getFeatureAnnualInspectionMark_arr());
}
if (trafficVo.getFeatureAnnualInspectionMark_gt() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_gt() != null) {
criteria.andFeatureAnnualInspectionMarkGreaterThan(trafficVo.getFeatureAnnualInspectionMark_gt());
}
if (trafficVo.getFeatureAnnualInspectionMark_lt() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_lt() != null) {
criteria.andFeatureAnnualInspectionMarkLessThan(trafficVo.getFeatureAnnualInspectionMark_lt());
}
if (trafficVo.getFeatureAnnualInspectionMark_gte() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_gte() != null) {
criteria.andFeatureAnnualInspectionMarkGreaterThanOrEqualTo(trafficVo.getFeatureAnnualInspectionMark_gte());
}
if (trafficVo.getFeatureAnnualInspectionMark_lte() != null) {
if(trafficVo.getFeatureAnnualInspectionMark_lte() != null) {
criteria.andFeatureAnnualInspectionMarkLessThanOrEqualTo(trafficVo.getFeatureAnnualInspectionMark_lte());
}
if (trafficVo.getFeaturePendant() != null) {
if(trafficVo.getFeaturePendant() != null) {
criteria.andFeaturePendantEqualTo(trafficVo.getFeaturePendant());
}
if (trafficVo.getFeaturePendant_null() != null) {
if (trafficVo.getFeaturePendant_null().booleanValue()) {
if(trafficVo.getFeaturePendant_null() != null) {
if(trafficVo.getFeaturePendant_null().booleanValue()) {
criteria.andFeaturePendantIsNull();
} else {
criteria.andFeaturePendantIsNotNull();
}
}
if (trafficVo.getFeaturePendant_arr() != null) {
if(trafficVo.getFeaturePendant_arr() != null) {
criteria.andFeaturePendantIn(trafficVo.getFeaturePendant_arr());
}
if (trafficVo.getFeaturePendant_gt() != null) {
if(trafficVo.getFeaturePendant_gt() != null) {
criteria.andFeaturePendantGreaterThan(trafficVo.getFeaturePendant_gt());
}
if (trafficVo.getFeaturePendant_lt() != null) {
if(trafficVo.getFeaturePendant_lt() != null) {
criteria.andFeaturePendantLessThan(trafficVo.getFeaturePendant_lt());
}
if (trafficVo.getFeaturePendant_gte() != null) {
if(trafficVo.getFeaturePendant_gte() != null) {
criteria.andFeaturePendantGreaterThanOrEqualTo(trafficVo.getFeaturePendant_gte());
}
if (trafficVo.getFeaturePendant_lte() != null) {
if(trafficVo.getFeaturePendant_lte() != null) {
criteria.andFeaturePendantLessThanOrEqualTo(trafficVo.getFeaturePendant_lte());
}
if (trafficVo.getFeatureDecoration() != null) {
if(trafficVo.getFeatureDecoration() != null) {
criteria.andFeatureDecorationEqualTo(trafficVo.getFeatureDecoration());
}
if (trafficVo.getFeatureDecoration_null() != null) {
if (trafficVo.getFeatureDecoration_null().booleanValue()) {
if(trafficVo.getFeatureDecoration_null() != null) {
if(trafficVo.getFeatureDecoration_null().booleanValue()) {
criteria.andFeatureDecorationIsNull();
} else {
criteria.andFeatureDecorationIsNotNull();
}
}
if (trafficVo.getFeatureDecoration_arr() != null) {
if(trafficVo.getFeatureDecoration_arr() != null) {
criteria.andFeatureDecorationIn(trafficVo.getFeatureDecoration_arr());
}
if (trafficVo.getFeatureDecoration_gt() != null) {
if(trafficVo.getFeatureDecoration_gt() != null) {
criteria.andFeatureDecorationGreaterThan(trafficVo.getFeatureDecoration_gt());
}
if (trafficVo.getFeatureDecoration_lt() != null) {
if(trafficVo.getFeatureDecoration_lt() != null) {
criteria.andFeatureDecorationLessThan(trafficVo.getFeatureDecoration_lt());
}
if (trafficVo.getFeatureDecoration_gte() != null) {
if(trafficVo.getFeatureDecoration_gte() != null) {
criteria.andFeatureDecorationGreaterThanOrEqualTo(trafficVo.getFeatureDecoration_gte());
}
if (trafficVo.getFeatureDecoration_lte() != null) {
if(trafficVo.getFeatureDecoration_lte() != null) {
criteria.andFeatureDecorationLessThanOrEqualTo(trafficVo.getFeatureDecoration_lte());
}
if (trafficVo.getFeatureSunShield() != null) {
if(trafficVo.getFeatureSunShield() != null) {
criteria.andFeatureSunShieldEqualTo(trafficVo.getFeatureSunShield());
}
if (trafficVo.getFeatureSunShield_null() != null) {
if (trafficVo.getFeatureSunShield_null().booleanValue()) {
if(trafficVo.getFeatureSunShield_null() != null) {
if(trafficVo.getFeatureSunShield_null().booleanValue()) {
criteria.andFeatureSunShieldIsNull();
} else {
criteria.andFeatureSunShieldIsNotNull();
}
}
if (trafficVo.getFeatureSunShield_arr() != null) {
if(trafficVo.getFeatureSunShield_arr() != null) {
criteria.andFeatureSunShieldIn(trafficVo.getFeatureSunShield_arr());
}
if (trafficVo.getFeatureSunShield_gt() != null) {
if(trafficVo.getFeatureSunShield_gt() != null) {
criteria.andFeatureSunShieldGreaterThan(trafficVo.getFeatureSunShield_gt());
}
if (trafficVo.getFeatureSunShield_lt() != null) {
if(trafficVo.getFeatureSunShield_lt() != null) {
criteria.andFeatureSunShieldLessThan(trafficVo.getFeatureSunShield_lt());
}
if (trafficVo.getFeatureSunShield_gte() != null) {
if(trafficVo.getFeatureSunShield_gte() != null) {
criteria.andFeatureSunShieldGreaterThanOrEqualTo(trafficVo.getFeatureSunShield_gte());
}
if (trafficVo.getFeatureSunShield_lte() != null) {
if(trafficVo.getFeatureSunShield_lte() != null) {
criteria.andFeatureSunShieldLessThanOrEqualTo(trafficVo.getFeatureSunShield_lte());
}
if (trafficVo.getXcycleType() != null) {
if(trafficVo.getXcycleType() != null) {
criteria.andXcycleTypeEqualTo(trafficVo.getXcycleType());
}
if (trafficVo.getXcycleType_null() != null) {
if (trafficVo.getXcycleType_null().booleanValue()) {
if(trafficVo.getXcycleType_null() != null) {
if(trafficVo.getXcycleType_null().booleanValue()) {
criteria.andXcycleTypeIsNull();
} else {
criteria.andXcycleTypeIsNotNull();
}
}
if (trafficVo.getXcycleType_arr() != null) {
if(trafficVo.getXcycleType_arr() != null) {
criteria.andXcycleTypeIn(trafficVo.getXcycleType_arr());
}
if (trafficVo.getXcycleType_like() != null) {
if(trafficVo.getXcycleType_like() != null) {
criteria.andXcycleTypeLike(trafficVo.getXcycleType_like());
}
if (trafficVo.getEventId() != null) {
if(trafficVo.getEventId() != null) {
criteria.andEventIdEqualTo(trafficVo.getEventId());
}
if (trafficVo.getEventId_null() != null) {
if (trafficVo.getEventId_null().booleanValue()) {
if(trafficVo.getEventId_null() != null) {
if(trafficVo.getEventId_null().booleanValue()) {
criteria.andEventIdIsNull();
} else {
criteria.andEventIdIsNotNull();
}
}
if (trafficVo.getEventId_arr() != null) {
if(trafficVo.getEventId_arr() != null) {
criteria.andEventIdIn(trafficVo.getEventId_arr());
}
if (trafficVo.getEventId_like() != null) {
if(trafficVo.getEventId_like() != null) {
criteria.andEventIdLike(trafficVo.getEventId_like());
}
if (trafficVo.getSpecialType() != null) {
if(trafficVo.getSpecialType() != null) {
criteria.andSpecialTypeEqualTo(trafficVo.getSpecialType());
}
if (trafficVo.getSpecialType_null() != null) {
if (trafficVo.getSpecialType_null().booleanValue()) {
if(trafficVo.getSpecialType_null() != null) {
if(trafficVo.getSpecialType_null().booleanValue()) {
criteria.andSpecialTypeIsNull();
} else {
criteria.andSpecialTypeIsNotNull();
}
}
if (trafficVo.getSpecialType_arr() != null) {
if(trafficVo.getSpecialType_arr() != null) {
criteria.andSpecialTypeIn(trafficVo.getSpecialType_arr());
}
if (trafficVo.getSpecialType_like() != null) {
if(trafficVo.getSpecialType_like() != null) {
criteria.andSpecialTypeLike(trafficVo.getSpecialType_like());
}
if (trafficVo.getWithHelmet() != null) {
if(trafficVo.getWithHelmet() != null) {
criteria.andWithHelmetEqualTo(trafficVo.getWithHelmet());
}
if (trafficVo.getWithHelmet_null() != null) {
if (trafficVo.getWithHelmet_null().booleanValue()) {
if(trafficVo.getWithHelmet_null() != null) {
if(trafficVo.getWithHelmet_null().booleanValue()) {
criteria.andWithHelmetIsNull();
} else {
criteria.andWithHelmetIsNotNull();
}
}
if (trafficVo.getWithHelmet_arr() != null) {
if(trafficVo.getWithHelmet_arr() != null) {
criteria.andWithHelmetIn(trafficVo.getWithHelmet_arr());
}
if (trafficVo.getWithHelmet_gt() != null) {
if(trafficVo.getWithHelmet_gt() != null) {
criteria.andWithHelmetGreaterThan(trafficVo.getWithHelmet_gt());
}
if (trafficVo.getWithHelmet_lt() != null) {
if(trafficVo.getWithHelmet_lt() != null) {
criteria.andWithHelmetLessThan(trafficVo.getWithHelmet_lt());
}
if (trafficVo.getWithHelmet_gte() != null) {
if(trafficVo.getWithHelmet_gte() != null) {
criteria.andWithHelmetGreaterThanOrEqualTo(trafficVo.getWithHelmet_gte());
}
if (trafficVo.getWithHelmet_lte() != null) {
if(trafficVo.getWithHelmet_lte() != null) {
criteria.andWithHelmetLessThanOrEqualTo(trafficVo.getWithHelmet_lte());
}
if (trafficVo.getPicName() != null) {
criteria.andPicNameEqualTo(trafficVo.getPicName());
if(trafficVo.getPics() != null) {
criteria.andPicsEqualTo(trafficVo.getPics());
}
if (trafficVo.getPicName_null() != null) {
if (trafficVo.getPicName_null().booleanValue()) {
criteria.andPicNameIsNull();
if(trafficVo.getPics_null() != null) {
if(trafficVo.getPics_null().booleanValue()) {
criteria.andPicsIsNull();
} else {
criteria.andPicNameIsNotNull();
criteria.andPicsIsNotNull();
}
}
if (trafficVo.getPicName_arr() != null) {
criteria.andPicNameIn(trafficVo.getPicName_arr());
if(trafficVo.getPics_arr() != null) {
criteria.andPicsIn(trafficVo.getPics_arr());
}
if (trafficVo.getPicName_like() != null) {
criteria.andPicNameLike(trafficVo.getPicName_like());
if(trafficVo.getPics_like() != null) {
criteria.andPicsLike(trafficVo.getPics_like());
}
if (trafficVo.getVideoName() != null) {
if(trafficVo.getVideoName() != null) {
criteria.andVideoNameEqualTo(trafficVo.getVideoName());
}
if (trafficVo.getVideoName_null() != null) {
if (trafficVo.getVideoName_null().booleanValue()) {
if(trafficVo.getVideoName_null() != null) {
if(trafficVo.getVideoName_null().booleanValue()) {
criteria.andVideoNameIsNull();
} else {
criteria.andVideoNameIsNotNull();
}
}
if (trafficVo.getVideoName_arr() != null) {
if(trafficVo.getVideoName_arr() != null) {
criteria.andVideoNameIn(trafficVo.getVideoName_arr());
}
if (trafficVo.getVideoName_like() != null) {
if(trafficVo.getVideoName_like() != null) {
criteria.andVideoNameLike(trafficVo.getVideoName_like());
}
if (trafficVo.getStatus() != null) {
if(trafficVo.getStatus() != null) {
criteria.andStatusEqualTo(trafficVo.getStatus());
}
if (trafficVo.getStatus_arr() != null) {
if(trafficVo.getStatus_arr() != null) {
criteria.andStatusIn(trafficVo.getStatus_arr());
}
if (trafficVo.getStatus_gt() != null) {
if(trafficVo.getStatus_gt() != null) {
criteria.andStatusGreaterThan(trafficVo.getStatus_gt());
}
if (trafficVo.getStatus_lt() != null) {
if(trafficVo.getStatus_lt() != null) {
criteria.andStatusLessThan(trafficVo.getStatus_lt());
}
if (trafficVo.getStatus_gte() != null) {
if(trafficVo.getStatus_gte() != null) {
criteria.andStatusGreaterThanOrEqualTo(trafficVo.getStatus_gte());
}
if (trafficVo.getStatus_lte() != null) {
if(trafficVo.getStatus_lte() != null) {
criteria.andStatusLessThanOrEqualTo(trafficVo.getStatus_lte());
}
return trafficExample;
......
......@@ -9,6 +9,7 @@
<result column="behavior_event_cate" property="eventCate" />
<result column="behavior_event_refid" property="eventRefid" />
<result column="behavior_event_time" property="eventTime" />
<result column="behavior_pics" property="pics" />
<result column="behavior_channel_unid" property="channelUnid" />
<result column="behavior_test_pic_file" property="testPicFile" />
<result column="behavior_test_frame_no" property="testFrameNo" />
......@@ -19,7 +20,6 @@
<resultMap id="ResultMapWithBLOBs" type="com.viontech.fanxing.commons.model.Behavior" extends="BaseResultMap" >
<result column="behavior_aux_dev_info" property="auxDevInfo" jdbcType="LONGVARCHAR" />
<result column="behavior_event_data" property="eventData" jdbcType="LONGVARCHAR" />
<result column="behavior_pics" property="pics" jdbcType="LONGVARCHAR" />
<result column="behavior_video" property="video" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
......@@ -84,9 +84,9 @@
`behavior`.id as behavior_id, `behavior`.unid as behavior_unid, `behavior`.task_id as behavior_task_id,
`behavior`.event_type as behavior_event_type, `behavior`.event_cate as behavior_event_cate,
`behavior`.event_refid as behavior_event_refid, `behavior`.event_time as behavior_event_time,
`behavior`.channel_unid as behavior_channel_unid, `behavior`.test_pic_file as behavior_test_pic_file,
`behavior`.test_frame_no as behavior_test_frame_no, `behavior`.task_name as behavior_task_name,
`behavior`.event_data_num as behavior_event_data_num
`behavior`.pics as behavior_pics, `behavior`.channel_unid as behavior_channel_unid,
`behavior`.test_pic_file as behavior_test_pic_file, `behavior`.test_frame_no as behavior_test_frame_no,
`behavior`.task_name as behavior_task_name, `behavior`.event_data_num as behavior_event_data_num
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'BehaviorExample')" >
......@@ -109,7 +109,7 @@
</sql>
<sql id="Blob_Column_List" >
`behavior`.aux_dev_info as behavior_aux_dev_info, `behavior`.event_data as behavior_event_data,
`behavior`.pics as behavior_pics, `behavior`.video as behavior_video
`behavior`.video as behavior_video
</sql>
<select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.viontech.fanxing.commons.model.BehaviorExample" >
select
......@@ -168,15 +168,15 @@
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.Behavior" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `d_behavior` (unid, task_id, event_type,
event_cate, event_refid, event_time,
channel_unid, test_pic_file, test_frame_no,
task_name, event_data_num, aux_dev_info,
event_data, pics, video
pics, channel_unid, test_pic_file,
test_frame_no, task_name, event_data_num,
aux_dev_info, event_data, video
)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventCate,jdbcType=VARCHAR}, #{eventRefid,jdbcType=VARCHAR}, #{eventTime,jdbcType=TIMESTAMP},
#{channelUnid,jdbcType=VARCHAR}, #{testPicFile,jdbcType=VARCHAR}, #{testFrameNo,jdbcType=VARCHAR},
#{taskName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=VARCHAR}, #{auxDevInfo,jdbcType=LONGVARCHAR},
#{eventData,jdbcType=LONGVARCHAR}, #{pics,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}
#{pics,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR}, #{testPicFile,jdbcType=VARCHAR},
#{testFrameNo,jdbcType=VARCHAR}, #{taskName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=VARCHAR},
#{auxDevInfo,jdbcType=LONGVARCHAR}, #{eventData,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Behavior" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
......@@ -200,6 +200,9 @@
<if test="eventTime != null" >
event_time,
</if>
<if test="pics != null" >
pics,
</if>
<if test="channelUnid != null" >
channel_unid,
</if>
......@@ -221,9 +224,6 @@
<if test="eventData != null" >
event_data,
</if>
<if test="pics != null" >
pics,
</if>
<if test="video != null" >
video,
</if>
......@@ -247,6 +247,9 @@
<if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="pics != null" >
#{pics,jdbcType=VARCHAR},
</if>
<if test="channelUnid != null" >
#{channelUnid,jdbcType=VARCHAR},
</if>
......@@ -268,9 +271,6 @@
<if test="eventData != null" >
#{eventData,jdbcType=LONGVARCHAR},
</if>
<if test="pics != null" >
#{pics,jdbcType=LONGVARCHAR},
</if>
<if test="video != null" >
#{video,jdbcType=LONGVARCHAR},
</if>
......@@ -306,6 +306,9 @@
<if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=VARCHAR},
</if>
<if test="record.channelUnid != null" >
channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
</if>
......@@ -327,9 +330,6 @@
<if test="record.eventData != null" >
event_data = #{record.eventData,jdbcType=LONGVARCHAR},
</if>
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=LONGVARCHAR},
</if>
<if test="record.video != null" >
video = #{record.video,jdbcType=LONGVARCHAR},
</if>
......@@ -347,6 +347,7 @@
`behavior`.event_cate = #{record.eventCate,jdbcType=VARCHAR},
`behavior`.event_refid = #{record.eventRefid,jdbcType=VARCHAR},
`behavior`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`behavior`.pics = #{record.pics,jdbcType=VARCHAR},
`behavior`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
`behavior`.test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
`behavior`.test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
......@@ -354,7 +355,6 @@
`behavior`.event_data_num = #{record.eventDataNum,jdbcType=VARCHAR},
`behavior`.aux_dev_info = #{record.auxDevInfo,jdbcType=LONGVARCHAR},
`behavior`.event_data = #{record.eventData,jdbcType=LONGVARCHAR},
`behavior`.pics = #{record.pics,jdbcType=LONGVARCHAR},
`behavior`.video = #{record.video,jdbcType=LONGVARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
......@@ -369,6 +369,7 @@
event_cate = #{record.eventCate,jdbcType=VARCHAR},
event_refid = #{record.eventRefid,jdbcType=VARCHAR},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
pics = #{record.pics,jdbcType=VARCHAR},
channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
......@@ -399,6 +400,9 @@
<if test="eventTime != null" >
event_time = #{eventTime,jdbcType=TIMESTAMP},
</if>
<if test="pics != null" >
pics = #{pics,jdbcType=VARCHAR},
</if>
<if test="channelUnid != null" >
channel_unid = #{channelUnid,jdbcType=VARCHAR},
</if>
......@@ -420,9 +424,6 @@
<if test="eventData != null" >
event_data = #{eventData,jdbcType=LONGVARCHAR},
</if>
<if test="pics != null" >
pics = #{pics,jdbcType=LONGVARCHAR},
</if>
<if test="video != null" >
video = #{video,jdbcType=LONGVARCHAR},
</if>
......@@ -437,6 +438,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
......@@ -444,7 +446,6 @@
event_data_num = #{eventDataNum,jdbcType=VARCHAR},
aux_dev_info = #{auxDevInfo,jdbcType=LONGVARCHAR},
event_data = #{eventData,jdbcType=LONGVARCHAR},
pics = #{pics,jdbcType=LONGVARCHAR},
video = #{video,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -456,6 +457,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
......
......@@ -12,7 +12,7 @@
<result column="flowEvent_device_name" property="deviceName" />
<result column="flowEvent_location_code" property="locationCode" />
<result column="flowEvent_location_name" property="locationName" />
<result column="flowEvent_pic_name" property="picName" />
<result column="flowEvent_pics" property="pics" />
<result column="flowEvent_video_name" property="videoName" />
</resultMap>
<resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.FlowEvent" extends="BaseResultMapRoot" />
......@@ -82,7 +82,7 @@
`flowEvent`.event_type as flowEvent_event_type, `flowEvent`.event_time as flowEvent_event_time,
`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`.location_name as flowEvent_location_name, `flowEvent`.pic_name as flowEvent_pic_name,
`flowEvent`.location_name as flowEvent_location_name, `flowEvent`.pics as flowEvent_pics,
`flowEvent`.video_name as flowEvent_video_name
</sql>
<sql id="Base_Column_List" >
......@@ -165,12 +165,12 @@
insert into `d_flow_event` (unid, task_id, event_type,
event_time, event_id, device_code,
device_name, location_code, location_name,
pic_name, video_name, json_data
pics, video_name, json_data
)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventTime,jdbcType=TIMESTAMP}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR},
#{deviceName,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR},
#{picName,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR}
#{pics,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
......@@ -203,8 +203,8 @@
<if test="locationName != null" >
location_name,
</if>
<if test="picName != null" >
pic_name,
<if test="pics != null" >
pics,
</if>
<if test="videoName != null" >
video_name,
......@@ -241,8 +241,8 @@
<if test="locationName != null" >
#{locationName,jdbcType=VARCHAR},
</if>
<if test="picName != null" >
#{picName,jdbcType=VARCHAR},
<if test="pics != null" >
#{pics,jdbcType=VARCHAR},
</if>
<if test="videoName != null" >
#{videoName,jdbcType=VARCHAR},
......@@ -291,8 +291,8 @@
<if test="record.locationName != null" >
location_name = #{record.locationName,jdbcType=VARCHAR},
</if>
<if test="record.picName != null" >
pic_name = #{record.picName,jdbcType=VARCHAR},
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=VARCHAR},
</if>
<if test="record.videoName != null" >
video_name = #{record.videoName,jdbcType=VARCHAR},
......@@ -317,7 +317,7 @@
`flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR},
`flowEvent`.location_code = #{record.locationCode,jdbcType=VARCHAR},
`flowEvent`.location_name = #{record.locationName,jdbcType=VARCHAR},
`flowEvent`.pic_name = #{record.picName,jdbcType=VARCHAR},
`flowEvent`.pics = #{record.pics,jdbcType=VARCHAR},
`flowEvent`.video_name = #{record.videoName,jdbcType=VARCHAR},
`flowEvent`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
<if test="_parameter != null" >
......@@ -336,7 +336,7 @@
device_name = #{record.deviceName,jdbcType=VARCHAR},
location_code = #{record.locationCode,jdbcType=VARCHAR},
location_name = #{record.locationName,jdbcType=VARCHAR},
pic_name = #{record.picName,jdbcType=VARCHAR},
pics = #{record.pics,jdbcType=VARCHAR},
video_name = #{record.videoName,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
......@@ -372,8 +372,8 @@
<if test="locationName != null" >
location_name = #{locationName,jdbcType=VARCHAR},
</if>
<if test="picName != null" >
pic_name = #{picName,jdbcType=VARCHAR},
<if test="pics != null" >
pics = #{pics,jdbcType=VARCHAR},
</if>
<if test="videoName != null" >
video_name = #{videoName,jdbcType=VARCHAR},
......@@ -395,7 +395,7 @@
device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR},
pic_name = #{picName,jdbcType=VARCHAR},
pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
json_data = #{jsonData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
......@@ -411,7 +411,7 @@
device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR},
pic_name = #{picName,jdbcType=VARCHAR},
pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
......
......@@ -28,7 +28,7 @@
<result column="traffic_event_id" property="eventId" />
<result column="traffic_special_type" property="specialType" />
<result column="traffic_with_helmet" property="withHelmet" />
<result column="traffic_pic_name" property="picName" />
<result column="traffic_pics" property="pics" />
<result column="traffic_video_name" property="videoName" />
<result column="traffic_status" property="status" />
</resultMap>
......@@ -107,8 +107,8 @@
`traffic`.feature_pendant as traffic_feature_pendant, `traffic`.feature_decoration as traffic_feature_decoration,
`traffic`.feature_sun_shield as traffic_feature_sun_shield, `traffic`.xcycle_type as traffic_xcycle_type,
`traffic`.event_id as traffic_event_id, `traffic`.special_type as traffic_special_type,
`traffic`.with_helmet as traffic_with_helmet, `traffic`.pic_name as traffic_pic_name,
`traffic`.video_name as traffic_video_name, `traffic`.`status` as `traffic_status`
`traffic`.with_helmet as traffic_with_helmet, `traffic`.pics as traffic_pics, `traffic`.video_name as traffic_video_name,
`traffic`.`status` as `traffic_status`
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'TrafficExample')" >
......@@ -195,7 +195,7 @@
illegal_code, illegal_state, feature_annual_inspection_mark,
feature_pendant, feature_decoration, feature_sun_shield,
xcycle_type, event_id, special_type,
with_helmet, pic_name, video_name,
with_helmet, pics, video_name,
`status`, json_data)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventCate,jdbcType=VARCHAR},
#{eventType,jdbcType=VARCHAR}, #{eventDt,jdbcType=TIMESTAMP}, #{channelUnid,jdbcType=VARCHAR},
......@@ -205,7 +205,7 @@
#{illegalCode,jdbcType=VARCHAR}, #{illegalState,jdbcType=INTEGER}, #{featureAnnualInspectionMark,jdbcType=SMALLINT},
#{featurePendant,jdbcType=SMALLINT}, #{featureDecoration,jdbcType=SMALLINT}, #{featureSunShield,jdbcType=SMALLINT},
#{xcycleType,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR}, #{specialType,jdbcType=VARCHAR},
#{withHelmet,jdbcType=INTEGER}, #{picName,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
#{withHelmet,jdbcType=INTEGER}, #{pics,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{jsonData,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
......@@ -286,8 +286,8 @@
<if test="withHelmet != null" >
with_helmet,
</if>
<if test="picName != null" >
pic_name,
<if test="pics != null" >
pics,
</if>
<if test="videoName != null" >
video_name,
......@@ -375,8 +375,8 @@
<if test="withHelmet != null" >
#{withHelmet,jdbcType=INTEGER},
</if>
<if test="picName != null" >
#{picName,jdbcType=VARCHAR},
<if test="pics != null" >
#{pics,jdbcType=VARCHAR},
</if>
<if test="videoName != null" >
#{videoName,jdbcType=VARCHAR},
......@@ -476,8 +476,8 @@
<if test="record.withHelmet != null" >
with_helmet = #{record.withHelmet,jdbcType=INTEGER},
</if>
<if test="record.picName != null" >
pic_name = #{record.picName,jdbcType=VARCHAR},
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=VARCHAR},
</if>
<if test="record.videoName != null" >
video_name = #{record.videoName,jdbcType=VARCHAR},
......@@ -521,7 +521,7 @@
`traffic`.event_id = #{record.eventId,jdbcType=VARCHAR},
`traffic`.special_type = #{record.specialType,jdbcType=VARCHAR},
`traffic`.with_helmet = #{record.withHelmet,jdbcType=INTEGER},
`traffic`.pic_name = #{record.picName,jdbcType=VARCHAR},
`traffic`.pics = #{record.pics,jdbcType=VARCHAR},
`traffic`.video_name = #{record.videoName,jdbcType=VARCHAR},
`traffic`.`status` = #{record.status,jdbcType=INTEGER},
`traffic`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
......@@ -557,7 +557,7 @@
event_id = #{record.eventId,jdbcType=VARCHAR},
special_type = #{record.specialType,jdbcType=VARCHAR},
with_helmet = #{record.withHelmet,jdbcType=INTEGER},
pic_name = #{record.picName,jdbcType=VARCHAR},
pics = #{record.pics,jdbcType=VARCHAR},
video_name = #{record.videoName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null" >
......@@ -642,8 +642,8 @@
<if test="withHelmet != null" >
with_helmet = #{withHelmet,jdbcType=INTEGER},
</if>
<if test="picName != null" >
pic_name = #{picName,jdbcType=VARCHAR},
<if test="pics != null" >
pics = #{pics,jdbcType=VARCHAR},
</if>
<if test="videoName != null" >
video_name = #{videoName,jdbcType=VARCHAR},
......@@ -684,7 +684,7 @@
event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER},
pic_name = #{picName,jdbcType=VARCHAR},
pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
json_data = #{jsonData,jdbcType=LONGVARCHAR}
......@@ -717,7 +717,7 @@
event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER},
pic_name = #{picName,jdbcType=VARCHAR},
pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
......
......@@ -26,10 +26,10 @@ spring:
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
......@@ -26,10 +26,10 @@ spring:
username: root
password: 123456
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
......@@ -63,8 +63,8 @@ public class TaskController implements TaskSchedulingTasksAdapter {
@DeleteMapping
public JsonMessageUtil.JsonMessage delete(Task task) {
String unid = task.getUnid();
taskService.removeTaskDataAll(unid);
vaServerService.terminateTask(task);
taskService.removeTaskDataAll(unid);
// todo
return JsonMessageUtil.getSuccessJsonMsg("success");
}
......
......@@ -33,9 +33,5 @@ public class VAServerController {
return "success";
}
@PostMapping("/status")
public Object status() {
// todo
return null;
}
}
......@@ -61,7 +61,7 @@ public class TaskRunner {
Double score = next.getScore();
String taskUnid = next.getValue();
if (System.currentTimeMillis() < score) {
return;
break;
} else {
TaskData taskData = taskDataMap.get(taskUnid);
Task task = taskData.getTask();
......@@ -84,7 +84,7 @@ public class TaskRunner {
}
boolean success = vaServerService.executeTask(task, server);
// todo 获取可用的vaserver,执行任务下发动作,如果成功,关联taskData和vaServer,修改可用资源数,并且从zset中移除任务,修改任务状态
// todo 修改任务状态
set.remove(taskUnid);
}
......
......@@ -28,6 +28,9 @@ public class VAServerService {
@Resource
private RedissonClient redissonClient;
/**
* 设备注册
*/
public void registeVAServer(VaServerInfo vaServerInfo) {
String devID = vaServerInfo.getDevID();
RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
......@@ -37,6 +40,9 @@ public class VAServerService {
map.put(devID, vaServerInfo);
}
/**
* 设备心跳
*/
public void keepalive(String devId) {
RBucket<Object> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devId));
bucket.set(1);
......@@ -63,26 +69,44 @@ public class VAServerService {
}
/**
* 下发任务
* 下发任务,关联任务和vaServer,修改vaServer可用资源数
*/
public boolean executeTask(Task task, VaServerInfo server) {
// todo 执行任务下发
linkTaskAndVaServer(task.getUnid(), server.getDevID());
server.setAvailableResources(server.getAvailableResources() - task.getResourceNeed());
return false;
}
/**
* 1. 解除任务和vaServer的关联
* 2. vaServer 资源数增加
* 3. 请求 vaServer 终止任务
* <p>
* 删除任务
*/
public boolean terminateTask(Task task) {
ImmutablePair<String, String> unlinkResult = unlinkTaskAndVaServer(task.getUnid());
String devId = unlinkResult.right;
String taskUnid = task.getUnid();
RMap<String, String> map = redissonClient.getMap(RedisKeys.SCHEDULING_TASK_VASERVER_MAP);
String vaServerId = map.get(taskUnid);
// todo 下发终止任务请求
// 解除任务和 vaServer 关联
map.remove(taskUnid);
RMap<String, VaServerInfo> vaServerMap = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
VaServerInfo vaServerInfo = vaServerMap.get(devId);
VaServerInfo vaServerInfo = vaServerMap.get(vaServerId);
vaServerInfo.setAvailableResources(vaServerInfo.getAvailableResources() + task.getResourceNeed());
vaServerMap.put(devId, vaServerInfo);
vaServerMap.put(vaServerId, vaServerInfo);
return false;
}
/**
* 修改任务
*/
public boolean modifyTask(Task task) {
return false;
}
......@@ -96,19 +120,19 @@ public class VAServerService {
}
/**
* 获取rtsp流点播地址
* 获取点播地址
*/
public Object getRtspPath() {
public Object getVideoOnDemandAddress(Task task) {
return null;
}
/**
* 主动推送rtmp
* 输出分析
*/
public Object rtmp() {
return null;
public void outputAnalysisStream(Task task) {
}
/**
* 录像上传
*/
......@@ -116,4 +140,12 @@ public class VAServerService {
return null;
}
/**
* 获取 VAServer 运行状态配置参数等
*/
public Object getVAServerStatus(String devId) {
return null;
}
}
......@@ -21,10 +21,10 @@ spring:
instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address: 192.168.9.146
redis:
host: localhost
host: 192.168.9.233
port: 6379
password: vionredis
database: 2
password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 15
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!