Commit d9f6a1f8 by xmh

修改

1 parent d0a7414b
Showing 42 changed files with 630 additions and 339 deletions
...@@ -26,10 +26,10 @@ spring: ...@@ -26,10 +26,10 @@ spring:
username: root username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
......
...@@ -9,18 +9,34 @@ package com.viontech.fanxing.commons.constant; ...@@ -9,18 +9,34 @@ package com.viontech.fanxing.commons.constant;
public class RedisKeys { public class RedisKeys {
/** 将要被执行的任务的 unid 有序集合,执行时间作为分数 */
public static final String SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET = "scheduling:toBeExecutedTaskUnidSet"; 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"; 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"; 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"; 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"; public static final String SCHEDULING_TASK_VASERVER_MAP = "scheduling:taskVAServerMap";
/** 用来接收 traffic 数据的队列 */
public static final String FORWARD_TRAFFIC_QUEUE = "forward:trafficQueue"; public static final String FORWARD_TRAFFIC_QUEUE = "forward:trafficQueue";
/** 用来接收 flow 数据的队列 */
public static final String FORWARD_FLOW_QUEUE = "forward:flowQueue"; public static final String FORWARD_FLOW_QUEUE = "forward:flowQueue";
/** 用来接收 behavior 数据的队列 */
public static final String FORWARD_BEHAVIOR_QUEUE = "forward:behaviorQueue"; public static final String FORWARD_BEHAVIOR_QUEUE = "forward:behaviorQueue";
/** 用来接收所有数据的队列,用于转发 */
public static final String FORWARD_FORWARD_QUEUE = "forward:forwardQueue"; 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) { public static String getVAServerKeepAliveKey(String devId) {
return devId == null ? "scheduling:keepalive" : "scheduling:keepalive" + ":" + devId; return devId == null ? "scheduling:keepalive" : "scheduling:keepalive" + ":" + devId;
} }
......
...@@ -18,6 +18,8 @@ public class Behavior extends BaseModel { ...@@ -18,6 +18,8 @@ public class Behavior extends BaseModel {
private Date eventTime; private Date eventTime;
private String pics;
private String channelUnid; private String channelUnid;
private String testPicFile; private String testPicFile;
...@@ -32,8 +34,6 @@ public class Behavior extends BaseModel { ...@@ -32,8 +34,6 @@ public class Behavior extends BaseModel {
private String eventData; private String eventData;
private String pics;
private String video; private String video;
public Long getId() { public Long getId() {
...@@ -92,6 +92,14 @@ public class Behavior extends BaseModel { ...@@ -92,6 +92,14 @@ public class Behavior extends BaseModel {
this.eventTime = eventTime; this.eventTime = eventTime;
} }
public String getPics() {
return pics;
}
public void setPics(String pics) {
this.pics = pics == null ? null : pics.trim();
}
public String getChannelUnid() { public String getChannelUnid() {
return channelUnid; return channelUnid;
} }
...@@ -148,14 +156,6 @@ public class Behavior extends BaseModel { ...@@ -148,14 +156,6 @@ public class Behavior extends BaseModel {
this.eventData = eventData == null ? null : eventData.trim(); 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() { public String getVideo() {
return video; return video;
} }
......
...@@ -549,6 +549,76 @@ public class BehaviorExample extends BaseExample { ...@@ -549,6 +549,76 @@ public class BehaviorExample extends BaseExample {
return (Criteria) this; 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() { public Criteria andChannelUnidIsNull() {
addCriterion("`behavior`.channel_unid is null"); addCriterion("`behavior`.channel_unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -941,6 +1011,11 @@ public class BehaviorExample extends BaseExample { ...@@ -941,6 +1011,11 @@ public class BehaviorExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasPicsColumn() {
addColumnStr("`behavior`.pics as behavior_pics ");
return (ColumnContainer) this;
}
public ColumnContainer hasChannelUnidColumn() { public ColumnContainer hasChannelUnidColumn() {
addColumnStr("`behavior`.channel_unid as behavior_channel_unid "); addColumnStr("`behavior`.channel_unid as behavior_channel_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
...@@ -24,7 +24,7 @@ public class FlowEvent extends BaseModel { ...@@ -24,7 +24,7 @@ public class FlowEvent extends BaseModel {
private String locationName; private String locationName;
private String picName; private String pics;
private String videoName; private String videoName;
...@@ -110,12 +110,12 @@ public class FlowEvent extends BaseModel { ...@@ -110,12 +110,12 @@ public class FlowEvent extends BaseModel {
this.locationName = locationName == null ? null : locationName.trim(); this.locationName = locationName == null ? null : locationName.trim();
} }
public String getPicName() { public String getPics() {
return picName; return pics;
} }
public void setPicName(String picName) { public void setPics(String pics) {
this.picName = picName == null ? null : picName.trim(); this.pics = pics == null ? null : pics.trim();
} }
public String getVideoName() { public String getVideoName() {
......
...@@ -759,73 +759,73 @@ public class FlowEventExample extends BaseExample { ...@@ -759,73 +759,73 @@ public class FlowEventExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIsNull() { public Criteria andPicsIsNull() {
addCriterion("`flowEvent`.pic_name is null"); addCriterion("`flowEvent`.pics is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIsNotNull() { public Criteria andPicsIsNotNull() {
addCriterion("`flowEvent`.pic_name is not null"); addCriterion("`flowEvent`.pics is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameEqualTo(String value) { public Criteria andPicsEqualTo(String value) {
addCriterion("`flowEvent`.pic_name =", value, "picName"); addCriterion("`flowEvent`.pics =", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotEqualTo(String value) { public Criteria andPicsNotEqualTo(String value) {
addCriterion("`flowEvent`.pic_name <>", value, "picName"); addCriterion("`flowEvent`.pics <>", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameGreaterThan(String value) { public Criteria andPicsGreaterThan(String value) {
addCriterion("`flowEvent`.pic_name >", value, "picName"); addCriterion("`flowEvent`.pics >", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameGreaterThanOrEqualTo(String value) { public Criteria andPicsGreaterThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pic_name >=", value, "picName"); addCriterion("`flowEvent`.pics >=", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLessThan(String value) { public Criteria andPicsLessThan(String value) {
addCriterion("`flowEvent`.pic_name <", value, "picName"); addCriterion("`flowEvent`.pics <", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLessThanOrEqualTo(String value) { public Criteria andPicsLessThanOrEqualTo(String value) {
addCriterion("`flowEvent`.pic_name <=", value, "picName"); addCriterion("`flowEvent`.pics <=", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLike(String value) { public Criteria andPicsLike(String value) {
addCriterion("`flowEvent`.pic_name like", value, "picName"); addCriterion("`flowEvent`.pics like", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotLike(String value) { public Criteria andPicsNotLike(String value) {
addCriterion("`flowEvent`.pic_name not like", value, "picName"); addCriterion("`flowEvent`.pics not like", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIn(List<String> values) { public Criteria andPicsIn(List<String> values) {
addCriterion("`flowEvent`.pic_name in", values, "picName"); addCriterion("`flowEvent`.pics in", values, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotIn(List<String> values) { public Criteria andPicsNotIn(List<String> values) {
addCriterion("`flowEvent`.pic_name not in", values, "picName"); addCriterion("`flowEvent`.pics not in", values, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameBetween(String value1, String value2) { public Criteria andPicsBetween(String value1, String value2) {
addCriterion("`flowEvent`.pic_name between", value1, value2, "picName"); addCriterion("`flowEvent`.pics between", value1, value2, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotBetween(String value1, String value2) { public Criteria andPicsNotBetween(String value1, String value2) {
addCriterion("`flowEvent`.pic_name not between", value1, value2, "picName"); addCriterion("`flowEvent`.pics not between", value1, value2, "pics");
return (Criteria) this; return (Criteria) this;
} }
...@@ -956,8 +956,8 @@ public class FlowEventExample extends BaseExample { ...@@ -956,8 +956,8 @@ public class FlowEventExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasPicNameColumn() { public ColumnContainer hasPicsColumn() {
addColumnStr("`flowEvent`.pic_name as flowEvent_pic_name "); addColumnStr("`flowEvent`.pics as flowEvent_pics ");
return (ColumnContainer) this; return (ColumnContainer) this;
} }
......
...@@ -56,7 +56,7 @@ public class Traffic extends BaseModel { ...@@ -56,7 +56,7 @@ public class Traffic extends BaseModel {
private Integer withHelmet; private Integer withHelmet;
private String picName; private String pics;
private String videoName; private String videoName;
...@@ -272,12 +272,12 @@ public class Traffic extends BaseModel { ...@@ -272,12 +272,12 @@ public class Traffic extends BaseModel {
this.withHelmet = withHelmet; this.withHelmet = withHelmet;
} }
public String getPicName() { public String getPics() {
return picName; return pics;
} }
public void setPicName(String picName) { public void setPics(String pics) {
this.picName = picName == null ? null : picName.trim(); this.pics = pics == null ? null : pics.trim();
} }
public String getVideoName() { public String getVideoName() {
......
...@@ -1819,73 +1819,73 @@ public class TrafficExample extends BaseExample { ...@@ -1819,73 +1819,73 @@ public class TrafficExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIsNull() { public Criteria andPicsIsNull() {
addCriterion("`traffic`.pic_name is null"); addCriterion("`traffic`.pics is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIsNotNull() { public Criteria andPicsIsNotNull() {
addCriterion("`traffic`.pic_name is not null"); addCriterion("`traffic`.pics is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameEqualTo(String value) { public Criteria andPicsEqualTo(String value) {
addCriterion("`traffic`.pic_name =", value, "picName"); addCriterion("`traffic`.pics =", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotEqualTo(String value) { public Criteria andPicsNotEqualTo(String value) {
addCriterion("`traffic`.pic_name <>", value, "picName"); addCriterion("`traffic`.pics <>", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameGreaterThan(String value) { public Criteria andPicsGreaterThan(String value) {
addCriterion("`traffic`.pic_name >", value, "picName"); addCriterion("`traffic`.pics >", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameGreaterThanOrEqualTo(String value) { public Criteria andPicsGreaterThanOrEqualTo(String value) {
addCriterion("`traffic`.pic_name >=", value, "picName"); addCriterion("`traffic`.pics >=", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLessThan(String value) { public Criteria andPicsLessThan(String value) {
addCriterion("`traffic`.pic_name <", value, "picName"); addCriterion("`traffic`.pics <", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLessThanOrEqualTo(String value) { public Criteria andPicsLessThanOrEqualTo(String value) {
addCriterion("`traffic`.pic_name <=", value, "picName"); addCriterion("`traffic`.pics <=", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameLike(String value) { public Criteria andPicsLike(String value) {
addCriterion("`traffic`.pic_name like", value, "picName"); addCriterion("`traffic`.pics like", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotLike(String value) { public Criteria andPicsNotLike(String value) {
addCriterion("`traffic`.pic_name not like", value, "picName"); addCriterion("`traffic`.pics not like", value, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameIn(List<String> values) { public Criteria andPicsIn(List<String> values) {
addCriterion("`traffic`.pic_name in", values, "picName"); addCriterion("`traffic`.pics in", values, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotIn(List<String> values) { public Criteria andPicsNotIn(List<String> values) {
addCriterion("`traffic`.pic_name not in", values, "picName"); addCriterion("`traffic`.pics not in", values, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameBetween(String value1, String value2) { public Criteria andPicsBetween(String value1, String value2) {
addCriterion("`traffic`.pic_name between", value1, value2, "picName"); addCriterion("`traffic`.pics between", value1, value2, "pics");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPicNameNotBetween(String value1, String value2) { public Criteria andPicsNotBetween(String value1, String value2) {
addCriterion("`traffic`.pic_name not between", value1, value2, "picName"); addCriterion("`traffic`.pics not between", value1, value2, "pics");
return (Criteria) this; return (Criteria) this;
} }
...@@ -2156,8 +2156,8 @@ public class TrafficExample extends BaseExample { ...@@ -2156,8 +2156,8 @@ public class TrafficExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasPicNameColumn() { public ColumnContainer hasPicsColumn() {
addColumnStr("`traffic`.pic_name as traffic_pic_name "); addColumnStr("`traffic`.pics as traffic_pics ");
return (ColumnContainer) this; return (ColumnContainer) this;
} }
......
...@@ -94,6 +94,15 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -94,6 +94,15 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private Date eventTime_lte; private Date eventTime_lte;
@JsonIgnore @JsonIgnore
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> pics_arr;
@JsonIgnore
private String pics_like;
@JsonIgnore
private Boolean channelUnid_null; private Boolean channelUnid_null;
@JsonIgnore @JsonIgnore
...@@ -157,15 +166,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -157,15 +166,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private String eventData_like; private String eventData_like;
@JsonIgnore @JsonIgnore
private Boolean pics_null;
@JsonIgnore
private ArrayList<String> pics_arr;
@JsonIgnore
private String pics_like;
@JsonIgnore
private Boolean video_null; private Boolean video_null;
@JsonIgnore @JsonIgnore
...@@ -516,6 +516,44 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -516,6 +516,44 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventTime(eventTime); 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() { public Boolean getChannelUnid_null() {
return channelUnid_null; return channelUnid_null;
} }
...@@ -782,44 +820,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> { ...@@ -782,44 +820,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this.getModel().setEventData(eventData); 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() { public Boolean getVideo_null() {
return video_null; return video_null;
} }
......
...@@ -121,13 +121,13 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -121,13 +121,13 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
private String locationName_like; private String locationName_like;
@JsonIgnore @JsonIgnore
private Boolean picName_null; private Boolean pics_null;
@JsonIgnore @JsonIgnore
private ArrayList<String> picName_arr; private ArrayList<String> pics_arr;
@JsonIgnore @JsonIgnore
private String picName_like; private String pics_like;
@JsonIgnore @JsonIgnore
private Boolean videoName_null; private Boolean videoName_null;
...@@ -603,42 +603,42 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent> ...@@ -603,42 +603,42 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
this.getModel().setLocationName(locationName); this.getModel().setLocationName(locationName);
} }
public Boolean getPicName_null() { public Boolean getPics_null() {
return picName_null; return pics_null;
} }
public void setPicName_null(Boolean picName_null) { public void setPics_null(Boolean pics_null) {
this.picName_null = picName_null; this.pics_null = pics_null;
} }
public ArrayList<String> getPicName_arr() { public ArrayList<String> getPics_arr() {
return picName_arr; return pics_arr;
} }
public void setPicName_arr(ArrayList<String> picName_arr) { public void setPics_arr(ArrayList<String> pics_arr) {
this.picName_arr = picName_arr; this.pics_arr = pics_arr;
} }
public String getPicName_like() { public String getPics_like() {
return picName_like; return pics_like;
} }
public void setPicName_like(String picName_like) { public void setPics_like(String pics_like) {
this.picName_like = picName_like; this.pics_like = pics_like;
} }
public String getPicName() { public String getPics() {
if(getModel() == null ){ if(getModel() == null ){
throw new RuntimeException("model is 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 ){ if(getModel() == null ){
throw new RuntimeException("model is null"); throw new RuntimeException("model is null");
} }
this.getModel().setPicName(picName); this.getModel().setPics(pics);
} }
public Boolean getVideoName_null() { public Boolean getVideoName_null() {
......
...@@ -316,13 +316,13 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -316,13 +316,13 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
private Integer withHelmet_lte; private Integer withHelmet_lte;
@JsonIgnore @JsonIgnore
private Boolean picName_null; private Boolean pics_null;
@JsonIgnore @JsonIgnore
private ArrayList<String> picName_arr; private ArrayList<String> pics_arr;
@JsonIgnore @JsonIgnore
private String picName_like; private String pics_like;
@JsonIgnore @JsonIgnore
private Boolean videoName_null; private Boolean videoName_null;
...@@ -1557,42 +1557,42 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> { ...@@ -1557,42 +1557,42 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
this.getModel().setWithHelmet(withHelmet); this.getModel().setWithHelmet(withHelmet);
} }
public Boolean getPicName_null() { public Boolean getPics_null() {
return picName_null; return pics_null;
} }
public void setPicName_null(Boolean picName_null) { public void setPics_null(Boolean pics_null) {
this.picName_null = picName_null; this.pics_null = pics_null;
} }
public ArrayList<String> getPicName_arr() { public ArrayList<String> getPics_arr() {
return picName_arr; return pics_arr;
} }
public void setPicName_arr(ArrayList<String> picName_arr) { public void setPics_arr(ArrayList<String> pics_arr) {
this.picName_arr = picName_arr; this.pics_arr = pics_arr;
} }
public String getPicName_like() { public String getPics_like() {
return picName_like; return pics_like;
} }
public void setPicName_like(String picName_like) { public void setPics_like(String pics_like) {
this.picName_like = picName_like; this.pics_like = pics_like;
} }
public String getPicName() { public String getPics() {
if(getModel() == null ){ if(getModel() == null ){
throw new RuntimeException("model is 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 ){ if(getModel() == null ){
throw new RuntimeException("model is null"); throw new RuntimeException("model is null");
} }
this.getModel().setPicName(picName); this.getModel().setPics(pics);
} }
public Boolean getVideoName_null() { public Boolean getVideoName_null() {
......
...@@ -7,15 +7,15 @@ singleServerConfig: ...@@ -7,15 +7,15 @@ singleServerConfig:
timeout: 3000 timeout: 3000
retryAttempts: 3 retryAttempts: 3
retryInterval: 1500 retryInterval: 1500
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
subscriptionsPerConnection: 5 subscriptionsPerConnection: 5
clientName: null clientName: null
address: "redis://127.0.0.1:6379" address: "redis://192.168.9.233:6379"
subscriptionConnectionMinimumIdleSize: 1 subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50 subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 32 connectionMinimumIdleSize: 32
connectionPoolSize: 64 connectionPoolSize: 64
database: 2 database: 15
dnsMonitoringInterval: 5000 dnsMonitoringInterval: 5000
# 集群配置 # 集群配置
#clusterServersConfig: #clusterServersConfig:
......
...@@ -33,6 +33,8 @@ import java.util.concurrent.TimeUnit; ...@@ -33,6 +33,8 @@ import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
public class ForwardApp { 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) { public static void main(String[] args) {
try { try {
SpringApplication.run(ForwardApp.class, args); SpringApplication.run(ForwardApp.class, args);
...@@ -41,8 +43,6 @@ public class ForwardApp { ...@@ -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 @Bean
public TaskExecutor taskExecutor() { public TaskExecutor taskExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
......
package com.viontech.fanxing.forward.batch.configuration; package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.commons.model.Behavior; import com.viontech.fanxing.commons.model.Behavior;
...@@ -8,6 +7,8 @@ import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener ...@@ -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.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener; import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener;
import com.viontech.fanxing.forward.batch.processor.BehaviorProcessor; 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.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader; import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient; ...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step; import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; 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.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.*;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus; import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport; import org.springframework.batch.repeat.policy.CompletionPolicySupport;
...@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource; import java.util.LinkedList;
/** /**
* . * .
...@@ -58,7 +58,7 @@ public class BehaviorJobConfiguration { ...@@ -58,7 +58,7 @@ public class BehaviorJobConfiguration {
} }
@Bean(name = "behaviorStep") @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(); RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() { stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override @Override
...@@ -76,13 +76,14 @@ public class BehaviorJobConfiguration { ...@@ -76,13 +76,14 @@ public class BehaviorJobConfiguration {
.listener(new ExecutionContextClearListener()) .listener(new ExecutionContextClearListener())
.<JSONObject, Behavior>chunk(1) .<JSONObject, Behavior>chunk(1)
.reader(behaviorReader) .reader(behaviorReader)
.processor(behaviorProcessor) .processor(behaviorProcessorCompose)
.writer(behaviorWriter) .writer(behaviorWriter)
.stepOperations(stepOperations) .stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener()) .listener(new WorkQueueClearChunkListener())
.build(); .build();
} }
@Bean(name = "behaviorReader") @Bean(name = "behaviorReader")
public ItemReader<JSONObject> behaviorReader(RedissonClient redissonClient, @Value("${spring.cloud.consul.discovery.instance-id}") String instanceId) { public ItemReader<JSONObject> behaviorReader(RedissonClient redissonClient, @Value("${spring.cloud.consul.discovery.instance-id}") String instanceId) {
return new ConcurrencyReader<JSONObject>() { return new ConcurrencyReader<JSONObject>() {
...@@ -97,4 +98,16 @@ public class BehaviorJobConfiguration { ...@@ -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; package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener; import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
...@@ -15,9 +14,11 @@ import org.redisson.api.RedissonClient; ...@@ -15,9 +14,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step; import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; 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.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader; import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ItemWriter;
...@@ -30,8 +31,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -30,8 +31,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
/** /**
* . * .
* *
...@@ -92,27 +91,10 @@ public class ForwardJobConfiguration { ...@@ -92,27 +91,10 @@ public class ForwardJobConfiguration {
RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>(); RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>();
redisPopReader.setRedissonClient(redissonClient); redisPopReader.setRedissonClient(redissonClient);
redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH); redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH);
redisPopReader.setKey(RedisKeys.FORWARD_BEHAVIOR_QUEUE); redisPopReader.setKey(RedisKeys.FORWARD_FORWARD_QUEUE);
redisPopReader.setInstanceId(instanceId); redisPopReader.setInstanceId(instanceId);
return redisPopReader; 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; package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener; import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
import com.viontech.fanxing.forward.batch.listener.JobRestartListener; import com.viontech.fanxing.forward.batch.listener.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener; 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.processor.TrafficFlowProcessor;
import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader; import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader; import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient; ...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step; import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; 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.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.*;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus; import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport; import org.springframework.batch.repeat.policy.CompletionPolicySupport;
...@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource; import java.util.LinkedList;
/** /**
* . * .
...@@ -58,7 +58,7 @@ public class TrafficFlowJobConfiguration { ...@@ -58,7 +58,7 @@ public class TrafficFlowJobConfiguration {
} }
@Bean(name = "trafficFlowStep") @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(); RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() { stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override @Override
...@@ -76,7 +76,7 @@ public class TrafficFlowJobConfiguration { ...@@ -76,7 +76,7 @@ public class TrafficFlowJobConfiguration {
.listener(new ExecutionContextClearListener()) .listener(new ExecutionContextClearListener())
.<JSONObject, TrafficFlowContent>chunk(1) .<JSONObject, TrafficFlowContent>chunk(1)
.reader(trafficFlowReader) .reader(trafficFlowReader)
.processor(trafficFlowProcessor) .processor(trafficFlowProcessorCompose)
.writer(trafficFlowWriter) .writer(trafficFlowWriter)
.stepOperations(stepOperations) .stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener()) .listener(new WorkQueueClearChunkListener())
...@@ -91,10 +91,22 @@ public class TrafficFlowJobConfiguration { ...@@ -91,10 +91,22 @@ public class TrafficFlowJobConfiguration {
RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>(); RedisPopReader<JSONObject> redisPopReader = new RedisPopReader<>();
redisPopReader.setRedissonClient(redissonClient); redisPopReader.setRedissonClient(redissonClient);
redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH); redisPopReader.setPopType(RedisPopReader.POP_TYPE_RPOPLPUSH);
redisPopReader.setKey(RedisKeys.FORWARD_BEHAVIOR_QUEUE); redisPopReader.setKey(RedisKeys.FORWARD_FLOW_QUEUE);
redisPopReader.setInstanceId(instanceId); redisPopReader.setInstanceId(instanceId);
return redisPopReader; 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; package com.viontech.fanxing.forward.batch.configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.constant.RedisKeys; import com.viontech.fanxing.commons.constant.RedisKeys;
import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener; import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener;
import com.viontech.fanxing.forward.batch.listener.JobRestartListener; import com.viontech.fanxing.forward.batch.listener.JobRestartListener;
import com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener; 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.processor.TrafficProcessor;
import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader; import com.viontech.fanxing.forward.batch.reader.ConcurrencyReader;
import com.viontech.fanxing.forward.batch.reader.RedisPopReader; import com.viontech.fanxing.forward.batch.reader.RedisPopReader;
...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient; ...@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step; import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; 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.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer; import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.*;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus; import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.batch.repeat.policy.CompletionPolicySupport; import org.springframework.batch.repeat.policy.CompletionPolicySupport;
...@@ -30,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -30,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.LinkedList;
/** /**
* . * .
* *
...@@ -57,7 +59,7 @@ public class TrafficJobConfiguration { ...@@ -57,7 +59,7 @@ public class TrafficJobConfiguration {
} }
@Bean(name = "trafficStep") @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(); RepeatTemplate stepOperations = new RepeatTemplate();
stepOperations.setCompletionPolicy(new CompletionPolicySupport() { stepOperations.setCompletionPolicy(new CompletionPolicySupport() {
@Override @Override
...@@ -75,7 +77,7 @@ public class TrafficJobConfiguration { ...@@ -75,7 +77,7 @@ public class TrafficJobConfiguration {
.listener(new ExecutionContextClearListener()) .listener(new ExecutionContextClearListener())
.<JSONObject, TrafficContent>chunk(1) .<JSONObject, TrafficContent>chunk(1)
.reader(trafficReader) .reader(trafficReader)
.processor(trafficProcessor) .processor(trafficProcessorCompose)
.writer(trafficWriter) .writer(trafficWriter)
.stepOperations(stepOperations) .stepOperations(stepOperations)
.listener(new WorkQueueClearChunkListener()) .listener(new WorkQueueClearChunkListener())
...@@ -96,4 +98,16 @@ public class TrafficJobConfiguration { ...@@ -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, ...@@ -31,6 +31,8 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
@Override @Override
public Behavior process(JSONObject item) throws Exception { public Behavior process(JSONObject item) throws Exception {
log.info("收到 behavior 消息 , eventId:{}",item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap(); // final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id"); // String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid); // final Task task = taskMap.get(taskUnid);
...@@ -54,6 +56,7 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject, ...@@ -54,6 +56,7 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
JSONArray video = item.getJSONArray("video"); JSONArray video = item.getJSONArray("video");
JSONArray pics = item.getJSONArray("pics"); JSONArray pics = item.getJSONArray("pics");
JSONObject auxDevInfo = item.getJSONObject("aux_dev_info"); JSONObject auxDevInfo = item.getJSONObject("aux_dev_info");
String picArray = item.getString("pic_path_array");
behavior.setEventType(eventType); behavior.setEventType(eventType);
behavior.setEventRefid(eventRefid); behavior.setEventRefid(eventRefid);
...@@ -61,10 +64,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject, ...@@ -61,10 +64,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
behavior.setEventCate(eventCate); behavior.setEventCate(eventCate);
behavior.setChannelUnid(channelUnid); behavior.setChannelUnid(channelUnid);
behavior.setTaskName(taskName); behavior.setTaskName(taskName);
behavior.setPics(picArray);
behavior.setEventData(eventData == null ? null : eventData.toJSONString()); behavior.setEventData(eventData == null ? null : eventData.toJSONString());
behavior.setVideo(video == null ? null : video.toJSONString()); behavior.setVideo(video == null ? null : video.toJSONString());
behavior.setPics(pics == null ? null : pics.toJSONString());
behavior.setAuxDevInfo(auxDevInfo == null ? null : auxDevInfo.toJSONString()); behavior.setAuxDevInfo(auxDevInfo == null ? null : auxDevInfo.toJSONString());
return behavior; 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; ...@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.FlowData; import com.viontech.fanxing.commons.model.FlowData;
import com.viontech.fanxing.commons.model.FlowEvent; 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.model.TrafficFlowContent;
import com.viontech.fanxing.forward.util.CacheUtils; import com.viontech.fanxing.forward.util.CacheUtils;
import com.viontech.keliu.util.DateUtil; import com.viontech.keliu.util.DateUtil;
...@@ -19,7 +18,6 @@ import javax.annotation.Resource; ...@@ -19,7 +18,6 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* . * .
...@@ -36,6 +34,8 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl ...@@ -36,6 +34,8 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
@Override @Override
public TrafficFlowContent process(JSONObject item) throws Exception { public TrafficFlowContent process(JSONObject item) throws Exception {
log.info("收到 flow 消息 , eventId:{}", item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap(); // final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id"); // String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid); // final Task task = taskMap.get(taskUnid);
...@@ -56,11 +56,13 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl ...@@ -56,11 +56,13 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
String eventType = item.getString("event_type"); String eventType = item.getString("event_type");
String eventRefid = item.getString("event_refid"); String eventRefid = item.getString("event_refid");
String eventDt = item.getString("event_dt"); String eventDt = item.getString("event_dt");
String picArray = item.getString("pic_path_array");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt); Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
flowEvent.setEventType(eventType); flowEvent.setEventType(eventType);
flowEvent.setEventId(eventRefid); flowEvent.setEventId(eventRefid);
flowEvent.setEventTime(eventTime); flowEvent.setEventTime(eventTime);
flowEvent.setPics(picArray);
// flowEvent.setTaskId(taskId); // flowEvent.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data"); JSONObject eventData = item.getJSONObject("event_data");
...@@ -89,7 +91,7 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl ...@@ -89,7 +91,7 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
flowDataList.addAll(getFlowData(eventTime, taskId, "xcycle", eventData)); flowDataList.addAll(getFlowData(eventTime, taskId, "xcycle", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "pedestrian", eventData)); flowDataList.addAll(getFlowData(eventTime, taskId, "pedestrian", eventData));
flowDataList.addAll(getFlowData(eventTime, taskId, "density", 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; ...@@ -2,7 +2,6 @@ package com.viontech.fanxing.forward.batch.processor;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.Traffic;
import com.viontech.fanxing.commons.model.TrafficFace; import com.viontech.fanxing.commons.model.TrafficFace;
import com.viontech.fanxing.forward.model.TrafficContent; import com.viontech.fanxing.forward.model.TrafficContent;
...@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component; ...@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* . * .
...@@ -36,6 +34,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -36,6 +34,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
@Override @Override
public TrafficContent process(JSONObject item) throws Exception { public TrafficContent process(JSONObject item) throws Exception {
log.info("收到 traffic 消息 , eventId:{}", item.getString("event_refid"));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap(); // final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// //
// String taskUnid = item.getString("task_id"); // String taskUnid = item.getString("task_id");
...@@ -59,6 +58,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -59,6 +58,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
String eventDt = item.getString("event_dt"); String eventDt = item.getString("event_dt");
Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt); Date eventTime = DateUtil.parse(DateUtil.FORMAT_FULL, eventDt);
String channelUnid = item.getString("vchan_refid"); String channelUnid = item.getString("vchan_refid");
String picArray = item.getString("pic_path_array");
// todo taskId // todo taskId
traffic.setEventCate(eventCate); traffic.setEventCate(eventCate);
...@@ -66,6 +66,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -66,6 +66,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
traffic.setEventId(eventRefid); traffic.setEventId(eventRefid);
traffic.setEventDt(eventTime); traffic.setEventDt(eventTime);
traffic.setChannelUnid(channelUnid); traffic.setChannelUnid(channelUnid);
traffic.setPics(picArray);
// traffic.setTaskId(taskId); // traffic.setTaskId(taskId);
JSONObject eventData = item.getJSONObject("event_data"); JSONObject eventData = item.getJSONObject("event_data");
...@@ -169,12 +170,12 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten ...@@ -169,12 +170,12 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
trafficFace.setState(state); trafficFace.setState(state);
JSONObject upbody = faceData.getJSONObject("upbody"); JSONObject upbody = faceData.getJSONObject("upbody");
if (upbody != null) { if (upbody != null) {
String upperColor = upbody.getString("color"); String upperColor = upbody.getString("code");
trafficFace.setUpperColor(upperColor); trafficFace.setUpperColor(upperColor);
} }
JSONObject lobody = faceData.getJSONObject("lobody"); JSONObject lobody = faceData.getJSONObject("lobody");
if (lobody != null) { if (lobody != null) {
String lowerColor = lobody.getString("color"); String lowerColor = lobody.getString("code");
trafficFace.setLowerColor(lowerColor); trafficFace.setLowerColor(lowerColor);
} }
trafficFaces.add(trafficFace); trafficFaces.add(trafficFace);
......
...@@ -30,6 +30,5 @@ public class BehaviorWriter implements ItemWriter<Behavior> { ...@@ -30,6 +30,5 @@ public class BehaviorWriter implements ItemWriter<Behavior> {
public void write(List<? extends Behavior> items) throws Exception { public void write(List<? extends Behavior> items) throws Exception {
SqlParameterSource[] batchParam = SqlParameterSourceUtils.createBatch(items); SqlParameterSource[] batchParam = SqlParameterSourceUtils.createBatch(items);
namedParameterJdbcTemplate.batchUpdate(INSERT_BEHAVIOR, batchParam); namedParameterJdbcTemplate.batchUpdate(INSERT_BEHAVIOR, batchParam);
} }
} }
...@@ -24,8 +24,8 @@ import java.util.List; ...@@ -24,8 +24,8 @@ import java.util.List;
public class TrafficFlowWriter implements ItemWriter<TrafficFlowContent> { public class TrafficFlowWriter implements ItemWriter<TrafficFlowContent> {
private final static String INSERT_FLOW_EVENT = "insert into d_flow_event (" + 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(" + "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,:picName,:videoName)"; ":taskId,:eventType,:eventTime,:eventId,:deviceCode,:deviceName,:locationCode,:locationName,:jsonData,:pics,:videoName)";
private final static String INSERT_FLOW_DATA = "insert into d_flow_data (" + 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 (" + "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)"; ":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; 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.commons.model.TrafficFace;
import com.viontech.fanxing.forward.model.TrafficContent; import com.viontech.fanxing.forward.model.TrafficContent;
import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ItemWriter;
...@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component; ...@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* . * .
...@@ -24,8 +26,8 @@ import java.util.List; ...@@ -24,8 +26,8 @@ import java.util.List;
public class TrafficWriter implements ItemWriter<TrafficContent> { public class TrafficWriter implements ItemWriter<TrafficContent> {
private final static String INSERT_TRAFFIC = "insert into d_traffic (" + private final static String INSERT_TRAFFIC = "insert into d_traffic (" +
"event_cate,event_type,event_dt,channel_unid,plate_color,plate_number,location_code,location_name,lane_code,direction_code,vehicle_type,vehicle_color,vehicle_logo,illegal_code,illegal_state,feature_annual_inspection_mark,feature_pendant,feature_decoration,feature_sun_shield,xcycle_type,event_id,special_type,with_helmet,json_data,pic_name,video_name) values(" + "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,:picName,:videoName)"; ":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 (" + private final static String INSERT_TRAFFIC_FACE = "insert into d_traffic_face (" +
"traffic_id,state,sex,upper_color,lower_color) values (:trafficId,:state,:sex,:upperColor,:lowerColor)"; "traffic_id,state,sex,upper_color,lower_color) values (:trafficId,:state,:sex,:upperColor,:lowerColor)";
...@@ -55,7 +57,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> { ...@@ -55,7 +57,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
} }
for (TrafficContent item : list) { for (TrafficContent item : list) {
List<TrafficFace> trafficFaces = item.getTrafficFaces(); List<TrafficFace> trafficFaces = item.getTrafficFaces();
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(item); Traffic traffic = item.getTraffic();
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(traffic);
SqlParameterSource param = batch[0]; SqlParameterSource param = batch[0];
GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder(); GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();
namedParameterJdbcTemplate.update(INSERT_TRAFFIC, param, generatedKeyHolder); namedParameterJdbcTemplate.update(INSERT_TRAFFIC, param, generatedKeyHolder);
...@@ -73,7 +76,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> { ...@@ -73,7 +76,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
return; 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); 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: ...@@ -22,14 +22,14 @@ spring:
ip-address: 192.168.9.146 ip-address: 192.168.9.146
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver 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 username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
...@@ -48,6 +48,8 @@ pagehelper: ...@@ -48,6 +48,8 @@ pagehelper:
supportMethodsArguments: true supportMethodsArguments: true
params: count=countByExample params: count=countByExample
vion: vion:
pic:
path: G:\data
redisson: redisson:
path: F:\myIDEAworkspace\jt\fanxing3\fanxing-commons\src\main\resources\redisson.yml path: F:\myIDEAworkspace\jt\fanxing3\fanxing-commons\src\main\resources\redisson.yml
debug: true debug: true
\ No newline at end of file \ No newline at end of file
...@@ -37,10 +37,10 @@ spring: ...@@ -37,10 +37,10 @@ spring:
username: root username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
......
...@@ -26,10 +26,10 @@ spring: ...@@ -26,10 +26,10 @@ spring:
username: root username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
......
package com.viontech.fanxing.query; package com.viontech.fanxing.query;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
...@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling @EnableScheduling
@SpringBootApplication(scanBasePackages = "com.viontech.fanxing") @SpringBootApplication(scanBasePackages = "com.viontech.fanxing")
@EnableFeignClients @EnableFeignClients
@MapperScan(basePackages = "com.viontech.fanxing.query.mapper")
@Slf4j @Slf4j
public class QueryApp { public class QueryApp {
......
...@@ -4,11 +4,11 @@ import com.viontech.fanxing.commons.base.BaseController; ...@@ -4,11 +4,11 @@ import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.commons.base.BaseExample; import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper; import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseService; 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.Behavior;
import com.viontech.fanxing.commons.model.BehaviorExample; 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.commons.vo.BehaviorVo;
import com.viontech.fanxing.query.mapper.BehaviorMapper;
import com.viontech.fanxing.query.service.adapter.BehaviorService;
import javax.annotation.Resource; import javax.annotation.Resource;
public abstract class BehaviorBaseController extends BaseController<Behavior, BehaviorVo> { public abstract class BehaviorBaseController extends BaseController<Behavior, BehaviorVo> {
...@@ -144,6 +144,22 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be ...@@ -144,6 +144,22 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getEventTime_lte() != null) { if(behaviorVo.getEventTime_lte() != null) {
criteria.andEventTimeLessThanOrEqualTo(behaviorVo.getEventTime_lte()); 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) { if(behaviorVo.getChannelUnid() != null) {
criteria.andChannelUnidEqualTo(behaviorVo.getChannelUnid()); criteria.andChannelUnidEqualTo(behaviorVo.getChannelUnid());
} }
...@@ -224,7 +240,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be ...@@ -224,7 +240,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if(behaviorVo.getEventDataNum_like() != null) { if(behaviorVo.getEventDataNum_like() != null) {
criteria.andEventDataNumLike(behaviorVo.getEventDataNum_like()); criteria.andEventDataNumLike(behaviorVo.getEventDataNum_like());
} }
return behaviorExample; return behaviorExample;
} }
......
...@@ -192,21 +192,21 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent, ...@@ -192,21 +192,21 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getLocationName_like() != null) { if(flowEventVo.getLocationName_like() != null) {
criteria.andLocationNameLike(flowEventVo.getLocationName_like()); criteria.andLocationNameLike(flowEventVo.getLocationName_like());
} }
if(flowEventVo.getPicName() != null) { if(flowEventVo.getPics() != null) {
criteria.andPicNameEqualTo(flowEventVo.getPicName()); criteria.andPicsEqualTo(flowEventVo.getPics());
} }
if(flowEventVo.getPicName_null() != null) { if(flowEventVo.getPics_null() != null) {
if(flowEventVo.getPicName_null().booleanValue()) { if(flowEventVo.getPics_null().booleanValue()) {
criteria.andPicNameIsNull(); criteria.andPicsIsNull();
} else { } else {
criteria.andPicNameIsNotNull(); criteria.andPicsIsNotNull();
} }
} }
if(flowEventVo.getPicName_arr() != null) { if(flowEventVo.getPics_arr() != null) {
criteria.andPicNameIn(flowEventVo.getPicName_arr()); criteria.andPicsIn(flowEventVo.getPics_arr());
} }
if(flowEventVo.getPicName_like() != null) { if(flowEventVo.getPics_like() != null) {
criteria.andPicNameLike(flowEventVo.getPicName_like()); criteria.andPicsLike(flowEventVo.getPics_like());
} }
if(flowEventVo.getVideoName() != null) { if(flowEventVo.getVideoName() != null) {
criteria.andVideoNameEqualTo(flowEventVo.getVideoName()); criteria.andVideoNameEqualTo(flowEventVo.getVideoName());
...@@ -224,6 +224,7 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent, ...@@ -224,6 +224,7 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if(flowEventVo.getVideoName_like() != null) { if(flowEventVo.getVideoName_like() != null) {
criteria.andVideoNameLike(flowEventVo.getVideoName_like()); criteria.andVideoNameLike(flowEventVo.getVideoName_like());
} }
return flowEventExample; return flowEventExample;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<result column="behavior_event_cate" property="eventCate" /> <result column="behavior_event_cate" property="eventCate" />
<result column="behavior_event_refid" property="eventRefid" /> <result column="behavior_event_refid" property="eventRefid" />
<result column="behavior_event_time" property="eventTime" /> <result column="behavior_event_time" property="eventTime" />
<result column="behavior_pics" property="pics" />
<result column="behavior_channel_unid" property="channelUnid" /> <result column="behavior_channel_unid" property="channelUnid" />
<result column="behavior_test_pic_file" property="testPicFile" /> <result column="behavior_test_pic_file" property="testPicFile" />
<result column="behavior_test_frame_no" property="testFrameNo" /> <result column="behavior_test_frame_no" property="testFrameNo" />
...@@ -19,7 +20,6 @@ ...@@ -19,7 +20,6 @@
<resultMap id="ResultMapWithBLOBs" type="com.viontech.fanxing.commons.model.Behavior" extends="BaseResultMap" > <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_aux_dev_info" property="auxDevInfo" jdbcType="LONGVARCHAR" />
<result column="behavior_event_data" property="eventData" 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" /> <result column="behavior_video" property="video" jdbcType="LONGVARCHAR" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause" > <sql id="Example_Where_Clause" >
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
`behavior`.id as behavior_id, `behavior`.unid as behavior_unid, `behavior`.task_id as behavior_task_id, `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_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`.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`.pics as behavior_pics, `behavior`.channel_unid as behavior_channel_unid,
`behavior`.test_frame_no as behavior_test_frame_no, `behavior`.task_name as behavior_task_name, `behavior`.test_pic_file as behavior_test_pic_file, `behavior`.test_frame_no as behavior_test_frame_no,
`behavior`.event_data_num as behavior_event_data_num `behavior`.task_name as behavior_task_name, `behavior`.event_data_num as behavior_event_data_num
</sql> </sql>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'BehaviorExample')" > <if test="!(_parameter.getClass().getSimpleName() == 'BehaviorExample')" >
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</sql> </sql>
<sql id="Blob_Column_List" > <sql id="Blob_Column_List" >
`behavior`.aux_dev_info as behavior_aux_dev_info, `behavior`.event_data as behavior_event_data, `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> </sql>
<select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.viontech.fanxing.commons.model.BehaviorExample" > <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.viontech.fanxing.commons.model.BehaviorExample" >
select select
...@@ -168,15 +168,15 @@ ...@@ -168,15 +168,15 @@
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.Behavior" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <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, insert into `d_behavior` (unid, task_id, event_type,
event_cate, event_refid, event_time, event_cate, event_refid, event_time,
channel_unid, test_pic_file, test_frame_no, pics, channel_unid, test_pic_file,
task_name, event_data_num, aux_dev_info, test_frame_no, task_name, event_data_num,
event_data, pics, video aux_dev_info, event_data, video
) )
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR}, values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventCate,jdbcType=VARCHAR}, #{eventRefid,jdbcType=VARCHAR}, #{eventTime,jdbcType=TIMESTAMP}, #{eventCate,jdbcType=VARCHAR}, #{eventRefid,jdbcType=VARCHAR}, #{eventTime,jdbcType=TIMESTAMP},
#{channelUnid,jdbcType=VARCHAR}, #{testPicFile,jdbcType=VARCHAR}, #{testFrameNo,jdbcType=VARCHAR}, #{pics,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR}, #{testPicFile,jdbcType=VARCHAR},
#{taskName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=VARCHAR}, #{auxDevInfo,jdbcType=LONGVARCHAR}, #{testFrameNo,jdbcType=VARCHAR}, #{taskName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=VARCHAR},
#{eventData,jdbcType=LONGVARCHAR}, #{pics,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR} #{auxDevInfo,jdbcType=LONGVARCHAR}, #{eventData,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Behavior" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Behavior" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
...@@ -200,6 +200,9 @@ ...@@ -200,6 +200,9 @@
<if test="eventTime != null" > <if test="eventTime != null" >
event_time, event_time,
</if> </if>
<if test="pics != null" >
pics,
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
channel_unid, channel_unid,
</if> </if>
...@@ -221,9 +224,6 @@ ...@@ -221,9 +224,6 @@
<if test="eventData != null" > <if test="eventData != null" >
event_data, event_data,
</if> </if>
<if test="pics != null" >
pics,
</if>
<if test="video != null" > <if test="video != null" >
video, video,
</if> </if>
...@@ -247,6 +247,9 @@ ...@@ -247,6 +247,9 @@
<if test="eventTime != null" > <if test="eventTime != null" >
#{eventTime,jdbcType=TIMESTAMP}, #{eventTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="pics != null" >
#{pics,jdbcType=VARCHAR},
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
#{channelUnid,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -268,9 +271,6 @@ ...@@ -268,9 +271,6 @@
<if test="eventData != null" > <if test="eventData != null" >
#{eventData,jdbcType=LONGVARCHAR}, #{eventData,jdbcType=LONGVARCHAR},
</if> </if>
<if test="pics != null" >
#{pics,jdbcType=LONGVARCHAR},
</if>
<if test="video != null" > <if test="video != null" >
#{video,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -306,6 +306,9 @@ ...@@ -306,6 +306,9 @@
<if test="record.eventTime != null" > <if test="record.eventTime != null" >
event_time = #{record.eventTime,jdbcType=TIMESTAMP}, event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=VARCHAR},
</if>
<if test="record.channelUnid != null" > <if test="record.channelUnid != null" >
channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -327,9 +330,6 @@ ...@@ -327,9 +330,6 @@
<if test="record.eventData != null" > <if test="record.eventData != null" >
event_data = #{record.eventData,jdbcType=LONGVARCHAR}, event_data = #{record.eventData,jdbcType=LONGVARCHAR},
</if> </if>
<if test="record.pics != null" >
pics = #{record.pics,jdbcType=LONGVARCHAR},
</if>
<if test="record.video != null" > <if test="record.video != null" >
video = #{record.video,jdbcType=LONGVARCHAR}, video = #{record.video,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -347,6 +347,7 @@ ...@@ -347,6 +347,7 @@
`behavior`.event_cate = #{record.eventCate,jdbcType=VARCHAR}, `behavior`.event_cate = #{record.eventCate,jdbcType=VARCHAR},
`behavior`.event_refid = #{record.eventRefid,jdbcType=VARCHAR}, `behavior`.event_refid = #{record.eventRefid,jdbcType=VARCHAR},
`behavior`.event_time = #{record.eventTime,jdbcType=TIMESTAMP}, `behavior`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`behavior`.pics = #{record.pics,jdbcType=VARCHAR},
`behavior`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, `behavior`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
`behavior`.test_pic_file = #{record.testPicFile,jdbcType=VARCHAR}, `behavior`.test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
`behavior`.test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR}, `behavior`.test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
...@@ -354,7 +355,6 @@ ...@@ -354,7 +355,6 @@
`behavior`.event_data_num = #{record.eventDataNum,jdbcType=VARCHAR}, `behavior`.event_data_num = #{record.eventDataNum,jdbcType=VARCHAR},
`behavior`.aux_dev_info = #{record.auxDevInfo,jdbcType=LONGVARCHAR}, `behavior`.aux_dev_info = #{record.auxDevInfo,jdbcType=LONGVARCHAR},
`behavior`.event_data = #{record.eventData,jdbcType=LONGVARCHAR}, `behavior`.event_data = #{record.eventData,jdbcType=LONGVARCHAR},
`behavior`.pics = #{record.pics,jdbcType=LONGVARCHAR},
`behavior`.video = #{record.video,jdbcType=LONGVARCHAR} `behavior`.video = #{record.video,jdbcType=LONGVARCHAR}
<if test="_parameter != null" > <if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -369,6 +369,7 @@ ...@@ -369,6 +369,7 @@
event_cate = #{record.eventCate,jdbcType=VARCHAR}, event_cate = #{record.eventCate,jdbcType=VARCHAR},
event_refid = #{record.eventRefid,jdbcType=VARCHAR}, event_refid = #{record.eventRefid,jdbcType=VARCHAR},
event_time = #{record.eventTime,jdbcType=TIMESTAMP}, event_time = #{record.eventTime,jdbcType=TIMESTAMP},
pics = #{record.pics,jdbcType=VARCHAR},
channel_unid = #{record.channelUnid,jdbcType=VARCHAR}, channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
test_pic_file = #{record.testPicFile,jdbcType=VARCHAR}, test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR}, test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
...@@ -399,6 +400,9 @@ ...@@ -399,6 +400,9 @@
<if test="eventTime != null" > <if test="eventTime != null" >
event_time = #{eventTime,jdbcType=TIMESTAMP}, event_time = #{eventTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="pics != null" >
pics = #{pics,jdbcType=VARCHAR},
</if>
<if test="channelUnid != null" > <if test="channelUnid != null" >
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -420,9 +424,6 @@ ...@@ -420,9 +424,6 @@
<if test="eventData != null" > <if test="eventData != null" >
event_data = #{eventData,jdbcType=LONGVARCHAR}, event_data = #{eventData,jdbcType=LONGVARCHAR},
</if> </if>
<if test="pics != null" >
pics = #{pics,jdbcType=LONGVARCHAR},
</if>
<if test="video != null" > <if test="video != null" >
video = #{video,jdbcType=LONGVARCHAR}, video = #{video,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -437,6 +438,7 @@ ...@@ -437,6 +438,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR}, event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR}, event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP}, event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR}, test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR}, test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
...@@ -444,7 +446,6 @@ ...@@ -444,7 +446,6 @@
event_data_num = #{eventDataNum,jdbcType=VARCHAR}, event_data_num = #{eventDataNum,jdbcType=VARCHAR},
aux_dev_info = #{auxDevInfo,jdbcType=LONGVARCHAR}, aux_dev_info = #{auxDevInfo,jdbcType=LONGVARCHAR},
event_data = #{eventData,jdbcType=LONGVARCHAR}, event_data = #{eventData,jdbcType=LONGVARCHAR},
pics = #{pics,jdbcType=LONGVARCHAR},
video = #{video,jdbcType=LONGVARCHAR} video = #{video,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -456,6 +457,7 @@ ...@@ -456,6 +457,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR}, event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR}, event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP}, event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR}, channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR}, test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR}, test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<result column="flowEvent_device_name" property="deviceName" /> <result column="flowEvent_device_name" property="deviceName" />
<result column="flowEvent_location_code" property="locationCode" /> <result column="flowEvent_location_code" property="locationCode" />
<result column="flowEvent_location_name" property="locationName" /> <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" /> <result column="flowEvent_video_name" property="videoName" />
</resultMap> </resultMap>
<resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.FlowEvent" extends="BaseResultMapRoot" /> <resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.FlowEvent" extends="BaseResultMapRoot" />
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
`flowEvent`.event_type as flowEvent_event_type, `flowEvent`.event_time as flowEvent_event_time, `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`.event_id as flowEvent_event_id, `flowEvent`.device_code as flowEvent_device_code,
`flowEvent`.device_name as flowEvent_device_name, `flowEvent`.location_code as flowEvent_location_code, `flowEvent`.device_name as flowEvent_device_name, `flowEvent`.location_code as flowEvent_location_code,
`flowEvent`.location_name as flowEvent_location_name, `flowEvent`.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 `flowEvent`.video_name as flowEvent_video_name
</sql> </sql>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -165,12 +165,12 @@ ...@@ -165,12 +165,12 @@
insert into `d_flow_event` (unid, task_id, event_type, insert into `d_flow_event` (unid, task_id, event_type,
event_time, event_id, device_code, event_time, event_id, device_code,
device_name, location_code, location_name, 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}, values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventTime,jdbcType=TIMESTAMP}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR}, #{eventTime,jdbcType=TIMESTAMP}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR},
#{deviceName,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{locationName,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>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.FlowEvent" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
...@@ -203,8 +203,8 @@ ...@@ -203,8 +203,8 @@
<if test="locationName != null" > <if test="locationName != null" >
location_name, location_name,
</if> </if>
<if test="picName != null" > <if test="pics != null" >
pic_name, pics,
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
video_name, video_name,
...@@ -241,8 +241,8 @@ ...@@ -241,8 +241,8 @@
<if test="locationName != null" > <if test="locationName != null" >
#{locationName,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR},
</if> </if>
<if test="picName != null" > <if test="pics != null" >
#{picName,jdbcType=VARCHAR}, #{pics,jdbcType=VARCHAR},
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
#{videoName,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
...@@ -291,8 +291,8 @@ ...@@ -291,8 +291,8 @@
<if test="record.locationName != null" > <if test="record.locationName != null" >
location_name = #{record.locationName,jdbcType=VARCHAR}, location_name = #{record.locationName,jdbcType=VARCHAR},
</if> </if>
<if test="record.picName != null" > <if test="record.pics != null" >
pic_name = #{record.picName,jdbcType=VARCHAR}, pics = #{record.pics,jdbcType=VARCHAR},
</if> </if>
<if test="record.videoName != null" > <if test="record.videoName != null" >
video_name = #{record.videoName,jdbcType=VARCHAR}, video_name = #{record.videoName,jdbcType=VARCHAR},
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
`flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR}, `flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR},
`flowEvent`.location_code = #{record.locationCode,jdbcType=VARCHAR}, `flowEvent`.location_code = #{record.locationCode,jdbcType=VARCHAR},
`flowEvent`.location_name = #{record.locationName,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`.video_name = #{record.videoName,jdbcType=VARCHAR},
`flowEvent`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR} `flowEvent`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
<if test="_parameter != null" > <if test="_parameter != null" >
...@@ -336,7 +336,7 @@ ...@@ -336,7 +336,7 @@
device_name = #{record.deviceName,jdbcType=VARCHAR}, device_name = #{record.deviceName,jdbcType=VARCHAR},
location_code = #{record.locationCode,jdbcType=VARCHAR}, location_code = #{record.locationCode,jdbcType=VARCHAR},
location_name = #{record.locationName,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} video_name = #{record.videoName,jdbcType=VARCHAR}
<if test="_parameter != null" > <if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -372,8 +372,8 @@ ...@@ -372,8 +372,8 @@
<if test="locationName != null" > <if test="locationName != null" >
location_name = #{locationName,jdbcType=VARCHAR}, location_name = #{locationName,jdbcType=VARCHAR},
</if> </if>
<if test="picName != null" > <if test="pics != null" >
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
...@@ -395,7 +395,7 @@ ...@@ -395,7 +395,7 @@
device_name = #{deviceName,jdbcType=VARCHAR}, device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR}, location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR}, location_name = #{locationName,jdbcType=VARCHAR},
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
json_data = #{jsonData,jdbcType=LONGVARCHAR} json_data = #{jsonData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -411,7 +411,7 @@ ...@@ -411,7 +411,7 @@
device_name = #{deviceName,jdbcType=VARCHAR}, device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR}, location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR}, location_name = #{locationName,jdbcType=VARCHAR},
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR} video_name = #{videoName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<result column="traffic_event_id" property="eventId" /> <result column="traffic_event_id" property="eventId" />
<result column="traffic_special_type" property="specialType" /> <result column="traffic_special_type" property="specialType" />
<result column="traffic_with_helmet" property="withHelmet" /> <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_video_name" property="videoName" />
<result column="traffic_status" property="status" /> <result column="traffic_status" property="status" />
</resultMap> </resultMap>
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
`traffic`.feature_pendant as traffic_feature_pendant, `traffic`.feature_decoration as traffic_feature_decoration, `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`.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`.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`.with_helmet as traffic_with_helmet, `traffic`.pics as traffic_pics, `traffic`.video_name as traffic_video_name,
`traffic`.video_name as traffic_video_name, `traffic`.`status` as `traffic_status` `traffic`.`status` as `traffic_status`
</sql> </sql>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'TrafficExample')" > <if test="!(_parameter.getClass().getSimpleName() == 'TrafficExample')" >
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
illegal_code, illegal_state, feature_annual_inspection_mark, illegal_code, illegal_state, feature_annual_inspection_mark,
feature_pendant, feature_decoration, feature_sun_shield, feature_pendant, feature_decoration, feature_sun_shield,
xcycle_type, event_id, special_type, xcycle_type, event_id, special_type,
with_helmet, pic_name, video_name, with_helmet, pics, video_name,
`status`, json_data) `status`, json_data)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventCate,jdbcType=VARCHAR}, values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventCate,jdbcType=VARCHAR},
#{eventType,jdbcType=VARCHAR}, #{eventDt,jdbcType=TIMESTAMP}, #{channelUnid,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR}, #{eventDt,jdbcType=TIMESTAMP}, #{channelUnid,jdbcType=VARCHAR},
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
#{illegalCode,jdbcType=VARCHAR}, #{illegalState,jdbcType=INTEGER}, #{featureAnnualInspectionMark,jdbcType=SMALLINT}, #{illegalCode,jdbcType=VARCHAR}, #{illegalState,jdbcType=INTEGER}, #{featureAnnualInspectionMark,jdbcType=SMALLINT},
#{featurePendant,jdbcType=SMALLINT}, #{featureDecoration,jdbcType=SMALLINT}, #{featureSunShield,jdbcType=SMALLINT}, #{featurePendant,jdbcType=SMALLINT}, #{featureDecoration,jdbcType=SMALLINT}, #{featureSunShield,jdbcType=SMALLINT},
#{xcycleType,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR}, #{specialType,jdbcType=VARCHAR}, #{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}) #{status,jdbcType=INTEGER}, #{jsonData,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Traffic" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
...@@ -286,8 +286,8 @@ ...@@ -286,8 +286,8 @@
<if test="withHelmet != null" > <if test="withHelmet != null" >
with_helmet, with_helmet,
</if> </if>
<if test="picName != null" > <if test="pics != null" >
pic_name, pics,
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
video_name, video_name,
...@@ -375,8 +375,8 @@ ...@@ -375,8 +375,8 @@
<if test="withHelmet != null" > <if test="withHelmet != null" >
#{withHelmet,jdbcType=INTEGER}, #{withHelmet,jdbcType=INTEGER},
</if> </if>
<if test="picName != null" > <if test="pics != null" >
#{picName,jdbcType=VARCHAR}, #{pics,jdbcType=VARCHAR},
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
#{videoName,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
...@@ -476,8 +476,8 @@ ...@@ -476,8 +476,8 @@
<if test="record.withHelmet != null" > <if test="record.withHelmet != null" >
with_helmet = #{record.withHelmet,jdbcType=INTEGER}, with_helmet = #{record.withHelmet,jdbcType=INTEGER},
</if> </if>
<if test="record.picName != null" > <if test="record.pics != null" >
pic_name = #{record.picName,jdbcType=VARCHAR}, pics = #{record.pics,jdbcType=VARCHAR},
</if> </if>
<if test="record.videoName != null" > <if test="record.videoName != null" >
video_name = #{record.videoName,jdbcType=VARCHAR}, video_name = #{record.videoName,jdbcType=VARCHAR},
...@@ -521,7 +521,7 @@ ...@@ -521,7 +521,7 @@
`traffic`.event_id = #{record.eventId,jdbcType=VARCHAR}, `traffic`.event_id = #{record.eventId,jdbcType=VARCHAR},
`traffic`.special_type = #{record.specialType,jdbcType=VARCHAR}, `traffic`.special_type = #{record.specialType,jdbcType=VARCHAR},
`traffic`.with_helmet = #{record.withHelmet,jdbcType=INTEGER}, `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`.video_name = #{record.videoName,jdbcType=VARCHAR},
`traffic`.`status` = #{record.status,jdbcType=INTEGER}, `traffic`.`status` = #{record.status,jdbcType=INTEGER},
`traffic`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR} `traffic`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
...@@ -557,7 +557,7 @@ ...@@ -557,7 +557,7 @@
event_id = #{record.eventId,jdbcType=VARCHAR}, event_id = #{record.eventId,jdbcType=VARCHAR},
special_type = #{record.specialType,jdbcType=VARCHAR}, special_type = #{record.specialType,jdbcType=VARCHAR},
with_helmet = #{record.withHelmet,jdbcType=INTEGER}, with_helmet = #{record.withHelmet,jdbcType=INTEGER},
pic_name = #{record.picName,jdbcType=VARCHAR}, pics = #{record.pics,jdbcType=VARCHAR},
video_name = #{record.videoName,jdbcType=VARCHAR}, video_name = #{record.videoName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER} `status` = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null" > <if test="_parameter != null" >
...@@ -642,8 +642,8 @@ ...@@ -642,8 +642,8 @@
<if test="withHelmet != null" > <if test="withHelmet != null" >
with_helmet = #{withHelmet,jdbcType=INTEGER}, with_helmet = #{withHelmet,jdbcType=INTEGER},
</if> </if>
<if test="picName != null" > <if test="pics != null" >
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
</if> </if>
<if test="videoName != null" > <if test="videoName != null" >
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
...@@ -684,7 +684,7 @@ ...@@ -684,7 +684,7 @@
event_id = #{eventId,jdbcType=VARCHAR}, event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR}, special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER}, with_helmet = #{withHelmet,jdbcType=INTEGER},
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER}, `status` = #{status,jdbcType=INTEGER},
json_data = #{jsonData,jdbcType=LONGVARCHAR} json_data = #{jsonData,jdbcType=LONGVARCHAR}
...@@ -717,7 +717,7 @@ ...@@ -717,7 +717,7 @@
event_id = #{eventId,jdbcType=VARCHAR}, event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR}, special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER}, with_helmet = #{withHelmet,jdbcType=INTEGER},
pic_name = #{picName,jdbcType=VARCHAR}, pics = #{pics,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR}, video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER} `status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
......
...@@ -26,10 +26,10 @@ spring: ...@@ -26,10 +26,10 @@ spring:
username: root username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
......
...@@ -26,10 +26,10 @@ spring: ...@@ -26,10 +26,10 @@ spring:
username: root username: root
password: 123456 password: 123456
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
......
...@@ -63,8 +63,8 @@ public class TaskController implements TaskSchedulingTasksAdapter { ...@@ -63,8 +63,8 @@ public class TaskController implements TaskSchedulingTasksAdapter {
@DeleteMapping @DeleteMapping
public JsonMessageUtil.JsonMessage delete(Task task) { public JsonMessageUtil.JsonMessage delete(Task task) {
String unid = task.getUnid(); String unid = task.getUnid();
taskService.removeTaskDataAll(unid);
vaServerService.terminateTask(task); vaServerService.terminateTask(task);
taskService.removeTaskDataAll(unid);
// todo // todo
return JsonMessageUtil.getSuccessJsonMsg("success"); return JsonMessageUtil.getSuccessJsonMsg("success");
} }
......
...@@ -33,9 +33,5 @@ public class VAServerController { ...@@ -33,9 +33,5 @@ public class VAServerController {
return "success"; return "success";
} }
@PostMapping("/status")
public Object status() {
// todo
return null;
}
} }
...@@ -61,7 +61,7 @@ public class TaskRunner { ...@@ -61,7 +61,7 @@ public class TaskRunner {
Double score = next.getScore(); Double score = next.getScore();
String taskUnid = next.getValue(); String taskUnid = next.getValue();
if (System.currentTimeMillis() < score) { if (System.currentTimeMillis() < score) {
return; break;
} else { } else {
TaskData taskData = taskDataMap.get(taskUnid); TaskData taskData = taskDataMap.get(taskUnid);
Task task = taskData.getTask(); Task task = taskData.getTask();
...@@ -84,7 +84,7 @@ public class TaskRunner { ...@@ -84,7 +84,7 @@ public class TaskRunner {
} }
boolean success = vaServerService.executeTask(task, server); boolean success = vaServerService.executeTask(task, server);
// todo 获取可用的vaserver,执行任务下发动作,如果成功,关联taskData和vaServer,修改可用资源数,并且从zset中移除任务,修改任务状态 // todo 修改任务状态
set.remove(taskUnid); set.remove(taskUnid);
} }
......
...@@ -28,6 +28,9 @@ public class VAServerService { ...@@ -28,6 +28,9 @@ public class VAServerService {
@Resource @Resource
private RedissonClient redissonClient; private RedissonClient redissonClient;
/**
* 设备注册
*/
public void registeVAServer(VaServerInfo vaServerInfo) { public void registeVAServer(VaServerInfo vaServerInfo) {
String devID = vaServerInfo.getDevID(); String devID = vaServerInfo.getDevID();
RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP); RMap<String, VaServerInfo> map = redissonClient.getMap(RedisKeys.SCHEDULING_VASERVER_MAP);
...@@ -37,6 +40,9 @@ public class VAServerService { ...@@ -37,6 +40,9 @@ public class VAServerService {
map.put(devID, vaServerInfo); map.put(devID, vaServerInfo);
} }
/**
* 设备心跳
*/
public void keepalive(String devId) { public void keepalive(String devId) {
RBucket<Object> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devId)); RBucket<Object> bucket = redissonClient.getBucket(RedisKeys.getVAServerKeepAliveKey(devId));
bucket.set(1); bucket.set(1);
...@@ -63,26 +69,44 @@ public class VAServerService { ...@@ -63,26 +69,44 @@ public class VAServerService {
} }
/** /**
* 下发任务 * 下发任务,关联任务和vaServer,修改vaServer可用资源数
*/ */
public boolean executeTask(Task task, VaServerInfo server) { public boolean executeTask(Task task, VaServerInfo server) {
// todo 执行任务下发
linkTaskAndVaServer(task.getUnid(), server.getDevID()); linkTaskAndVaServer(task.getUnid(), server.getDevID());
server.setAvailableResources(server.getAvailableResources() - task.getResourceNeed()); server.setAvailableResources(server.getAvailableResources() - task.getResourceNeed());
return false; return false;
} }
/** /**
* 1. 解除任务和vaServer的关联
* 2. vaServer 资源数增加
* 3. 请求 vaServer 终止任务
* <p>
* 删除任务 * 删除任务
*/ */
public boolean terminateTask(Task task) { public boolean terminateTask(Task task) {
ImmutablePair<String, String> unlinkResult = unlinkTaskAndVaServer(task.getUnid()); String taskUnid = task.getUnid();
String devId = unlinkResult.right; 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); 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()); vaServerInfo.setAvailableResources(vaServerInfo.getAvailableResources() + task.getResourceNeed());
vaServerMap.put(devId, vaServerInfo); vaServerMap.put(vaServerId, vaServerInfo);
return false;
}
/**
* 修改任务
*/
public boolean modifyTask(Task task) {
return false; return false;
} }
...@@ -96,19 +120,19 @@ public class VAServerService { ...@@ -96,19 +120,19 @@ public class VAServerService {
} }
/** /**
* 获取rtsp流点播地址 * 获取点播地址
*/ */
public Object getRtspPath() { public Object getVideoOnDemandAddress(Task task) {
return null; return null;
} }
/** /**
* 主动推送rtmp * 输出分析
*/ */
public Object rtmp() { public void outputAnalysisStream(Task task) {
return null;
} }
/** /**
* 录像上传 * 录像上传
*/ */
...@@ -116,4 +140,12 @@ public class VAServerService { ...@@ -116,4 +140,12 @@ public class VAServerService {
return null; return null;
} }
/**
* 获取 VAServer 运行状态配置参数等
*/
public Object getVAServerStatus(String devId) {
return null;
}
} }
...@@ -21,10 +21,10 @@ spring: ...@@ -21,10 +21,10 @@ spring:
instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port} instance-id: ${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address: 192.168.9.146 ip-address: 192.168.9.146
redis: redis:
host: localhost host: 192.168.9.233
port: 6379 port: 6379
password: vionredis password: 3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database: 2 database: 15
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 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!