Commit b1d7f0a5 by xmh

commons:

1. 引入 content 表相关代码
2. Channel 添加 brand(品牌/厂家) 和 direction(方向) 字段

ops:
1. 引入 content 表相关代码
2. 更新 channel 表的代码
3. <fix> VideoService.uploadVideo 上传资源文件的 path 更新为相对目录

task:
1. <feature> 新增任务时构建 scene , 并且使用默认配置
2. <feature> 添加接口 TaskController.channelUnidWithTask 获取所有分配了任务的通道序列号
1 parent 1927bb4e
Showing 39 changed files with 2205 additions and 191 deletions
...@@ -16,7 +16,7 @@ public enum ChannelType { ...@@ -16,7 +16,7 @@ public enum ChannelType {
/** stream type rtsp */ /** stream type rtsp */
STREAM_RTSP(0), STREAM_RTSP(0),
/** stream type file */ /** stream type file */
STREAM_FILE(2), STREAM_FILE(1),
; ;
public int value; public int value;
......
...@@ -24,6 +24,10 @@ public class Channel extends BaseModel { ...@@ -24,6 +24,10 @@ public class Channel extends BaseModel {
private String password; private String password;
private String brand;
private String direction;
private String addressUnid; private String addressUnid;
private String name; private String name;
...@@ -44,6 +48,15 @@ public class Channel extends BaseModel { ...@@ -44,6 +48,15 @@ public class Channel extends BaseModel {
private List<Long> tags; private List<Long> tags;
public List<Long> getTags() {
return tags;
}
public Channel setTags(List<Long> tags) {
this.tags = tags;
return this;
}
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -116,6 +129,22 @@ public class Channel extends BaseModel { ...@@ -116,6 +129,22 @@ public class Channel extends BaseModel {
this.password = password == null ? null : password.trim(); this.password = password == null ? null : password.trim();
} }
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand == null ? null : brand.trim();
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction == null ? null : direction.trim();
}
public String getAddressUnid() { public String getAddressUnid() {
return addressUnid; return addressUnid;
} }
...@@ -187,13 +216,4 @@ public class Channel extends BaseModel { ...@@ -187,13 +216,4 @@ public class Channel extends BaseModel {
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public List<Long> getTags() {
return tags;
}
public Channel setTags(List<Long> tags) {
this.tags = tags;
return this;
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -689,6 +689,146 @@ public class ChannelExample extends BaseExample { ...@@ -689,6 +689,146 @@ public class ChannelExample extends BaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBrandIsNull() {
addCriterion("`channel`.brand is null");
return (Criteria) this;
}
public Criteria andBrandIsNotNull() {
addCriterion("`channel`.brand is not null");
return (Criteria) this;
}
public Criteria andBrandEqualTo(String value) {
addCriterion("`channel`.brand =", value, "brand");
return (Criteria) this;
}
public Criteria andBrandNotEqualTo(String value) {
addCriterion("`channel`.brand <>", value, "brand");
return (Criteria) this;
}
public Criteria andBrandGreaterThan(String value) {
addCriterion("`channel`.brand >", value, "brand");
return (Criteria) this;
}
public Criteria andBrandGreaterThanOrEqualTo(String value) {
addCriterion("`channel`.brand >=", value, "brand");
return (Criteria) this;
}
public Criteria andBrandLessThan(String value) {
addCriterion("`channel`.brand <", value, "brand");
return (Criteria) this;
}
public Criteria andBrandLessThanOrEqualTo(String value) {
addCriterion("`channel`.brand <=", value, "brand");
return (Criteria) this;
}
public Criteria andBrandLike(String value) {
addCriterion("`channel`.brand like", value, "brand");
return (Criteria) this;
}
public Criteria andBrandNotLike(String value) {
addCriterion("`channel`.brand not like", value, "brand");
return (Criteria) this;
}
public Criteria andBrandIn(List<String> values) {
addCriterion("`channel`.brand in", values, "brand");
return (Criteria) this;
}
public Criteria andBrandNotIn(List<String> values) {
addCriterion("`channel`.brand not in", values, "brand");
return (Criteria) this;
}
public Criteria andBrandBetween(String value1, String value2) {
addCriterion("`channel`.brand between", value1, value2, "brand");
return (Criteria) this;
}
public Criteria andBrandNotBetween(String value1, String value2) {
addCriterion("`channel`.brand not between", value1, value2, "brand");
return (Criteria) this;
}
public Criteria andDirectionIsNull() {
addCriterion("`channel`.direction is null");
return (Criteria) this;
}
public Criteria andDirectionIsNotNull() {
addCriterion("`channel`.direction is not null");
return (Criteria) this;
}
public Criteria andDirectionEqualTo(String value) {
addCriterion("`channel`.direction =", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionNotEqualTo(String value) {
addCriterion("`channel`.direction <>", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionGreaterThan(String value) {
addCriterion("`channel`.direction >", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionGreaterThanOrEqualTo(String value) {
addCriterion("`channel`.direction >=", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionLessThan(String value) {
addCriterion("`channel`.direction <", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionLessThanOrEqualTo(String value) {
addCriterion("`channel`.direction <=", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionLike(String value) {
addCriterion("`channel`.direction like", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionNotLike(String value) {
addCriterion("`channel`.direction not like", value, "direction");
return (Criteria) this;
}
public Criteria andDirectionIn(List<String> values) {
addCriterion("`channel`.direction in", values, "direction");
return (Criteria) this;
}
public Criteria andDirectionNotIn(List<String> values) {
addCriterion("`channel`.direction not in", values, "direction");
return (Criteria) this;
}
public Criteria andDirectionBetween(String value1, String value2) {
addCriterion("`channel`.direction between", value1, value2, "direction");
return (Criteria) this;
}
public Criteria andDirectionNotBetween(String value1, String value2) {
addCriterion("`channel`.direction not between", value1, value2, "direction");
return (Criteria) this;
}
public Criteria andAddressUnidIsNull() { public Criteria andAddressUnidIsNull() {
addCriterion("`channel`.address_unid is null"); addCriterion("`channel`.address_unid is null");
return (Criteria) this; return (Criteria) this;
...@@ -1321,6 +1461,16 @@ public class ChannelExample extends BaseExample { ...@@ -1321,6 +1461,16 @@ public class ChannelExample extends BaseExample {
return (ColumnContainer) this; return (ColumnContainer) this;
} }
public ColumnContainer hasBrandColumn() {
addColumnStr("`channel`.brand as channel_brand ");
return (ColumnContainer) this;
}
public ColumnContainer hasDirectionColumn() {
addColumnStr("`channel`.direction as channel_direction ");
return (ColumnContainer) this;
}
public ColumnContainer hasAddressUnidColumn() { public ColumnContainer hasAddressUnidColumn() {
addColumnStr("`channel`.address_unid as channel_address_unid "); addColumnStr("`channel`.address_unid as channel_address_unid ");
return (ColumnContainer) this; return (ColumnContainer) this;
......
package com.viontech.fanxing.commons.model;
import com.viontech.fanxing.commons.base.BaseModel;
public class Content extends BaseModel {
private Long id;
private String unid;
private String name;
private String type;
private String content;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUnid() {
return unid;
}
public void setUnid(String unid) {
this.unid = unid == null ? null : unid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.commons.model;
import com.viontech.fanxing.commons.base.BaseExample;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ContentExample extends BaseExample {
public ContentExample() {
super();
tableName = "s_content";
tableAlias = "content";
ignoreCase = false;
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this.tableName,this.ignoreCase);
return criteria;
}
public ColumnContainer createColumns() {
ColumnContainer columnContainer = (ColumnContainer) columnContainerMap.get(this.tableName);
if(columnContainer == null){
columnContainer = new ColumnContainer(this.tableName);
columnContainerMap.put(this.tableName,columnContainer);
}
return (ColumnContainer)columnContainer;
}
public static class Criteria extends GeneratedCriteria {
protected Criteria(String tableName) {
super(tableName);
tableName = "s_content";
}
protected Criteria(String tableName, boolean ignoreCase) {
this(tableName);
this.ignoreCase = ignoreCase;
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public void setAllCriteria(List<Criterion> criteria) {
this.criteria = criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value,ignoreCase));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("`content`.id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("`content`.id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("`content`.id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("`content`.id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("`content`.id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("`content`.id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("`content`.id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("`content`.id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("`content`.id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("`content`.id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("`content`.id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("`content`.id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUnidIsNull() {
addCriterion("`content`.unid is null");
return (Criteria) this;
}
public Criteria andUnidIsNotNull() {
addCriterion("`content`.unid is not null");
return (Criteria) this;
}
public Criteria andUnidEqualTo(String value) {
addCriterion("`content`.unid =", value, "unid");
return (Criteria) this;
}
public Criteria andUnidNotEqualTo(String value) {
addCriterion("`content`.unid <>", value, "unid");
return (Criteria) this;
}
public Criteria andUnidGreaterThan(String value) {
addCriterion("`content`.unid >", value, "unid");
return (Criteria) this;
}
public Criteria andUnidGreaterThanOrEqualTo(String value) {
addCriterion("`content`.unid >=", value, "unid");
return (Criteria) this;
}
public Criteria andUnidLessThan(String value) {
addCriterion("`content`.unid <", value, "unid");
return (Criteria) this;
}
public Criteria andUnidLessThanOrEqualTo(String value) {
addCriterion("`content`.unid <=", value, "unid");
return (Criteria) this;
}
public Criteria andUnidLike(String value) {
addCriterion("`content`.unid like", value, "unid");
return (Criteria) this;
}
public Criteria andUnidNotLike(String value) {
addCriterion("`content`.unid not like", value, "unid");
return (Criteria) this;
}
public Criteria andUnidIn(List<String> values) {
addCriterion("`content`.unid in", values, "unid");
return (Criteria) this;
}
public Criteria andUnidNotIn(List<String> values) {
addCriterion("`content`.unid not in", values, "unid");
return (Criteria) this;
}
public Criteria andUnidBetween(String value1, String value2) {
addCriterion("`content`.unid between", value1, value2, "unid");
return (Criteria) this;
}
public Criteria andUnidNotBetween(String value1, String value2) {
addCriterion("`content`.unid not between", value1, value2, "unid");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`content`.`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`content`.`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`content`.`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`content`.`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`content`.`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`content`.`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`content`.`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`content`.`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`content`.`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`content`.`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`content`.`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`content`.`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`content`.`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`content`.`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`content`.`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`content`.`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`content`.`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`content`.`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`content`.`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`content`.`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`content`.`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`content`.`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`content`.`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`content`.`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`content`.`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`content`.`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`content`.`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`content`.`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class ColumnContainer extends ColumnContainerBase {
protected ColumnContainer(String tableName) {
super(tableName);
}
public ColumnContainer hasIdColumn() {
addColumnStr("`content`.id as content_id ");
return (ColumnContainer) this;
}
public ColumnContainer hasUnidColumn() {
addColumnStr("`content`.unid as content_unid ");
return (ColumnContainer) this;
}
public ColumnContainer hasNameColumn() {
addColumnStr("`content`.`name` as `content_name` ");
return (ColumnContainer) this;
}
public ColumnContainer hasTypeColumn() {
addColumnStr("`content`.`type` as `content_type` ");
return (ColumnContainer) this;
}
}
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.commons.vo;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.vobase.ContentVoBase;
public class ContentVo extends ContentVoBase {
public ContentVo() {
super();
}
public ContentVo(Content content) {
super(content);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -106,6 +106,24 @@ public class ChannelVoBase extends Channel implements VoInterface<Channel> { ...@@ -106,6 +106,24 @@ public class ChannelVoBase extends Channel implements VoInterface<Channel> {
private String password_like; private String password_like;
@JsonIgnore @JsonIgnore
private Boolean brand_null;
@JsonIgnore
private ArrayList<String> brand_arr;
@JsonIgnore
private String brand_like;
@JsonIgnore
private Boolean direction_null;
@JsonIgnore
private ArrayList<String> direction_arr;
@JsonIgnore
private String direction_like;
@JsonIgnore
private Boolean addressUnid_null; private Boolean addressUnid_null;
@JsonIgnore @JsonIgnore
...@@ -627,6 +645,82 @@ public class ChannelVoBase extends Channel implements VoInterface<Channel> { ...@@ -627,6 +645,82 @@ public class ChannelVoBase extends Channel implements VoInterface<Channel> {
this.getModel().setPassword(password); this.getModel().setPassword(password);
} }
public Boolean getBrand_null() {
return brand_null;
}
public void setBrand_null(Boolean brand_null) {
this.brand_null = brand_null;
}
public ArrayList<String> getBrand_arr() {
return brand_arr;
}
public void setBrand_arr(ArrayList<String> brand_arr) {
this.brand_arr = brand_arr;
}
public String getBrand_like() {
return brand_like;
}
public void setBrand_like(String brand_like) {
this.brand_like = brand_like;
}
public String getBrand() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getBrand();
}
public void setBrand(String brand) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setBrand(brand);
}
public Boolean getDirection_null() {
return direction_null;
}
public void setDirection_null(Boolean direction_null) {
this.direction_null = direction_null;
}
public ArrayList<String> getDirection_arr() {
return direction_arr;
}
public void setDirection_arr(ArrayList<String> direction_arr) {
this.direction_arr = direction_arr;
}
public String getDirection_like() {
return direction_like;
}
public void setDirection_like(String direction_like) {
this.direction_like = direction_like;
}
public String getDirection() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getDirection();
}
public void setDirection(String direction) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setDirection(direction);
}
public Boolean getAddressUnid_null() { public Boolean getAddressUnid_null() {
return addressUnid_null; return addressUnid_null;
} }
......
package com.viontech.fanxing.commons.vobase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.viontech.fanxing.commons.base.VoInterface;
import com.viontech.fanxing.commons.model.Content;
import java.util.ArrayList;
public class ContentVoBase extends Content implements VoInterface<Content> {
private Content content;
@JsonIgnore
private ArrayList<Long> id_arr;
@JsonIgnore
private Long id_gt;
@JsonIgnore
private Long id_lt;
@JsonIgnore
private Long id_gte;
@JsonIgnore
private Long id_lte;
@JsonIgnore
private ArrayList<String> unid_arr;
@JsonIgnore
private String unid_like;
@JsonIgnore
private ArrayList<String> name_arr;
@JsonIgnore
private String name_like;
@JsonIgnore
private Boolean type_null;
@JsonIgnore
private ArrayList<String> type_arr;
@JsonIgnore
private String type_like;
@JsonIgnore
private Boolean content_null;
@JsonIgnore
private ArrayList<String> content_arr;
@JsonIgnore
private String content_like;
public ContentVoBase() {
this(null);
}
public ContentVoBase(Content content) {
if(content == null) {
content = new Content();
}
this.content = content;
}
@JsonIgnore
public Content getModel() {
return content;
}
public void setModel(Content content) {
this.content = content;
}
public ArrayList<Long> getId_arr() {
return id_arr;
}
public void setId_arr(ArrayList<Long> id_arr) {
this.id_arr = id_arr;
}
public Long getId_gt() {
return id_gt;
}
public void setId_gt(Long id_gt) {
this.id_gt = id_gt;
}
public Long getId_lt() {
return id_lt;
}
public void setId_lt(Long id_lt) {
this.id_lt = id_lt;
}
public Long getId_gte() {
return id_gte;
}
public void setId_gte(Long id_gte) {
this.id_gte = id_gte;
}
public Long getId_lte() {
return id_lte;
}
public void setId_lte(Long id_lte) {
this.id_lte = id_lte;
}
public Long getId() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getId();
}
public void setId(Long id) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setId(id);
}
public ArrayList<String> getUnid_arr() {
return unid_arr;
}
public void setUnid_arr(ArrayList<String> unid_arr) {
this.unid_arr = unid_arr;
}
public String getUnid_like() {
return unid_like;
}
public void setUnid_like(String unid_like) {
this.unid_like = unid_like;
}
public String getUnid() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getUnid();
}
public void setUnid(String unid) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setUnid(unid);
}
public ArrayList<String> getName_arr() {
return name_arr;
}
public void setName_arr(ArrayList<String> name_arr) {
this.name_arr = name_arr;
}
public String getName_like() {
return name_like;
}
public void setName_like(String name_like) {
this.name_like = name_like;
}
public String getName() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getName();
}
public void setName(String name) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setName(name);
}
public Boolean getType_null() {
return type_null;
}
public void setType_null(Boolean type_null) {
this.type_null = type_null;
}
public ArrayList<String> getType_arr() {
return type_arr;
}
public void setType_arr(ArrayList<String> type_arr) {
this.type_arr = type_arr;
}
public String getType_like() {
return type_like;
}
public void setType_like(String type_like) {
this.type_like = type_like;
}
public String getType() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getType();
}
public void setType(String type) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setType(type);
}
public Boolean getContent_null() {
return content_null;
}
public void setContent_null(Boolean content_null) {
this.content_null = content_null;
}
public ArrayList<String> getContent_arr() {
return content_arr;
}
public void setContent_arr(ArrayList<String> content_arr) {
this.content_arr = content_arr;
}
public String getContent_like() {
return content_like;
}
public void setContent_like(String content_like) {
this.content_like = content_like;
}
public String getContent() {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
return this.getModel().getContent();
}
public void setContent(String content) {
if(getModel() == null ){
throw new RuntimeException("model is null");
}
this.getModel().setContent(content);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ import org.redisson.api.RKeys; ...@@ -8,6 +8,7 @@ import org.redisson.api.RKeys;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -23,6 +24,7 @@ import java.util.Date; ...@@ -23,6 +24,7 @@ import java.util.Date;
@Component @Component
@Slf4j @Slf4j
@Profile("!test")
public class ForwardResultPersistenceRunner { public class ForwardResultPersistenceRunner {
@Resource @Resource
......
...@@ -7,6 +7,7 @@ import org.springframework.batch.core.JobParametersBuilder; ...@@ -7,6 +7,7 @@ import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.support.SimpleJobLauncher; import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.JobRepository;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.core.task.TaskExecutor; import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -23,6 +24,7 @@ import java.util.UUID; ...@@ -23,6 +24,7 @@ import java.util.UUID;
@Component @Component
@Order(11) @Order(11)
@Profile("!test")
public class JobStartRunner implements CommandLineRunner { public class JobStartRunner implements CommandLineRunner {
@Resource @Resource
......
...@@ -3,6 +3,7 @@ package com.viontech.fanxing.forward.runner; ...@@ -3,6 +3,7 @@ package com.viontech.fanxing.forward.runner;
import com.viontech.fanxing.commons.config.VionConfig; import com.viontech.fanxing.commons.config.VionConfig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -19,6 +20,7 @@ import java.time.format.DateTimeFormatter; ...@@ -19,6 +20,7 @@ import java.time.format.DateTimeFormatter;
*/ */
@Component @Component
@Slf4j @Slf4j
@Profile("!test")
public class PicKeepRunner { public class PicKeepRunner {
@Resource @Resource
......
...@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RTopic; import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -19,6 +20,7 @@ import javax.annotation.Resource; ...@@ -19,6 +20,7 @@ import javax.annotation.Resource;
*/ */
@Component @Component
@Slf4j @Slf4j
@Profile("!test")
public class PicRealTimeRunner implements CommandLineRunner { public class PicRealTimeRunner implements CommandLineRunner {
@Resource @Resource
......
...@@ -11,6 +11,7 @@ import org.junit.runner.RunWith; ...@@ -11,6 +11,7 @@ import org.junit.runner.RunWith;
import org.redisson.api.RTopic; import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -25,6 +26,7 @@ import java.util.List; ...@@ -25,6 +26,7 @@ import java.util.List;
@SpringBootTest @SpringBootTest
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ActiveProfiles("test")
public class Test0 { public class Test0 {
@Resource @Resource
......
...@@ -2,13 +2,12 @@ package com.viontech.fanxing.ops.controller.base; ...@@ -2,13 +2,12 @@ package com.viontech.fanxing.ops.controller.base;
import com.viontech.fanxing.commons.base.BaseController; import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.commons.base.BaseExample; import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseService; import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.Channel; import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.ChannelExample; import com.viontech.fanxing.commons.model.ChannelExample;
import com.viontech.fanxing.commons.vo.ChannelVo; import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.ops.mapper.ChannelMapper;
import com.viontech.fanxing.ops.service.adapter.ChannelService; import com.viontech.fanxing.ops.service.adapter.ChannelService;
import javax.annotation.Resource; import javax.annotation.Resource;
public abstract class ChannelBaseController extends BaseController<Channel, ChannelVo> { public abstract class ChannelBaseController extends BaseController<Channel, ChannelVo> {
...@@ -19,322 +18,354 @@ public abstract class ChannelBaseController extends BaseController<Channel, Chan ...@@ -19,322 +18,354 @@ public abstract class ChannelBaseController extends BaseController<Channel, Chan
protected BaseExample getExample(ChannelVo channelVo, int type) { protected BaseExample getExample(ChannelVo channelVo, int type) {
ChannelExample channelExample = new ChannelExample(); ChannelExample channelExample = new ChannelExample();
ChannelExample.Criteria criteria = channelExample.createCriteria(); ChannelExample.Criteria criteria = channelExample.createCriteria();
if(channelVo.getId() != null) { if (channelVo.getId() != null) {
criteria.andIdEqualTo(channelVo.getId()); criteria.andIdEqualTo(channelVo.getId());
} }
if(channelVo.getId_arr() != null) { if (channelVo.getId_arr() != null) {
criteria.andIdIn(channelVo.getId_arr()); criteria.andIdIn(channelVo.getId_arr());
} }
if(channelVo.getId_gt() != null) { if (channelVo.getId_gt() != null) {
criteria.andIdGreaterThan(channelVo.getId_gt()); criteria.andIdGreaterThan(channelVo.getId_gt());
} }
if(channelVo.getId_lt() != null) { if (channelVo.getId_lt() != null) {
criteria.andIdLessThan(channelVo.getId_lt()); criteria.andIdLessThan(channelVo.getId_lt());
} }
if(channelVo.getId_gte() != null) { if (channelVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(channelVo.getId_gte()); criteria.andIdGreaterThanOrEqualTo(channelVo.getId_gte());
} }
if(channelVo.getId_lte() != null) { if (channelVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(channelVo.getId_lte()); criteria.andIdLessThanOrEqualTo(channelVo.getId_lte());
} }
if(channelVo.getUnid() != null) { if (channelVo.getUnid() != null) {
criteria.andUnidEqualTo(channelVo.getUnid()); criteria.andUnidEqualTo(channelVo.getUnid());
} }
if(channelVo.getUnid_arr() != null) { if (channelVo.getUnid_arr() != null) {
criteria.andUnidIn(channelVo.getUnid_arr()); criteria.andUnidIn(channelVo.getUnid_arr());
} }
if(channelVo.getUnid_like() != null) { if (channelVo.getUnid_like() != null) {
criteria.andUnidLike(channelVo.getUnid_like()); criteria.andUnidLike(channelVo.getUnid_like());
} }
if(channelVo.getChannelUnid() != null) { if (channelVo.getChannelUnid() != null) {
criteria.andChannelUnidEqualTo(channelVo.getChannelUnid()); criteria.andChannelUnidEqualTo(channelVo.getChannelUnid());
} }
if(channelVo.getChannelUnid_arr() != null) { if (channelVo.getChannelUnid_arr() != null) {
criteria.andChannelUnidIn(channelVo.getChannelUnid_arr()); criteria.andChannelUnidIn(channelVo.getChannelUnid_arr());
} }
if(channelVo.getChannelUnid_like() != null) { if (channelVo.getChannelUnid_like() != null) {
criteria.andChannelUnidLike(channelVo.getChannelUnid_like()); criteria.andChannelUnidLike(channelVo.getChannelUnid_like());
} }
if(channelVo.getDeviceUnid() != null) { if (channelVo.getDeviceUnid() != null) {
criteria.andDeviceUnidEqualTo(channelVo.getDeviceUnid()); criteria.andDeviceUnidEqualTo(channelVo.getDeviceUnid());
} }
if(channelVo.getDeviceUnid_null() != null) { if (channelVo.getDeviceUnid_null() != null) {
if(channelVo.getDeviceUnid_null().booleanValue()) { if (channelVo.getDeviceUnid_null().booleanValue()) {
criteria.andDeviceUnidIsNull(); criteria.andDeviceUnidIsNull();
} else { } else {
criteria.andDeviceUnidIsNotNull(); criteria.andDeviceUnidIsNotNull();
} }
} }
if(channelVo.getDeviceUnid_arr() != null) { if (channelVo.getDeviceUnid_arr() != null) {
criteria.andDeviceUnidIn(channelVo.getDeviceUnid_arr()); criteria.andDeviceUnidIn(channelVo.getDeviceUnid_arr());
} }
if(channelVo.getDeviceUnid_like() != null) { if (channelVo.getDeviceUnid_like() != null) {
criteria.andDeviceUnidLike(channelVo.getDeviceUnid_like()); criteria.andDeviceUnidLike(channelVo.getDeviceUnid_like());
} }
if(channelVo.getType() != null) { if (channelVo.getType() != null) {
criteria.andTypeEqualTo(channelVo.getType()); criteria.andTypeEqualTo(channelVo.getType());
} }
if(channelVo.getType_arr() != null) { if (channelVo.getType_arr() != null) {
criteria.andTypeIn(channelVo.getType_arr()); criteria.andTypeIn(channelVo.getType_arr());
} }
if(channelVo.getType_gt() != null) { if (channelVo.getType_gt() != null) {
criteria.andTypeGreaterThan(channelVo.getType_gt()); criteria.andTypeGreaterThan(channelVo.getType_gt());
} }
if(channelVo.getType_lt() != null) { if (channelVo.getType_lt() != null) {
criteria.andTypeLessThan(channelVo.getType_lt()); criteria.andTypeLessThan(channelVo.getType_lt());
} }
if(channelVo.getType_gte() != null) { if (channelVo.getType_gte() != null) {
criteria.andTypeGreaterThanOrEqualTo(channelVo.getType_gte()); criteria.andTypeGreaterThanOrEqualTo(channelVo.getType_gte());
} }
if(channelVo.getType_lte() != null) { if (channelVo.getType_lte() != null) {
criteria.andTypeLessThanOrEqualTo(channelVo.getType_lte()); criteria.andTypeLessThanOrEqualTo(channelVo.getType_lte());
} }
if(channelVo.getStreamType() != null) { if (channelVo.getStreamType() != null) {
criteria.andStreamTypeEqualTo(channelVo.getStreamType()); criteria.andStreamTypeEqualTo(channelVo.getStreamType());
} }
if(channelVo.getStreamType_null() != null) { if (channelVo.getStreamType_null() != null) {
if(channelVo.getStreamType_null().booleanValue()) { if (channelVo.getStreamType_null().booleanValue()) {
criteria.andStreamTypeIsNull(); criteria.andStreamTypeIsNull();
} else { } else {
criteria.andStreamTypeIsNotNull(); criteria.andStreamTypeIsNotNull();
} }
} }
if(channelVo.getStreamType_arr() != null) { if (channelVo.getStreamType_arr() != null) {
criteria.andStreamTypeIn(channelVo.getStreamType_arr()); criteria.andStreamTypeIn(channelVo.getStreamType_arr());
} }
if(channelVo.getStreamType_gt() != null) { if (channelVo.getStreamType_gt() != null) {
criteria.andStreamTypeGreaterThan(channelVo.getStreamType_gt()); criteria.andStreamTypeGreaterThan(channelVo.getStreamType_gt());
} }
if(channelVo.getStreamType_lt() != null) { if (channelVo.getStreamType_lt() != null) {
criteria.andStreamTypeLessThan(channelVo.getStreamType_lt()); criteria.andStreamTypeLessThan(channelVo.getStreamType_lt());
} }
if(channelVo.getStreamType_gte() != null) { if (channelVo.getStreamType_gte() != null) {
criteria.andStreamTypeGreaterThanOrEqualTo(channelVo.getStreamType_gte()); criteria.andStreamTypeGreaterThanOrEqualTo(channelVo.getStreamType_gte());
} }
if(channelVo.getStreamType_lte() != null) { if (channelVo.getStreamType_lte() != null) {
criteria.andStreamTypeLessThanOrEqualTo(channelVo.getStreamType_lte()); criteria.andStreamTypeLessThanOrEqualTo(channelVo.getStreamType_lte());
} }
if(channelVo.getStreamPath() != null) { if (channelVo.getStreamPath() != null) {
criteria.andStreamPathEqualTo(channelVo.getStreamPath()); criteria.andStreamPathEqualTo(channelVo.getStreamPath());
} }
if(channelVo.getStreamPath_null() != null) { if (channelVo.getStreamPath_null() != null) {
if(channelVo.getStreamPath_null().booleanValue()) { if (channelVo.getStreamPath_null().booleanValue()) {
criteria.andStreamPathIsNull(); criteria.andStreamPathIsNull();
} else { } else {
criteria.andStreamPathIsNotNull(); criteria.andStreamPathIsNotNull();
} }
} }
if(channelVo.getStreamPath_arr() != null) { if (channelVo.getStreamPath_arr() != null) {
criteria.andStreamPathIn(channelVo.getStreamPath_arr()); criteria.andStreamPathIn(channelVo.getStreamPath_arr());
} }
if(channelVo.getStreamPath_like() != null) { if (channelVo.getStreamPath_like() != null) {
criteria.andStreamPathLike(channelVo.getStreamPath_like()); criteria.andStreamPathLike(channelVo.getStreamPath_like());
} }
if(channelVo.getUsername() != null) { if (channelVo.getUsername() != null) {
criteria.andUsernameEqualTo(channelVo.getUsername()); criteria.andUsernameEqualTo(channelVo.getUsername());
} }
if(channelVo.getUsername_null() != null) { if (channelVo.getUsername_null() != null) {
if(channelVo.getUsername_null().booleanValue()) { if (channelVo.getUsername_null().booleanValue()) {
criteria.andUsernameIsNull(); criteria.andUsernameIsNull();
} else { } else {
criteria.andUsernameIsNotNull(); criteria.andUsernameIsNotNull();
} }
} }
if(channelVo.getUsername_arr() != null) { if (channelVo.getUsername_arr() != null) {
criteria.andUsernameIn(channelVo.getUsername_arr()); criteria.andUsernameIn(channelVo.getUsername_arr());
} }
if(channelVo.getUsername_like() != null) { if (channelVo.getUsername_like() != null) {
criteria.andUsernameLike(channelVo.getUsername_like()); criteria.andUsernameLike(channelVo.getUsername_like());
} }
if(channelVo.getPassword() != null) { if (channelVo.getPassword() != null) {
criteria.andPasswordEqualTo(channelVo.getPassword()); criteria.andPasswordEqualTo(channelVo.getPassword());
} }
if(channelVo.getPassword_null() != null) { if (channelVo.getPassword_null() != null) {
if(channelVo.getPassword_null().booleanValue()) { if (channelVo.getPassword_null().booleanValue()) {
criteria.andPasswordIsNull(); criteria.andPasswordIsNull();
} else { } else {
criteria.andPasswordIsNotNull(); criteria.andPasswordIsNotNull();
} }
} }
if(channelVo.getPassword_arr() != null) { if (channelVo.getPassword_arr() != null) {
criteria.andPasswordIn(channelVo.getPassword_arr()); criteria.andPasswordIn(channelVo.getPassword_arr());
} }
if(channelVo.getPassword_like() != null) { if (channelVo.getPassword_like() != null) {
criteria.andPasswordLike(channelVo.getPassword_like()); criteria.andPasswordLike(channelVo.getPassword_like());
} }
if(channelVo.getAddressUnid() != null) { if (channelVo.getBrand() != null) {
criteria.andBrandEqualTo(channelVo.getBrand());
}
if (channelVo.getBrand_null() != null) {
if (channelVo.getBrand_null().booleanValue()) {
criteria.andBrandIsNull();
} else {
criteria.andBrandIsNotNull();
}
}
if (channelVo.getBrand_arr() != null) {
criteria.andBrandIn(channelVo.getBrand_arr());
}
if (channelVo.getBrand_like() != null) {
criteria.andBrandLike(channelVo.getBrand_like());
}
if (channelVo.getDirection() != null) {
criteria.andDirectionEqualTo(channelVo.getDirection());
}
if (channelVo.getDirection_null() != null) {
if (channelVo.getDirection_null().booleanValue()) {
criteria.andDirectionIsNull();
} else {
criteria.andDirectionIsNotNull();
}
}
if (channelVo.getDirection_arr() != null) {
criteria.andDirectionIn(channelVo.getDirection_arr());
}
if (channelVo.getDirection_like() != null) {
criteria.andDirectionLike(channelVo.getDirection_like());
}
if (channelVo.getAddressUnid() != null) {
criteria.andAddressUnidEqualTo(channelVo.getAddressUnid()); criteria.andAddressUnidEqualTo(channelVo.getAddressUnid());
} }
if(channelVo.getAddressUnid_null() != null) { if (channelVo.getAddressUnid_null() != null) {
if(channelVo.getAddressUnid_null().booleanValue()) { if (channelVo.getAddressUnid_null().booleanValue()) {
criteria.andAddressUnidIsNull(); criteria.andAddressUnidIsNull();
} else { } else {
criteria.andAddressUnidIsNotNull(); criteria.andAddressUnidIsNotNull();
} }
} }
if(channelVo.getAddressUnid_arr() != null) { if (channelVo.getAddressUnid_arr() != null) {
criteria.andAddressUnidIn(channelVo.getAddressUnid_arr()); criteria.andAddressUnidIn(channelVo.getAddressUnid_arr());
} }
if(channelVo.getAddressUnid_like() != null) { if (channelVo.getAddressUnid_like() != null) {
criteria.andAddressUnidLike(channelVo.getAddressUnid_like()); criteria.andAddressUnidLike(channelVo.getAddressUnid_like());
} }
if(channelVo.getName() != null) { if (channelVo.getName() != null) {
criteria.andNameEqualTo(channelVo.getName()); criteria.andNameEqualTo(channelVo.getName());
} }
if(channelVo.getName_null() != null) { if (channelVo.getName_null() != null) {
if(channelVo.getName_null().booleanValue()) { if (channelVo.getName_null().booleanValue()) {
criteria.andNameIsNull(); criteria.andNameIsNull();
} else { } else {
criteria.andNameIsNotNull(); criteria.andNameIsNotNull();
} }
} }
if(channelVo.getName_arr() != null) { if (channelVo.getName_arr() != null) {
criteria.andNameIn(channelVo.getName_arr()); criteria.andNameIn(channelVo.getName_arr());
} }
if(channelVo.getName_like() != null) { if (channelVo.getName_like() != null) {
criteria.andNameLike(channelVo.getName_like()); criteria.andNameLike(channelVo.getName_like());
} }
if(channelVo.getIp() != null) { if (channelVo.getIp() != null) {
criteria.andIpEqualTo(channelVo.getIp()); criteria.andIpEqualTo(channelVo.getIp());
} }
if(channelVo.getIp_null() != null) { if (channelVo.getIp_null() != null) {
if(channelVo.getIp_null().booleanValue()) { if (channelVo.getIp_null().booleanValue()) {
criteria.andIpIsNull(); criteria.andIpIsNull();
} else { } else {
criteria.andIpIsNotNull(); criteria.andIpIsNotNull();
} }
} }
if(channelVo.getIp_arr() != null) { if (channelVo.getIp_arr() != null) {
criteria.andIpIn(channelVo.getIp_arr()); criteria.andIpIn(channelVo.getIp_arr());
} }
if(channelVo.getIp_like() != null) { if (channelVo.getIp_like() != null) {
criteria.andIpLike(channelVo.getIp_like()); criteria.andIpLike(channelVo.getIp_like());
} }
if(channelVo.getPort() != null) { if (channelVo.getPort() != null) {
criteria.andPortEqualTo(channelVo.getPort()); criteria.andPortEqualTo(channelVo.getPort());
} }
if(channelVo.getPort_null() != null) { if (channelVo.getPort_null() != null) {
if(channelVo.getPort_null().booleanValue()) { if (channelVo.getPort_null().booleanValue()) {
criteria.andPortIsNull(); criteria.andPortIsNull();
} else { } else {
criteria.andPortIsNotNull(); criteria.andPortIsNotNull();
} }
} }
if(channelVo.getPort_arr() != null) { if (channelVo.getPort_arr() != null) {
criteria.andPortIn(channelVo.getPort_arr()); criteria.andPortIn(channelVo.getPort_arr());
} }
if(channelVo.getPort_gt() != null) { if (channelVo.getPort_gt() != null) {
criteria.andPortGreaterThan(channelVo.getPort_gt()); criteria.andPortGreaterThan(channelVo.getPort_gt());
} }
if(channelVo.getPort_lt() != null) { if (channelVo.getPort_lt() != null) {
criteria.andPortLessThan(channelVo.getPort_lt()); criteria.andPortLessThan(channelVo.getPort_lt());
} }
if(channelVo.getPort_gte() != null) { if (channelVo.getPort_gte() != null) {
criteria.andPortGreaterThanOrEqualTo(channelVo.getPort_gte()); criteria.andPortGreaterThanOrEqualTo(channelVo.getPort_gte());
} }
if(channelVo.getPort_lte() != null) { if (channelVo.getPort_lte() != null) {
criteria.andPortLessThanOrEqualTo(channelVo.getPort_lte()); criteria.andPortLessThanOrEqualTo(channelVo.getPort_lte());
} }
if(channelVo.getExpand() != null) { if (channelVo.getExpand() != null) {
criteria.andExpandEqualTo(channelVo.getExpand()); criteria.andExpandEqualTo(channelVo.getExpand());
} }
if(channelVo.getExpand_null() != null) { if (channelVo.getExpand_null() != null) {
if(channelVo.getExpand_null().booleanValue()) { if (channelVo.getExpand_null().booleanValue()) {
criteria.andExpandIsNull(); criteria.andExpandIsNull();
} else { } else {
criteria.andExpandIsNotNull(); criteria.andExpandIsNotNull();
} }
} }
if(channelVo.getExpand_arr() != null) { if (channelVo.getExpand_arr() != null) {
criteria.andExpandIn(channelVo.getExpand_arr()); criteria.andExpandIn(channelVo.getExpand_arr());
} }
if(channelVo.getExpand_like() != null) { if (channelVo.getExpand_like() != null) {
criteria.andExpandLike(channelVo.getExpand_like()); criteria.andExpandLike(channelVo.getExpand_like());
} }
if(channelVo.getLongitude() != null) { if (channelVo.getLongitude() != null) {
criteria.andLongitudeEqualTo(channelVo.getLongitude()); criteria.andLongitudeEqualTo(channelVo.getLongitude());
} }
if(channelVo.getLongitude_null() != null) { if (channelVo.getLongitude_null() != null) {
if(channelVo.getLongitude_null().booleanValue()) { if (channelVo.getLongitude_null().booleanValue()) {
criteria.andLongitudeIsNull(); criteria.andLongitudeIsNull();
} else { } else {
criteria.andLongitudeIsNotNull(); criteria.andLongitudeIsNotNull();
} }
} }
if(channelVo.getLongitude_arr() != null) { if (channelVo.getLongitude_arr() != null) {
criteria.andLongitudeIn(channelVo.getLongitude_arr()); criteria.andLongitudeIn(channelVo.getLongitude_arr());
} }
if(channelVo.getLongitude_gt() != null) { if (channelVo.getLongitude_gt() != null) {
criteria.andLongitudeGreaterThan(channelVo.getLongitude_gt()); criteria.andLongitudeGreaterThan(channelVo.getLongitude_gt());
} }
if(channelVo.getLongitude_lt() != null) { if (channelVo.getLongitude_lt() != null) {
criteria.andLongitudeLessThan(channelVo.getLongitude_lt()); criteria.andLongitudeLessThan(channelVo.getLongitude_lt());
} }
if(channelVo.getLongitude_gte() != null) { if (channelVo.getLongitude_gte() != null) {
criteria.andLongitudeGreaterThanOrEqualTo(channelVo.getLongitude_gte()); criteria.andLongitudeGreaterThanOrEqualTo(channelVo.getLongitude_gte());
} }
if(channelVo.getLongitude_lte() != null) { if (channelVo.getLongitude_lte() != null) {
criteria.andLongitudeLessThanOrEqualTo(channelVo.getLongitude_lte()); criteria.andLongitudeLessThanOrEqualTo(channelVo.getLongitude_lte());
} }
if(channelVo.getLatitude() != null) { if (channelVo.getLatitude() != null) {
criteria.andLatitudeEqualTo(channelVo.getLatitude()); criteria.andLatitudeEqualTo(channelVo.getLatitude());
} }
if(channelVo.getLatitude_null() != null) { if (channelVo.getLatitude_null() != null) {
if(channelVo.getLatitude_null().booleanValue()) { if (channelVo.getLatitude_null().booleanValue()) {
criteria.andLatitudeIsNull(); criteria.andLatitudeIsNull();
} else { } else {
criteria.andLatitudeIsNotNull(); criteria.andLatitudeIsNotNull();
} }
} }
if(channelVo.getLatitude_arr() != null) { if (channelVo.getLatitude_arr() != null) {
criteria.andLatitudeIn(channelVo.getLatitude_arr()); criteria.andLatitudeIn(channelVo.getLatitude_arr());
} }
if(channelVo.getLatitude_gt() != null) { if (channelVo.getLatitude_gt() != null) {
criteria.andLatitudeGreaterThan(channelVo.getLatitude_gt()); criteria.andLatitudeGreaterThan(channelVo.getLatitude_gt());
} }
if(channelVo.getLatitude_lt() != null) { if (channelVo.getLatitude_lt() != null) {
criteria.andLatitudeLessThan(channelVo.getLatitude_lt()); criteria.andLatitudeLessThan(channelVo.getLatitude_lt());
} }
if(channelVo.getLatitude_gte() != null) { if (channelVo.getLatitude_gte() != null) {
criteria.andLatitudeGreaterThanOrEqualTo(channelVo.getLatitude_gte()); criteria.andLatitudeGreaterThanOrEqualTo(channelVo.getLatitude_gte());
} }
if(channelVo.getLatitude_lte() != null) { if (channelVo.getLatitude_lte() != null) {
criteria.andLatitudeLessThanOrEqualTo(channelVo.getLatitude_lte()); criteria.andLatitudeLessThanOrEqualTo(channelVo.getLatitude_lte());
} }
if(channelVo.getStatus() != null) { if (channelVo.getStatus() != null) {
criteria.andStatusEqualTo(channelVo.getStatus()); criteria.andStatusEqualTo(channelVo.getStatus());
} }
if(channelVo.getStatus_arr() != null) { if (channelVo.getStatus_arr() != null) {
criteria.andStatusIn(channelVo.getStatus_arr()); criteria.andStatusIn(channelVo.getStatus_arr());
} }
if(channelVo.getStatus_gt() != null) { if (channelVo.getStatus_gt() != null) {
criteria.andStatusGreaterThan(channelVo.getStatus_gt()); criteria.andStatusGreaterThan(channelVo.getStatus_gt());
} }
if(channelVo.getStatus_lt() != null) { if (channelVo.getStatus_lt() != null) {
criteria.andStatusLessThan(channelVo.getStatus_lt()); criteria.andStatusLessThan(channelVo.getStatus_lt());
} }
if(channelVo.getStatus_gte() != null) { if (channelVo.getStatus_gte() != null) {
criteria.andStatusGreaterThanOrEqualTo(channelVo.getStatus_gte()); criteria.andStatusGreaterThanOrEqualTo(channelVo.getStatus_gte());
} }
if(channelVo.getStatus_lte() != null) { if (channelVo.getStatus_lte() != null) {
criteria.andStatusLessThanOrEqualTo(channelVo.getStatus_lte()); criteria.andStatusLessThanOrEqualTo(channelVo.getStatus_lte());
} }
if(channelVo.getCreateTime() != null) { if (channelVo.getCreateTime() != null) {
criteria.andCreateTimeEqualTo(channelVo.getCreateTime()); criteria.andCreateTimeEqualTo(channelVo.getCreateTime());
} }
if(channelVo.getCreateTime_arr() != null) { if (channelVo.getCreateTime_arr() != null) {
criteria.andCreateTimeIn(channelVo.getCreateTime_arr()); criteria.andCreateTimeIn(channelVo.getCreateTime_arr());
} }
if(channelVo.getCreateTime_gt() != null) { if (channelVo.getCreateTime_gt() != null) {
criteria.andCreateTimeGreaterThan(channelVo.getCreateTime_gt()); criteria.andCreateTimeGreaterThan(channelVo.getCreateTime_gt());
} }
if(channelVo.getCreateTime_lt() != null) { if (channelVo.getCreateTime_lt() != null) {
criteria.andCreateTimeLessThan(channelVo.getCreateTime_lt()); criteria.andCreateTimeLessThan(channelVo.getCreateTime_lt());
} }
if(channelVo.getCreateTime_gte() != null) { if (channelVo.getCreateTime_gte() != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(channelVo.getCreateTime_gte()); criteria.andCreateTimeGreaterThanOrEqualTo(channelVo.getCreateTime_gte());
} }
if(channelVo.getCreateTime_lte() != null) { if (channelVo.getCreateTime_lte() != null) {
criteria.andCreateTimeLessThanOrEqualTo(channelVo.getCreateTime_lte()); criteria.andCreateTimeLessThanOrEqualTo(channelVo.getCreateTime_lte());
} }
return channelExample; return channelExample;
......
package com.viontech.fanxing.ops.controller.base;
import com.viontech.fanxing.commons.base.BaseController;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.ContentExample;
import com.viontech.fanxing.commons.vo.ContentVo;
import com.viontech.fanxing.ops.mapper.ContentMapper;
import com.viontech.fanxing.ops.service.adapter.ContentService;
import javax.annotation.Resource;
public abstract class ContentBaseController extends BaseController<Content, ContentVo> {
@Resource
protected ContentService contentService;
@Override
protected BaseExample getExample(ContentVo contentVo, int type) {
ContentExample contentExample = new ContentExample();
ContentExample.Criteria criteria = contentExample.createCriteria();
if(contentVo.getId() != null) {
criteria.andIdEqualTo(contentVo.getId());
}
if(contentVo.getId_arr() != null) {
criteria.andIdIn(contentVo.getId_arr());
}
if(contentVo.getId_gt() != null) {
criteria.andIdGreaterThan(contentVo.getId_gt());
}
if(contentVo.getId_lt() != null) {
criteria.andIdLessThan(contentVo.getId_lt());
}
if(contentVo.getId_gte() != null) {
criteria.andIdGreaterThanOrEqualTo(contentVo.getId_gte());
}
if(contentVo.getId_lte() != null) {
criteria.andIdLessThanOrEqualTo(contentVo.getId_lte());
}
if(contentVo.getUnid() != null) {
criteria.andUnidEqualTo(contentVo.getUnid());
}
if(contentVo.getUnid_arr() != null) {
criteria.andUnidIn(contentVo.getUnid_arr());
}
if(contentVo.getUnid_like() != null) {
criteria.andUnidLike(contentVo.getUnid_like());
}
if(contentVo.getName() != null) {
criteria.andNameEqualTo(contentVo.getName());
}
if(contentVo.getName_arr() != null) {
criteria.andNameIn(contentVo.getName_arr());
}
if(contentVo.getName_like() != null) {
criteria.andNameLike(contentVo.getName_like());
}
if(contentVo.getType() != null) {
criteria.andTypeEqualTo(contentVo.getType());
}
if(contentVo.getType_null() != null) {
if(contentVo.getType_null().booleanValue()) {
criteria.andTypeIsNull();
} else {
criteria.andTypeIsNotNull();
}
}
if(contentVo.getType_arr() != null) {
criteria.andTypeIn(contentVo.getType_arr());
}
if(contentVo.getType_like() != null) {
criteria.andTypeLike(contentVo.getType_like());
}
return contentExample;
}
@Override
protected BaseService<Content> getService() {
return contentService;
}
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.controller.web;
import com.github.pagehelper.PageInfo;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.model.ContentExample;
import com.viontech.fanxing.commons.vo.ContentVo;
import com.viontech.fanxing.ops.controller.base.ContentBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import static com.viontech.keliu.util.JsonMessageUtil.getSuccessJsonMsg;
@Controller
@RequestMapping("/contents")
public class ContentController extends ContentBaseController {
@Override
protected BaseExample getExample(ContentVo contentVo, int type) {
ContentExample contentExample = (ContentExample) super.getExample(contentVo, type);
return contentExample;
}
@RequestMapping(value = "", method = RequestMethod.GET)
@ResponseBody
@Override
public Object page(ContentVo contentVo, @RequestParam(value = "page", defaultValue = "-1") int page, @RequestParam(value = "pageSize", defaultValue = "100") int pageSize, String sortName, String sortOrder) {
ContentExample baseExample = (ContentExample) getExample(contentVo, EXAMPLE_TYPE_PAGE);
if (isNotNull(sortOrder) && isNotNull(sortName)) {
baseExample.setOrderByClause(baseExample.getTableAlias() + "." + sortName + " " + sortOrder);
} else if (isNotNull(sortName) && !isNotNull(sortOrder)) {
baseExample.setOrderByClause(sortName);
}
if (page <= 0) {
List result = contentService.selectByExampleWithBlob(baseExample);
return getSuccessJsonMsg(MESSAGE_SELECT_SUCCESS, result);
} else {
PageInfo pageInfo = getService().pagedQuery(baseExample, page, pageSize);
return getSuccessJsonMsg(MESSAGE_PAGE_SUCCESS, pageInfo);
}
}
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.feign;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/7/16
*/
@FeignClient(value = "fanxing-task")
@Service
public interface TaskFeignClient {
@GetMapping("/tasks")
JsonMessageUtil.JsonMessage<List<Task>> getAllTask();
}
package com.viontech.fanxing.ops.mapper;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.ContentExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ContentMapper extends BaseMapper {
int countByExample(ContentExample example);
int deleteByExample(ContentExample example);
int deleteByPrimaryKey(Long id);
int insert(Content record);
int insertSelective(Content record);
List<Content> selectByExampleWithBLOBs(ContentExample example);
List<Content> selectByExample(ContentExample example);
Content selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Content record, @Param("example") ContentExample example);
int updateByExampleWithBLOBs(@Param("record") Content record, @Param("example") ContentExample example);
int updateByExample(@Param("record") Content record, @Param("example") ContentExample example);
int updateByPrimaryKeySelective(Content record);
int updateByPrimaryKeyWithBLOBs(Content record);
int updateByPrimaryKey(Content record);
}
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<result column="channel_stream_path" property="streamPath" /> <result column="channel_stream_path" property="streamPath" />
<result column="channel_username" property="username" /> <result column="channel_username" property="username" />
<result column="channel_password" property="password" /> <result column="channel_password" property="password" />
<result column="channel_brand" property="brand" />
<result column="channel_direction" property="direction" />
<result column="channel_address_unid" property="addressUnid" /> <result column="channel_address_unid" property="addressUnid" />
<result column="channel_name" property="name" /> <result column="channel_name" property="name" />
<result column="channel_ip" property="ip" /> <result column="channel_ip" property="ip" />
...@@ -85,9 +87,9 @@ ...@@ -85,9 +87,9 @@
`channel`.device_unid as channel_device_unid, `channel`.`type` as `channel_type`, `channel`.device_unid as channel_device_unid, `channel`.`type` as `channel_type`,
`channel`.stream_type as channel_stream_type, `channel`.stream_path as channel_stream_path, `channel`.stream_type as channel_stream_type, `channel`.stream_path as channel_stream_path,
`channel`.username as channel_username, `channel`.`password` as `channel_password`, `channel`.username as channel_username, `channel`.`password` as `channel_password`,
`channel`.address_unid as channel_address_unid, `channel`.`name` as `channel_name`, `channel`.brand as channel_brand, `channel`.direction as channel_direction, `channel`.address_unid as channel_address_unid,
`channel`.ip as channel_ip, `channel`.port as channel_port, `channel`.expand as channel_expand, `channel`.`name` as `channel_name`, `channel`.ip as channel_ip, `channel`.port as channel_port,
`channel`.longitude as channel_longitude, `channel`.latitude as channel_latitude, `channel`.expand as channel_expand, `channel`.longitude as channel_longitude, `channel`.latitude as channel_latitude,
`channel`.`status` as `channel_status`, `channel`.create_time as channel_create_time `channel`.`status` as `channel_status`, `channel`.create_time as channel_create_time
</sql> </sql>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -145,16 +147,18 @@ ...@@ -145,16 +147,18 @@
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.Channel" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insert" parameterType="com.viontech.fanxing.commons.model.Channel" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_channel` (unid, channel_unid, device_unid, insert into `s_channel` (unid, channel_unid, device_unid,
`type`, stream_type, stream_path, `type`, stream_type, stream_path,
username, `password`, address_unid, username, `password`, brand,
`name`, ip, port, expand, direction, address_unid, `name`,
longitude, latitude, `status`, ip, port, expand, longitude,
create_time) latitude, `status`, create_time
)
values (#{unid,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR}, #{deviceUnid,jdbcType=VARCHAR}, values (#{unid,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR}, #{deviceUnid,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}, #{streamType,jdbcType=INTEGER}, #{streamPath,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{streamType,jdbcType=INTEGER}, #{streamPath,jdbcType=VARCHAR},
#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{addressUnid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{brand,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{expand,jdbcType=VARCHAR}, #{direction,jdbcType=VARCHAR}, #{addressUnid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{status,jdbcType=INTEGER}, #{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, #{expand,jdbcType=VARCHAR}, #{longitude,jdbcType=REAL},
#{createTime,jdbcType=TIMESTAMP}) #{latitude,jdbcType=REAL}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Channel" useGeneratedKeys="true" keyProperty="id" keyColumn="id" > <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Channel" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_channel` insert into `s_channel`
...@@ -183,6 +187,12 @@ ...@@ -183,6 +187,12 @@
<if test="password != null" > <if test="password != null" >
`password`, `password`,
</if> </if>
<if test="brand != null" >
brand,
</if>
<if test="direction != null" >
direction,
</if>
<if test="addressUnid != null" > <if test="addressUnid != null" >
address_unid, address_unid,
</if> </if>
...@@ -236,6 +246,12 @@ ...@@ -236,6 +246,12 @@
<if test="password != null" > <if test="password != null" >
#{password,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
</if> </if>
<if test="brand != null" >
#{brand,jdbcType=VARCHAR},
</if>
<if test="direction != null" >
#{direction,jdbcType=VARCHAR},
</if>
<if test="addressUnid != null" > <if test="addressUnid != null" >
#{addressUnid,jdbcType=VARCHAR}, #{addressUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -301,6 +317,12 @@ ...@@ -301,6 +317,12 @@
<if test="record.password != null" > <if test="record.password != null" >
`password` = #{record.password,jdbcType=VARCHAR}, `password` = #{record.password,jdbcType=VARCHAR},
</if> </if>
<if test="record.brand != null" >
brand = #{record.brand,jdbcType=VARCHAR},
</if>
<if test="record.direction != null" >
direction = #{record.direction,jdbcType=VARCHAR},
</if>
<if test="record.addressUnid != null" > <if test="record.addressUnid != null" >
address_unid = #{record.addressUnid,jdbcType=VARCHAR}, address_unid = #{record.addressUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -344,6 +366,8 @@ ...@@ -344,6 +366,8 @@
stream_path = #{record.streamPath,jdbcType=VARCHAR}, stream_path = #{record.streamPath,jdbcType=VARCHAR},
username = #{record.username,jdbcType=VARCHAR}, username = #{record.username,jdbcType=VARCHAR},
`password` = #{record.password,jdbcType=VARCHAR}, `password` = #{record.password,jdbcType=VARCHAR},
brand = #{record.brand,jdbcType=VARCHAR},
direction = #{record.direction,jdbcType=VARCHAR},
address_unid = #{record.addressUnid,jdbcType=VARCHAR}, address_unid = #{record.addressUnid,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
ip = #{record.ip,jdbcType=VARCHAR}, ip = #{record.ip,jdbcType=VARCHAR},
...@@ -384,6 +408,12 @@ ...@@ -384,6 +408,12 @@
<if test="password != null" > <if test="password != null" >
`password` = #{password,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR},
</if> </if>
<if test="brand != null" >
brand = #{brand,jdbcType=VARCHAR},
</if>
<if test="direction != null" >
direction = #{direction,jdbcType=VARCHAR},
</if>
<if test="addressUnid != null" > <if test="addressUnid != null" >
address_unid = #{addressUnid,jdbcType=VARCHAR}, address_unid = #{addressUnid,jdbcType=VARCHAR},
</if> </if>
...@@ -424,6 +454,8 @@ ...@@ -424,6 +454,8 @@
stream_path = #{streamPath,jdbcType=VARCHAR}, stream_path = #{streamPath,jdbcType=VARCHAR},
username = #{username,jdbcType=VARCHAR}, username = #{username,jdbcType=VARCHAR},
`password` = #{password,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR},
brand = #{brand,jdbcType=VARCHAR},
direction = #{direction,jdbcType=VARCHAR},
address_unid = #{addressUnid,jdbcType=VARCHAR}, address_unid = #{addressUnid,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
ip = #{ip,jdbcType=VARCHAR}, ip = #{ip,jdbcType=VARCHAR},
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.viontech.fanxing.ops.mapper.ContentMapper" >
<resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.Content" >
<id column="content_id" property="id" />
<result column="content_unid" property="unid" />
<result column="content_name" property="name" />
<result column="content_type" property="type" />
</resultMap>
<resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.Content" extends="BaseResultMapRoot" />
<resultMap id="ResultMapWithBLOBs" type="com.viontech.fanxing.commons.model.Content" extends="BaseResultMap" >
<result column="content_content" property="content" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List_Root" >
`content`.id as content_id, `content`.unid as content_unid, `content`.`name` as `content_name`,
`content`.`type` as `content_type`
</sql>
<sql id="Base_Column_List" >
<if test="!(_parameter.getClass().getSimpleName() == 'ContentExample')" >
<include refid="com.viontech.fanxing.ops.mapper.ContentMapper.Base_Column_List_Root" />
</if>
<if test="_parameter.getClass().getSimpleName() == 'ContentExample'" >
<foreach collection="columnContainerSet" item="columns" separator="," >
<choose >
<when test="columns.tableName == 's_content'.toString()" >
<if test="columns.valid" >
${columns.columnContainerStr}
</if>
<if test="!columns.valid" >
<include refid="com.viontech.fanxing.ops.mapper.ContentMapper.Base_Column_List_Root" />
</if>
</when>
</choose>
</foreach>
</if>
</sql>
<sql id="Blob_Column_List" >
`content`.content as content_content
</sql>
<select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.viontech.fanxing.commons.model.ContentExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from `s_content` `content`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="groupByClause != null" >
group by ${groupByClause}
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.commons.model.ContentExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from `s_content` `content`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="groupByClause != null" >
group by ${groupByClause}
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from `s_content` `content`
where `content`.id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from `s_content` `content`
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.ContentExample" >
delete from `s_content` `content`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.viontech.fanxing.commons.model.Content" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_content` (unid, `name`, `type`,
content)
values (#{unid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Content" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into `s_content`
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="unid != null" >
unid,
</if>
<if test="name != null" >
`name`,
</if>
<if test="type != null" >
`type`,
</if>
<if test="content != null" >
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="unid != null" >
#{unid,jdbcType=VARCHAR},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=VARCHAR},
</if>
<if test="content != null" >
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.viontech.fanxing.commons.model.ContentExample" resultType="java.lang.Integer" >
select count(*) from `s_content` `content`
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update `s_content` `content`
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.unid != null" >
unid = #{record.unid,jdbcType=VARCHAR},
</if>
<if test="record.name != null" >
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.type != null" >
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.content != null" >
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map" >
update `s_content` `content`
set `content`.id = #{record.id,jdbcType=BIGINT},
`content`.unid = #{record.unid,jdbcType=VARCHAR},
`content`.`name` = #{record.name,jdbcType=VARCHAR},
`content`.`type` = #{record.type,jdbcType=VARCHAR},
`content`.content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update `s_content` `content`
set id = #{record.id,jdbcType=BIGINT},
unid = #{record.unid,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.commons.model.Content" >
update `s_content`
<set >
<if test="unid != null" >
unid = #{unid,jdbcType=VARCHAR},
</if>
<if test="name != null" >
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="type != null" >
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="content != null" >
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.viontech.fanxing.commons.model.Content" >
update `s_content`
set unid = #{unid,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.Content" >
update `s_content`
set unid = #{unid,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.service.adapter;
import com.viontech.fanxing.commons.base.BaseService;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.ContentExample;
import java.util.List;
public interface ContentService extends BaseService<Content> {
List<Content> selectByExampleWithBlob(ContentExample contentExample);
}
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.ops.service.impl;
import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseServiceImpl;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.ContentExample;
import com.viontech.fanxing.ops.mapper.ContentMapper;
import com.viontech.fanxing.ops.service.adapter.ContentService;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ContentServiceImpl extends BaseServiceImpl<Content> implements ContentService {
@Resource
private ContentMapper contentMapper;
@Override
public BaseMapper<Content> getMapper() {
return contentMapper;
}
@Override
public List<Content> selectByExampleWithBlob(ContentExample contentExample) {
return contentMapper.selectByExampleWithBLOBs(contentExample);
}
}
\ No newline at end of file \ No newline at end of file
...@@ -31,7 +31,7 @@ public class DictCodeServiceImpl extends BaseServiceImpl<DictCode> implements Di ...@@ -31,7 +31,7 @@ public class DictCodeServiceImpl extends BaseServiceImpl<DictCode> implements Di
} }
@Override @Override
public ImmutablePair<Map<Long,DictCodeVo>,List<DictCodeVo>> getTreeCode(List<DictCode> dictCodes) { public ImmutablePair<Map<Long, DictCodeVo>, List<DictCodeVo>> getTreeCode(List<DictCode> dictCodes) {
Map<Long, DictCodeVo> map = dictCodes.stream().map(DictCodeVo::new).collect(Collectors.toMap(DictCode::getId, x -> x, (x, y) -> x)); Map<Long, DictCodeVo> map = dictCodes.stream().map(DictCodeVo::new).collect(Collectors.toMap(DictCode::getId, x -> x, (x, y) -> x));
......
...@@ -72,7 +72,7 @@ public class VideoService { ...@@ -72,7 +72,7 @@ public class VideoService {
channel.setChannelUnid(unid); channel.setChannelUnid(unid);
channel.setDeviceUnid(unid); channel.setDeviceUnid(unid);
channel.setName(originalFilename); channel.setName(originalFilename);
channel.setStreamPath(video.getPath()); channel.setStreamPath("/uploadVideo/" + filename);
channel.setType(ChannelType.FILE.value); channel.setType(ChannelType.FILE.value);
channel.setStreamType(ChannelType.STREAM_FILE.value); channel.setStreamType(ChannelType.STREAM_FILE.value);
channel.setPort(Math.toIntExact(mbSize)); channel.setPort(Math.toIntExact(mbSize));
......
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId> <artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -2,6 +2,7 @@ package com.viontech.fanxing.task.controller.web; ...@@ -2,6 +2,7 @@ package com.viontech.fanxing.task.controller.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.base.BaseExample; import com.viontech.fanxing.commons.base.BaseExample;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.model.TaskExample; import com.viontech.fanxing.commons.model.TaskExample;
import com.viontech.fanxing.commons.vo.TaskVo; import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.task.controller.base.TaskBaseController; import com.viontech.fanxing.task.controller.base.TaskBaseController;
...@@ -9,6 +10,10 @@ import com.viontech.keliu.util.JsonMessageUtil; ...@@ -9,6 +10,10 @@ import com.viontech.keliu.util.JsonMessageUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/tasks") @RequestMapping("/tasks")
@Slf4j @Slf4j
...@@ -61,4 +66,19 @@ public class TaskController extends TaskBaseController { ...@@ -61,4 +66,19 @@ public class TaskController extends TaskBaseController {
JSONObject overview = taskService.overview(); JSONObject overview = taskService.overview();
return JsonMessageUtil.getSuccessJsonMsg(overview); return JsonMessageUtil.getSuccessJsonMsg(overview);
} }
/**
* 获取所有分配过任务的通道序列号
*
* @return
*/
@GetMapping("channelUnidWithTask")
public JsonMessageUtil.JsonMessage channelUnidWithTask() {
TaskExample taskExample = new TaskExample();
taskExample.createColumns().hasChannelUnidColumn();
List<Task> tasks = taskService.selectByExample(taskExample);
Set<String> collect = tasks.stream().map(Task::getChannelUnid).collect(Collectors.toSet());
return JsonMessageUtil.getSuccessJsonMsg(collect);
}
} }
\ No newline at end of file \ No newline at end of file
package com.viontech.fanxing.task.feign; package com.viontech.fanxing.task.feign;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.StoreConfig; import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.keliu.util.JsonMessageUtil; import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/** /**
* . * .
...@@ -21,4 +27,14 @@ public interface OpsClient { ...@@ -21,4 +27,14 @@ public interface OpsClient {
@GetMapping("/storeConfigs/{id}") @GetMapping("/storeConfigs/{id}")
JsonMessageUtil.JsonMessage<StoreConfig> getStoreConfigById(@PathVariable("id") Long storeConfigId); JsonMessageUtil.JsonMessage<StoreConfig> getStoreConfigById(@PathVariable("id") Long storeConfigId);
@GetMapping("/contents")
JsonMessageUtil.JsonMessage<List<Content>> getContentByName(@RequestParam("name") String name);
@GetMapping("/channels")
JsonMessageUtil.JsonMessage<List<Channel>> getChannelByChannelUnid(@RequestParam("channelUnid") String channelUnid);
@GetMapping("/dictCodes")
JsonMessageUtil.JsonMessage<List<DictCode>> getDictCodeByUnid(@RequestParam("unid") String unid);
} }
package com.viontech.fanxing.task.model;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/9/26
*/
public class ConfigBuilder {
private static final Logger log = LoggerFactory.getLogger(ConfigBuilder.class);
private Document document;
private String build;
private boolean vChanInfoBuilt;
private boolean defaultConfigBuilt;
public ConfigBuilder() {
document = DocumentHelper.createDocument();
document.setRootElement(DocumentHelper.createElement("root"));
}
public void setText(Element element, String name, String text) {
Element e = element.element(name);
if (e == null) {
e = element.addElement(name);
}
e.clearContent();
e.setText(text);
}
public String build() {
try {
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("GBK");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
XMLWriter xmlWriter = new XMLWriter(byteArrayOutputStream, format);
xmlWriter.write(document);
build = new String(byteArrayOutputStream.toByteArray(), Charset.forName("GBK"));
} catch (Exception e) {
log.error("", e);
}
log.debug("xmh:构建默认配置完成:{}", build);
return build;
}
public ConfigBuilder buildDefaultConfig(String defaultConfig) {
if (defaultConfigBuilt) {
return this;
}
try {
SAXReader saxReader = new SAXReader();
Document defaultDoc = saxReader.read(new ByteArrayInputStream(defaultConfig.getBytes(Charset.forName("GBK"))));
Element defaultRoot = defaultDoc.getRootElement();
Element root = document.getRootElement();
List<Element> defE = defaultRoot.elements();
for (Element element : defE) {
Element copy = element.createCopy();
root.add(copy);
}
defaultConfigBuilt = true;
} catch (Exception e) {
log.error("", e);
}
return this;
}
public ConfigBuilder buildVchanInfo(String name, String channelUnid, String addressUnid, String addressName) {
if (vChanInfoBuilt) {
return this;
}
try {
// 构建默认配置
Element rootElement = document.getRootElement();
Element deviceConfig = rootElement.element("设备配置");
if (deviceConfig == null) {
deviceConfig = rootElement.addElement("设备配置");
}
setText(deviceConfig, "设备名称", name);
setText(deviceConfig, "设备编号", channelUnid);
if (addressUnid != null) {
setText(deviceConfig, "地点名称", addressUnid);
setText(deviceConfig, "地点编号", addressName);
}
this.vChanInfoBuilt = true;
} catch (Exception e) {
log.error("", e);
}
return this;
}
}
package com.viontech.fanxing.task.model;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.UUID;
/**
* .
*
* @author 谢明辉
* @date 2021/9/28
*/
@Getter
@Setter
@Accessors(chain = true)
public class Scene {
private String algo_type;
/** 标定,后端不需要关心 */
private Calibration calibration;
/** 配置信息 */
private Config config;
private String position_name;
private String position_num;
private String scene_unid = UUID.randomUUID().toString();
private String vchan_refid;
private Integer runtime = -1;
private PlayUrls play_urls;
public static class Calibration {
private String calibration;
public String getCalibration() {
return calibration;
}
public Calibration setCalibration(String calibration) {
this.calibration = calibration;
return this;
}
}
public static class Config {
private String xml;
public String getXml() {
return xml;
}
public Config setXml(String xml) {
this.xml = xml;
return this;
}
}
public static class PlayUrls {
private String rtsp;
private String http;
public String getHttp() {
return http;
}
public PlayUrls setHttp(String http) {
this.http = http;
return this;
}
public String getRtsp() {
return rtsp;
}
public PlayUrls setRtsp(String rtsp) {
this.rtsp = rtsp;
return this;
}
}
}
...@@ -8,6 +8,7 @@ import com.viontech.fanxing.task.service.TaskDataService; ...@@ -8,6 +8,7 @@ import com.viontech.fanxing.task.service.TaskDataService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -22,6 +23,7 @@ import java.util.List; ...@@ -22,6 +23,7 @@ import java.util.List;
@Component @Component
@Slf4j @Slf4j
@Profile("!test")
public class TaskInitRunner implements CommandLineRunner { public class TaskInitRunner implements CommandLineRunner {
@Resource @Resource
......
package com.viontech.fanxing.task.service;
import com.viontech.fanxing.commons.exception.FanXingException;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.Content;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.task.feign.OpsClient;
import com.viontech.keliu.util.JsonMessageUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* .
*
* @author 谢明辉
* @date 2021/9/28
*/
@Service
public class OpsClientService {
@Resource
private OpsClient opsClient;
public StoreConfig getStoreConfigById(Long id) {
JsonMessageUtil.JsonMessage<StoreConfig> res = opsClient.getStoreConfigById(id);
if (res.getCode() != 200) {
throw new FanXingException(res.getMsg());
} else {
return res.getData();
}
}
public String getContentByName(String name) {
JsonMessageUtil.JsonMessage<List<Content>> res = opsClient.getContentByName(name);
if (res.getCode() != 200) {
throw new FanXingException(res.getMsg());
} else {
List<Content> data = res.getData();
return (data == null || data.size() == 0) ? null : data.get(0).getContent();
}
}
public Channel getChannelByChannelUnid(String channelUnid) {
JsonMessageUtil.JsonMessage<List<Channel>> res = opsClient.getChannelByChannelUnid(channelUnid);
if (res.getCode() != 200) {
throw new FanXingException(res.getMsg());
} else {
List<Channel> data = res.getData();
return (data == null || data.size() == 0) ? null : data.get(0);
}
}
public DictCode getDictCodeByUnid(String unid) {
JsonMessageUtil.JsonMessage<List<DictCode>> res = opsClient.getDictCodeByUnid(unid);
if (res.getCode() != 200) {
throw new FanXingException(res.getMsg());
} else {
List<DictCode> data = res.getData();
return (data == null || data.size() == 0) ? null : data.get(0);
}
}
}
...@@ -4,12 +4,10 @@ import com.viontech.fanxing.commons.exception.FanXingException; ...@@ -4,12 +4,10 @@ import com.viontech.fanxing.commons.exception.FanXingException;
import com.viontech.fanxing.commons.model.StoreConfig; import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.service.RedisService; import com.viontech.fanxing.commons.service.RedisService;
import com.viontech.fanxing.task.feign.OpsClient;
import com.viontech.fanxing.task.model.RuntimeConfig; import com.viontech.fanxing.task.model.RuntimeConfig;
import com.viontech.fanxing.task.model.TaskData; import com.viontech.fanxing.task.model.TaskData;
import com.viontech.fanxing.task.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.repository.TaskDataRedisRepository; import com.viontech.fanxing.task.repository.TaskDataRedisRepository;
import com.viontech.keliu.util.JsonMessageUtil;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.redisson.api.RMap; import org.redisson.api.RMap;
import org.redisson.api.RScoredSortedSet; import org.redisson.api.RScoredSortedSet;
...@@ -33,18 +31,17 @@ public class TaskDataService { ...@@ -33,18 +31,17 @@ public class TaskDataService {
@Resource @Resource
private TaskDataRedisRepository taskDataRedisRepository; private TaskDataRedisRepository taskDataRedisRepository;
@Resource @Resource
private OpsClient opsClient; private OpsClientService opsClientService;
public void addTask(Task task) { public void addTask(Task task) {
TaskData taskData = new TaskData(task); TaskData taskData = new TaskData(task);
// 获取存储配置 // 获取存储配置
Long storeConfigId = task.getStoreConfigId(); Long storeConfigId = task.getStoreConfigId();
JsonMessageUtil.JsonMessage<StoreConfig> storeConfigRes = opsClient.getStoreConfigById(storeConfigId); StoreConfig storeConfig = opsClientService.getStoreConfigById(storeConfigId);
StoreConfig storeConfigVo = storeConfigRes.getData(); if (storeConfig == null) {
if (storeConfigVo == null) {
throw new FanXingException("无法获取对应的存储配置"); throw new FanXingException("无法获取对应的存储配置");
} }
taskData.setStoreConfig(storeConfigVo.getContent()); taskData.setStoreConfig(storeConfig.getContent());
taskDataRedisRepository.addOrUpdateTaskData(taskData); taskDataRedisRepository.addOrUpdateTaskData(taskData);
// 计算运行时间并生成任务 // 计算运行时间并生成任务
boolean success = distributeTask(taskData); boolean success = distributeTask(taskData);
......
package com.viontech.fanxing.task.service.impl; package com.viontech.fanxing.task.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.base.BaseMapper; import com.viontech.fanxing.commons.base.BaseMapper;
import com.viontech.fanxing.commons.base.BaseServiceImpl; import com.viontech.fanxing.commons.base.BaseServiceImpl;
import com.viontech.fanxing.commons.base.LocalCache; import com.viontech.fanxing.commons.base.LocalCache;
import com.viontech.fanxing.commons.constant.TaskStatus; import com.viontech.fanxing.commons.constant.TaskStatus;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.model.TaskExample; import com.viontech.fanxing.commons.model.TaskExample;
import com.viontech.fanxing.commons.vo.TaskVo; import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.task.mapper.TaskMapper; import com.viontech.fanxing.task.mapper.TaskMapper;
import com.viontech.fanxing.task.model.ConfigBuilder;
import com.viontech.fanxing.task.model.Scene;
import com.viontech.fanxing.task.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.service.OpsClientService;
import com.viontech.fanxing.task.service.TaskDataService; import com.viontech.fanxing.task.service.TaskDataService;
import com.viontech.fanxing.task.service.VAServerService; import com.viontech.fanxing.task.service.VAServerService;
import com.viontech.fanxing.task.service.adapter.TaskService; import com.viontech.fanxing.task.service.adapter.TaskService;
...@@ -32,6 +38,8 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic ...@@ -32,6 +38,8 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic
private TaskDataService taskDataService; private TaskDataService taskDataService;
@Resource @Resource
private VAServerService vaServerService; private VAServerService vaServerService;
@Resource
private OpsClientService opsClientService;
@Override @Override
public BaseMapper<Task> getMapper() { public BaseMapper<Task> getMapper() {
...@@ -41,11 +49,65 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic ...@@ -41,11 +49,65 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public TaskVo addTask(Task task) { public TaskVo addTask(Task task) {
buildTask(task);
task = insertSelective(task); task = insertSelective(task);
task = selectByPrimaryKey(task.getId()); task = selectByPrimaryKey(task.getId());
return new TaskVo(task); return new TaskVo(task);
} }
private void buildTask(Task task) {
String channelUnid = task.getChannelUnid();
Channel channel = opsClientService.getChannelByChannelUnid(channelUnid);
String streamPath = task.getStreamPath();
if (streamPath == null) {
streamPath = channel.getStreamPath();
task.setStreamPath(channel.getStreamPath());
}
JSONArray sceneArray = new JSONArray();
String algType = task.getAlgType();
String addressName = null;
String addressUnid = channel.getAddressUnid();
if (addressUnid != null) {
DictCode dictCode = opsClientService.getDictCodeByUnid(addressUnid);
addressName = dictCode.getName();
}
int sceneNum;
String content;
if ("3".equals(algType)) {
content = opsClientService.getContentByName("illegalStopDefaultConfig");
sceneNum = 5;
} else {
content = opsClientService.getContentByName("defaultConfig");
sceneNum = 1;
}
ConfigBuilder configBuilder = new ConfigBuilder().buildVchanInfo(channel.getName(), channelUnid, addressUnid, addressName);
if (content != null) {
configBuilder.buildDefaultConfig(content);
}
String xml = configBuilder.build();
for (int i = 1; i < sceneNum + 1; i++) {
Scene.Config config = new Scene.Config().setXml(xml);
Scene.PlayUrls playUrls = new Scene.PlayUrls();
Scene scene = new Scene()
.setPosition_num(String.valueOf(i))
.setPosition_name(String.valueOf(i))
.setVchan_refid(channelUnid)
.setAlgo_type(algType)
.setConfig(config)
.setPlay_urls(playUrls);
if (streamPath.contains("http")) {
playUrls.setHttp(streamPath);
} else {
playUrls.setRtsp(streamPath);
}
sceneArray.add(scene);
}
String sceneString = sceneArray.toJSONString();
task.setScene(sceneString);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public TaskVo updateTask(Task task) { public TaskVo updateTask(Task task) {
...@@ -88,12 +150,7 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic ...@@ -88,12 +150,7 @@ public class TaskServiceImpl extends BaseServiceImpl<Task> implements TaskServic
if (task.getStoreConfigId() == null) { if (task.getStoreConfigId() == null) {
throw new IllegalArgumentException("存储配置为空,无法执行"); throw new IllegalArgumentException("存储配置为空,无法执行");
} }
updateStatus(id, TaskStatus.PAUSE.val);
TaskVo taskVo = new TaskVo();
taskVo.setStatus(TaskStatus.PAUSE.val);
taskVo.setId(id);
updateByPrimaryKeySelective(taskVo);
taskDataService.addTask(task); taskDataService.addTask(task);
} }
......
package com.viontech.fanxing.task; package com.viontech.fanxing.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.viontech.fanxing.commons.model.Channel;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.task.service.OpsClientService;
import com.viontech.fanxing.task.service.impl.TaskServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
/** /**
* . * .
* *
...@@ -7,7 +24,26 @@ package com.viontech.fanxing.task; ...@@ -7,7 +24,26 @@ package com.viontech.fanxing.task;
* @date 2021/7/21 * @date 2021/7/21
*/ */
@SpringBootTest
@RunWith(SpringRunner.class)
@ActiveProfiles("test")
public class MainTest { public class MainTest {
@Resource
private OpsClientService opsClientService;
@Resource
private TaskServiceImpl taskService;
@Test
public void opsClientTest() {
DictCode nvs3000 = opsClientService.getDictCodeByUnid("460b359f-0bc6-11ec-a74d-0242ac11001d");
Channel channel = opsClientService.getChannelByChannelUnid("2200001201000D01");
String defaultConfig = opsClientService.getContentByName("defaultConfig");
System.out.println(JSON.toJSONString(nvs3000));
System.out.println(JSON.toJSONString(channel));
System.out.println(JSON.toJSONString(defaultConfig));
}
} }
...@@ -5,14 +5,11 @@ import com.viontech.fanxing.commons.constant.TaskStatus; ...@@ -5,14 +5,11 @@ import com.viontech.fanxing.commons.constant.TaskStatus;
import com.viontech.fanxing.commons.model.StoreConfig; import com.viontech.fanxing.commons.model.StoreConfig;
import com.viontech.fanxing.commons.model.Task; import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.service.RedisService; import com.viontech.fanxing.commons.service.RedisService;
import com.viontech.fanxing.commons.vo.TaskVo;
import com.viontech.fanxing.task.model.TaskData; import com.viontech.fanxing.task.model.TaskData;
import com.viontech.fanxing.task.feign.OpsClient;
import com.viontech.fanxing.task.model.vaserver.VaServerInfo; import com.viontech.fanxing.task.model.vaserver.VaServerInfo;
import com.viontech.fanxing.task.repository.TaskDataRedisRepository; import com.viontech.fanxing.task.repository.TaskDataRedisRepository;
import com.viontech.fanxing.task.repository.VAServerRedisRepository; import com.viontech.fanxing.task.repository.VAServerRedisRepository;
import com.viontech.fanxing.task.service.adapter.TaskService; import com.viontech.fanxing.task.service.adapter.TaskService;
import com.viontech.keliu.util.JsonMessageUtil;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -42,11 +39,13 @@ class VAServerHttpServiceTest { ...@@ -42,11 +39,13 @@ class VAServerHttpServiceTest {
private VAServerRedisRepository vaServerRedisRepository; private VAServerRedisRepository vaServerRedisRepository;
@Resource @Resource
private OpsClient opsClient; private OpsClientService opsClientService;
private VaServerInfo vaServerInfo; private VaServerInfo vaServerInfo;
private TaskData taskData; private TaskData taskData;
@Resource @Resource
private TaskService taskService; private TaskService taskService;
@Resource
private TaskDataRedisRepository taskDataRedisRepository;
@BeforeEach @BeforeEach
public void before() { public void before() {
...@@ -57,7 +56,6 @@ class VAServerHttpServiceTest { ...@@ -57,7 +56,6 @@ class VAServerHttpServiceTest {
this.taskData.setTask(task); this.taskData.setTask(task);
} }
@Test @Test
void snapshot() { void snapshot() {
vaServerHttpService.snapshot(TASK_UNID, vaServerInfo); vaServerHttpService.snapshot(TASK_UNID, vaServerInfo);
...@@ -95,9 +93,8 @@ class VAServerHttpServiceTest { ...@@ -95,9 +93,8 @@ class VAServerHttpServiceTest {
@Test @Test
void storeConfig() { void storeConfig() {
JsonMessageUtil.JsonMessage<StoreConfig> storeConfigById = opsClient.getStoreConfigById(6L); StoreConfig storeConfig = opsClientService.getStoreConfigById(6L);
System.out.println(JSON.toJSONString(storeConfig));
System.out.println(JSON.toJSONString(storeConfigById.getData()));
} }
@Test @Test
...@@ -105,8 +102,6 @@ class VAServerHttpServiceTest { ...@@ -105,8 +102,6 @@ class VAServerHttpServiceTest {
} }
@Resource
private TaskDataRedisRepository taskDataRedisRepository;
@Test @Test
void test() throws Exception { void test() throws Exception {
// RMap<String, String> taskVaServerMap = redisService.getTaskVaServerMap(); // RMap<String, String> taskVaServerMap = redisService.getTaskVaServerMap();
......
...@@ -25,27 +25,45 @@ ...@@ -25,27 +25,45 @@
<property name="forceBigDecimals" value="false"/> <property name="forceBigDecimals" value="false"/>
</javaTypeResolver> </javaTypeResolver>
<!-- 生成模型的包名和位置--> <!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.viontech.fanxing.code.model" targetProject="F:\mybatis-generator\fanxing-code"> <javaModelGenerator targetPackage="com.viontech.fanxing.commons.model" targetProject="F:\mybatis-generator\fanxing-ops">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
<property name="rootClass" value="com.viontech.fanxing.commons.base.BaseModel"/> <property name="rootClass" value="com.viontech.fanxing.commons.base.BaseModel"/>
</javaModelGenerator> </javaModelGenerator>
<!-- 生成映射文件的包名和位置--> <!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="com.viontech.fanxing.code.mapping" targetProject="F:\mybatis-generator\fanxing-code"> <sqlMapGenerator targetPackage="com.viontech.fanxing.commons.mapping" targetProject="F:\mybatis-generator\fanxing-ops">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</sqlMapGenerator> </sqlMapGenerator>
<!-- 生成DAO的包名和位置--> <!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.viontech.fanxing.code.mapper" targetProject="F:\mybatis-generator\fanxing-code" > <javaClientGenerator type="XMLMAPPER" targetPackage="com.viontech.fanxing.ops.mapper" targetProject="F:\mybatis-generator\fanxing-ops" >
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/> <property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/>
</javaClientGenerator> </javaClientGenerator>
<table delimitIdentifiers="true" tableName="s_forward" alias="forward" domainObjectName="Forward">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="s_forward_config" alias="forwardConfig" domainObjectName="ForwardConfig">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="s_channel" alias="channel" domainObjectName="Channel">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="r_channel_tag" alias="channel_tag" domainObjectName="ChannelTag">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="s_store_config" alias="storeConfig" domainObjectName="StoreConfig">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="s_dict_cate" alias="dictCate" domainObjectName="DictCate"> <table delimitIdentifiers="true" tableName="s_dict_cate" alias="dictCate" domainObjectName="DictCate">
<generatedKey column="id" sqlStatement="JDBC"/> <generatedKey column="id" sqlStatement="JDBC"/>
</table> </table>
<table delimitIdentifiers="true" tableName="s_dict_code" alias="dictCode" domainObjectName="DictCode"> <table delimitIdentifiers="true" tableName="s_dict_code" alias="dictCode" domainObjectName="DictCode">
<generatedKey column="id" sqlStatement="JDBC"/> <generatedKey column="id" sqlStatement="JDBC"/>
</table> </table>
<table delimitIdentifiers="true" tableName="s_content" alias="content" domainObjectName="Content">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
...@@ -40,14 +40,7 @@ ...@@ -40,14 +40,7 @@
<property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/> <property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/>
</javaClientGenerator> </javaClientGenerator>
<table delimitIdentifiers="true" tableName="s_forward" alias="forward" domainObjectName="Forward">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="s_forward_config" alias="forwardConfig" domainObjectName="ForwardConfig">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
<table delimitIdentifiers="true" tableName="d_behavior" alias="behavior" domainObjectName="Behavior"> <table delimitIdentifiers="true" tableName="d_behavior" alias="behavior" domainObjectName="Behavior">
<generatedKey column="id" sqlStatement="JDBC"/> <generatedKey column="id" sqlStatement="JDBC"/>
</table> </table>
......
...@@ -25,17 +25,17 @@ ...@@ -25,17 +25,17 @@
<property name="forceBigDecimals" value="false"/> <property name="forceBigDecimals" value="false"/>
</javaTypeResolver> </javaTypeResolver>
<!-- 生成模型的包名和位置--> <!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.viontech.fanxing.task.manager.model" targetProject="F:\mybatis-generator\fanxing-task"> <javaModelGenerator targetPackage="com.viontech.fanxing.commons.model" targetProject="F:\mybatis-generator\fanxing-task">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
<property name="rootClass" value="com.viontech.fanxing.commons.base.BaseModel"/> <property name="rootClass" value="com.viontech.fanxing.commons.base.BaseModel"/>
</javaModelGenerator> </javaModelGenerator>
<!-- 生成映射文件的包名和位置--> <!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="com.viontech.fanxing.task.manager.mapping" targetProject="F:\mybatis-generator\fanxing-task"> <sqlMapGenerator targetPackage="com.viontech.fanxing.task.mapping" targetProject="F:\mybatis-generator\fanxing-task">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</sqlMapGenerator> </sqlMapGenerator>
<!-- 生成DAO的包名和位置--> <!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.viontech.fanxing.task.manager.mapper" targetProject="F:\mybatis-generator\fanxing-task" > <javaClientGenerator type="XMLMAPPER" targetPackage="com.viontech.fanxing.task.mapper" targetProject="F:\mybatis-generator\fanxing-task" >
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/> <property name="rootInterface" value="com.viontech.fanxing.commons.base.BaseMapper"/>
</javaClientGenerator> </javaClientGenerator>
...@@ -44,8 +44,5 @@ ...@@ -44,8 +44,5 @@
<table delimitIdentifiers="true" tableName="s_task" alias="task" domainObjectName="Task"> <table delimitIdentifiers="true" tableName="s_task" alias="task" domainObjectName="Task">
<generatedKey column="id" sqlStatement="JDBC"/> <generatedKey column="id" sqlStatement="JDBC"/>
</table> </table>
<table delimitIdentifiers="true" tableName="s_store_config" alias="storeConfig" domainObjectName="StoreConfig">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
...@@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS s_task( ...@@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS s_task(
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
name VARCHAR(128) NOT NULL COMMENT '任务名称', name VARCHAR(128) NOT NULL COMMENT '任务名称',
alg_type VARCHAR(36) NOT NULL COMMENT '算法类型', alg_type VARCHAR(36) NOT NULL COMMENT '算法类型',
alg_enabled VARCHAR(32) COMMENT '已启用的算法类型',
resource_need FLOAT NOT NULL COMMENT '任务所需资源数量', resource_need FLOAT NOT NULL COMMENT '任务所需资源数量',
priority INT NOT NULL DEFAULT 0 COMMENT '任务优先级', priority INT NOT NULL DEFAULT 0 COMMENT '任务优先级',
store_config_id BIGINT NOT NULL COMMENT '存储配置id', store_config_id BIGINT NOT NULL COMMENT '存储配置id',
...@@ -18,7 +19,7 @@ CREATE TABLE IF NOT EXISTS s_task( ...@@ -18,7 +19,7 @@ CREATE TABLE IF NOT EXISTS s_task(
scene TEXT COMMENT '场景配置,包含画线预置位等', scene TEXT COMMENT '场景配置,包含画线预置位等',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
status INT NOT NULL DEFAULT 0 COMMENT '任务状态', status INT NOT NULL DEFAULT 0 COMMENT '任务状态',
INDEX s_task_name(name) INDEX s_task_unid_idx(unid)
); );
...@@ -31,7 +32,8 @@ CREATE TABLE IF NOT EXISTS s_store_config( ...@@ -31,7 +32,8 @@ CREATE TABLE IF NOT EXISTS s_store_config(
content_format INT NOT NULL COMMENT '配置内容格式,如xml', content_format INT NOT NULL COMMENT '配置内容格式,如xml',
content TEXT NOT NULL COMMENT '配置内容', content TEXT NOT NULL COMMENT '配置内容',
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
status INT NOT NULL DEFAULT 0 COMMENT '状态' status INT NOT NULL DEFAULT 0 COMMENT '状态',
INDEX s_store_config_unid_idx(unid)
); );
...@@ -57,7 +59,8 @@ CREATE TABLE IF NOT EXISTS s_forward_config( ...@@ -57,7 +59,8 @@ CREATE TABLE IF NOT EXISTS s_forward_config(
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
forward_id BIGINT NOT NULL COMMENT '转发信息id', forward_id BIGINT NOT NULL COMMENT '转发信息id',
event_cate VARCHAR(36) NOT NULL, event_cate VARCHAR(36) NOT NULL,
event_type VARCHAR(36) NOT NULL event_type VARCHAR(36) NOT NULL,
INDEX s_forward_config_forward_id_idx(forward_id)
); );
...@@ -94,7 +97,9 @@ CREATE TABLE IF NOT EXISTS d_traffic( ...@@ -94,7 +97,9 @@ CREATE TABLE IF NOT EXISTS d_traffic(
pics VARCHAR(2048), pics VARCHAR(2048),
video_name VARCHAR(256), video_name VARCHAR(256),
status INT NOT NULL DEFAULT 0 COMMENT '状态', status INT NOT NULL DEFAULT 0 COMMENT '状态',
PRIMARY KEY(id,event_time) PRIMARY KEY(id,event_time),
INDEX d_traffic_unid_idx(unid),
INDEX d_traffic_select_idx(event_time,event_type,vehicle_type)
); );
-- d_traffic_face -- d_traffic_face
...@@ -108,7 +113,7 @@ CREATE TABLE IF NOT EXISTS d_traffic_face( ...@@ -108,7 +113,7 @@ CREATE TABLE IF NOT EXISTS d_traffic_face(
sex SMALLINT NOT NULL DEFAULT 0, sex SMALLINT NOT NULL DEFAULT 0,
upper_color VARCHAR(36), upper_color VARCHAR(36),
lower_color VARCHAR(36), lower_color VARCHAR(36),
INDEX s_task_name(traffic_id), INDEX traffic_face_traffic_id_idx(traffic_id),
PRIMARY KEY(id,event_time) PRIMARY KEY(id,event_time)
); );
...@@ -141,7 +146,8 @@ CREATE TABLE IF NOT EXISTS d_flow_data( ...@@ -141,7 +146,8 @@ CREATE TABLE IF NOT EXISTS d_flow_data(
dist_time FLOAT, dist_time FLOAT,
time_occupy FLOAT, time_occupy FLOAT,
status INT NOT NULL DEFAULT 0 COMMENT '状态', status INT NOT NULL DEFAULT 0 COMMENT '状态',
PRIMARY KEY(id,event_time) PRIMARY KEY(id,event_time),
INDEX flow_data_select_idx(flow_event_id)
); );
...@@ -161,7 +167,8 @@ CREATE TABLE IF NOT EXISTS d_flow_event( ...@@ -161,7 +167,8 @@ CREATE TABLE IF NOT EXISTS d_flow_event(
json_data TEXT, json_data TEXT,
pics VARCHAR(2048), pics VARCHAR(2048),
video_name VARCHAR(256), video_name VARCHAR(256),
PRIMARY KEY(id,event_time) PRIMARY KEY(id,event_time),
INDEX flow_event_select_idx(event_time,event_type)
); );
...@@ -181,7 +188,8 @@ CREATE TABLE IF NOT EXISTS d_behavior( ...@@ -181,7 +188,8 @@ CREATE TABLE IF NOT EXISTS d_behavior(
channel_unid VARCHAR(36), channel_unid VARCHAR(36),
task_name VARCHAR(128), task_name VARCHAR(128),
event_data_num VARCHAR(36), event_data_num VARCHAR(36),
PRIMARY KEY(id,event_time) PRIMARY KEY(id,event_time),
INDEX behavior_select_idx(event_time,event_type,event_cate)
); );
-- s_dict_cate -- s_dict_cate
...@@ -189,10 +197,11 @@ CREATE TABLE IF NOT EXISTS d_behavior( ...@@ -189,10 +197,11 @@ CREATE TABLE IF NOT EXISTS d_behavior(
CREATE TABLE IF NOT EXISTS s_dict_cate( CREATE TABLE IF NOT EXISTS s_dict_cate(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
type VARCHAR(36) COMMENT '分类' type VARCHAR(36) COMMENT '分类',
code VARCHAR(36) COMMENT 'cate编码', code VARCHAR(36) COMMENT 'cate编码',
name VARCHAR(36) NOT NULL COMMENT 'cate名称', name VARCHAR(36) NOT NULL COMMENT 'cate名称',
note VARCHAR(36) COMMENT '注释' note VARCHAR(36) COMMENT '注释',
INDEX s_dict_cate_type_idx(type)
); );
...@@ -206,7 +215,8 @@ CREATE TABLE IF NOT EXISTS s_dict_code( ...@@ -206,7 +215,8 @@ CREATE TABLE IF NOT EXISTS s_dict_code(
code VARCHAR(36) COMMENT 'code编码', code VARCHAR(36) COMMENT 'code编码',
name VARCHAR(36) NOT NULL COMMENT 'code名称', name VARCHAR(36) NOT NULL COMMENT 'code名称',
note VARCHAR(36) COMMENT '注释', note VARCHAR(36) COMMENT '注释',
INDEX s_dict_code(cate_id) CONSTRAINT `s_dict_code_cate_id_frk` FOREIGN KEY (`cate_id`) REFERENCES `fanxing3`.`s_dict_cate` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
INDEX s_dict_code_idx(cate_id)
); );
-- s_channel -- s_channel
...@@ -214,23 +224,67 @@ CREATE TABLE IF NOT EXISTS s_dict_code( ...@@ -214,23 +224,67 @@ CREATE TABLE IF NOT EXISTS s_dict_code(
CREATE TABLE IF NOT EXISTS s_channel( CREATE TABLE IF NOT EXISTS s_channel(
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()), unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
channel_unid VARCHAR(64) NOT NULL, channel_unid VARCHAR(64) NOT NULL COMMENT '设备中每一路视频通道本身的编码',
device_unid VARCHAR(64) NOT NULL, device_unid VARCHAR(64) COMMENT '设备自身的编码',
type INT NOT NULL default 0, type INT NOT NULL default 0 COMMENT '设备信息来源类型,0手动添加,1平台拉取,2视频资源上传',
stream_type INT, stream_type INT COMMENT '视频流类型,例如rtsp,http,rtmp等',
stream_path VARCHAR(1024), stream_path VARCHAR(1024) COMMENT '视频流地址',
username VARCHAR(36), username VARCHAR(36) COMMENT '获取视频流所需的用户名',
password VARCHAR(64), password VARCHAR(64) COMMENT '获取视频流所需的密码',
address_unid VARCHAR(36), brand varchar(64) COMMENT '品牌/厂家',
name VARCHAR(128), direction varchar(64) COMMENT '方向',
ip VARCHAR(36), address_unid VARCHAR(36) COMMENT '绑定的组织结构,组织结构在字典表中',
port INT, name VARCHAR(128) COMMENT '名称',
expand VARCHAR(128), ip VARCHAR(36) COMMENT 'ip地址',
port INT COMMENT '端口号',
expand VARCHAR(128) COMMENT '扩展字段,保存一些不重要的信息',
longitude FLOAT, longitude FLOAT,
latitude FLOAT, latitude FLOAT,
status INT NOT NULL DEFAULT 0, status INT NOT NULL DEFAULT 0,
INDEX s_channel(channel_unid) create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
INDEX s_channel_channel_unid_idx(channel_unid),
INDEX s_cahnnel_unid_idx(unid)
);
-- r_channel_tag
CREATE TABLE IF NOT EXISTS r_channel_tag (
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
channel_id BIGINT NOT NULL COMMENT '对应channel表的id',
tag_id BIGINT NOT NULL COMMENT 'tag也在字典表中',
CONSTRAINT `r_channel_tag_channel_id_frk` FOREIGN KEY (`channel_id`) REFERENCES `fanxing3`.`s_channel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
INDEX r_channel_tag_channel_id_idx(channel_id),
INDEX r_channel_tag_tag_id_idx(tag_id)
);
-- s_content
CREATE TABLE IF NOT EXISTS s_content (
id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
unid VARCHAR(36) NOT NULL DEFAULT (UUID()),
name VARCHAR(64) NOT NULL COMMENT '名称',
type VARCHAR(32) COMMENT '分组',
content TEXT COMMENT '内容'
); );
insert into s_content(name, content ,type)
values ('defaultConfig',
'<?xml version="1.0" encoding="GBK"?><root><算法参数设置><车牌识别><车牌缩放比率>0.8000</车牌缩放比率><本地车牌首字母>1</本地车牌首字母><车牌最小宽度>60</车牌最小宽度><车牌最大宽度>180</车牌最大宽度><本地汉字>20</本地汉字><是否识别新能源车牌>0</是否识别新能源车牌></车牌识别><是否启用高速模式>0</是否启用高速模式><调试信息><字体大小>20</字体大小><是否显示Scale>0</是否显示Scale><是否显示耗时>0</是否显示耗时><是否显示版本>0</是否显示版本></调试信息><车牌宽度范围设定方法>1</车牌宽度范围设定方法></算法参数设置><短时录像设置><启用>1</启用><是否画框>1</是否画框><向前录像时间>10</向前录像时间><向后录像时间>10</向后录像时间><录像最大缓存时间>100</录像最大缓存时间></短时录像设置><功能配置><抓拍参数配置><路口电警><卡口><输出卡口图片>1</输出卡口图片><卡口抓两张图>0</卡口抓两张图><上行物体不输出卡口结果>0</上行物体不输出卡口结果><下行物体不输出卡口结果>0</下行物体不输出卡口结果><无牌车辆不输出卡口结果>0</无牌车辆不输出卡口结果><行人非机动车不输出卡口结果>0</行人非机动车不输出卡口结果></卡口></路口电警></抓拍参数配置></功能配置><车辆属性识别><识别车辆类型>1</识别车辆类型><识别车标>1</识别车标><识别车身颜色>1</识别车身颜色><识别驾驶员>1</识别驾驶员><识别危险品标识>1</识别危险品标识></车辆属性识别></root>',
'defaultConfig');
insert into s_content(name, content ,type)
values ('defaultConfigTemplate',
'<?xml version="1.0" encoding="GBK"?><root><短时录像设置><启用><AttribType>4</AttribType><AttribInfo>是否开启录像</AttribInfo><AttribDefault>0</AttribDefault><AttribRange /></启用><是否画框><AttribType>4</AttribType><AttribInfo>是否画框</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></是否画框><向前录像时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>5</AttribDefault><AttribRange>0-1000</AttribRange></向前录像时间><向后录像时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>5</AttribDefault><AttribRange>0-1000</AttribRange></向后录像时间><录像最大缓存时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>60</AttribDefault><AttribRange>0-1000</AttribRange></录像最大缓存时间></短时录像设置><车辆属性识别><识别车辆类型><AttribType>4</AttribType><AttribInfo>识别车辆类型</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车辆类型><识别车标><AttribType>4</AttribType><AttribInfo>识别车标</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车标><识别车身颜色><AttribType>4</AttribType><AttribInfo>识别车身颜色</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车身颜色><识别驾驶员><AttribType>4</AttribType><AttribInfo>识别驾驶员</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别驾驶员><识别危险品标识><AttribType>4</AttribType><AttribInfo>识别危险品标识</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别危险品标识></车辆属性识别><功能配置><抓拍参数配置><路口电警><卡口><输出卡口图片><AttribType>4</AttribType><AttribInfo/><AttribDefault>1</AttribDefault><AttribRange /></输出卡口图片><卡口抓两张图><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></卡口抓两张图><上行物体不输出卡口结果><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></上行物体不输出卡口结果><下行物体不输出卡口结果><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></下行物体不输出卡口结果><无牌车辆不输出卡口结果><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></无牌车辆不输出卡口结果><行人非机动车不输出卡口结果><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></行人非机动车不输出卡口结果></卡口></路口电警></抓拍参数配置></功能配置><算法参数设置><是否启用高速模式><AttribType>4</AttribType><AttribInfo>应用于车辆通常速度较高且视频卡顿场景</AttribInfo><AttribDefault>0</AttribDefault><AttribRange /></是否启用高速模式><车牌识别><车牌缩放比率><AttribType>1</AttribType><AttribInfo>适用非机动车和摩托车,车牌宽目标40-80像素</AttribInfo><AttribDefault>0.800000</AttribDefault><AttribRange>0.300000-3.000000</AttribRange></车牌缩放比率><本地车牌首字母><AttribType>3</AttribType><AttribInfo>只摩托车</AttribInfo><AttribDefault>0</AttribDefault><AttribRange>26:0-A&amp;1-B&amp;2-C&amp;3-D&amp;4-E&amp;5-F&amp;6-G&amp;7-H&amp;8-I&amp;9-J&amp;10-K&amp;11-L&amp;12-M&amp;13-N&amp;14-O&amp;15-P&amp;16-Q&amp;17-R&amp;18-S&amp;19-T&amp;20-U&amp;21-V&amp;22-W&amp;23-X&amp;24-Y&amp;25-Z</AttribRange></本地车牌首字母><车牌最小宽度><AttribType>0</AttribType><AttribInfo/><AttribDefault>90</AttribDefault><AttribRange>60-230</AttribRange></车牌最小宽度><车牌最大宽度><AttribType>0</AttribType><AttribInfo/><AttribDefault>130</AttribDefault><AttribRange>60-230</AttribRange></车牌最大宽度><本地汉字><AttribType>3</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange>31:0-京&amp;1-沪&amp;2-津&amp;3-渝&amp;4-冀&amp;5-晋&amp;6-蒙&amp;7-辽&amp;8-吉&amp;9-黑&amp;10-苏&amp;11-浙&amp;12-皖&amp;13-闽&amp;14-赣&amp;15-鲁&amp;16-豫&amp;17-鄂&amp;18-湘&amp;19-粤&amp;20-桂&amp;21-琼&amp;22-川&amp;23-贵&amp;24-云&amp;25-藏&amp;26-陕&amp;27-甘&amp;28-青&amp;29-宁&amp;30-新</AttribRange></本地汉字><是否识别新能源车牌><AttribType>4</AttribType><AttribInfo/><AttribDefault>1</AttribDefault><AttribRange /></是否识别新能源车牌></车牌识别><调试信息><字体大小><AttribType>0</AttribType><AttribInfo>root\算法参数设置\调试信息\字体大小</AttribInfo><AttribDefault>20</AttribDefault><AttribRange>10-100</AttribRange></字体大小><是否显示Scale><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示Scale><是否显示耗时><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示耗时><是否显示版本><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示版本></调试信息></算法参数设置><车牌宽度范围设定方法><AttribType>3</AttribType><AttribInfo/><AttribDefault>1</AttribDefault><AttribRange>2:0-手动设置&amp;1-自动计算</AttribRange></车牌宽度范围设定方法></root>',
'defaultConfig');
insert into s_content(name, content ,type)
values ('illegalStopDefaultConfig',
'<?xml version="1.0" encoding="GBK"?><root><短时录像设置><录像最大缓存时间>200</录像最大缓存时间><向前录像时间>180</向前录像时间><向后录像时间>20</向后录像时间><启用>0</启用><是否画框>0</是否画框></短时录像设置><算法参数设置><是否输出无牌结果>1</是否输出无牌结果><车牌识别><本地汉字>0</本地汉字><车牌最小宽度>60</车牌最小宽度><车牌最大宽度>150</车牌最大宽度><是否识别新能源车牌>0</是否识别新能源车牌></车牌识别><车头检测分数阈值>50</车头检测分数阈值><车尾检测分数阈值>50</车尾检测分数阈值><是否画检测区域>0</是否画检测区域><同时计时抓拍>0</同时计时抓拍><违法图片间隔时间-秒><时间1>10</时间1><时间2>160</时间2><时间3>10</时间3></违法图片间隔时间-秒></算法参数设置><动态跟踪参数><使用球机3D定位-重启生效>0</使用球机3D定位-重启生效></动态跟踪参数><车辆属性识别><识别车辆类型>0</识别车辆类型><识别车标>0</识别车标><识别车身颜色>0</识别车身颜色><识别驾驶员>0</识别驾驶员><识别危险品标识>0</识别危险品标识></车辆属性识别></root>',
'defaultConfig');
insert into s_content(name, content ,type)
values ('illegalStopDefaultConfigTemplate',
'<?xml version="1.0" encoding="GBK"?><root><短时录像设置><启用><AttribType>4</AttribType><AttribInfo>是否开启录像</AttribInfo><AttribDefault>0</AttribDefault><AttribRange /></启用><是否画框><AttribType>4</AttribType><AttribInfo>是否画框</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></是否画框><向前录像时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>5</AttribDefault><AttribRange>0-1000</AttribRange></向前录像时间><向后录像时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>5</AttribDefault><AttribRange>0-1000</AttribRange></向后录像时间><录像最大缓存时间><AttribType>0</AttribType><AttribInfo>秒</AttribInfo><AttribDefault>60</AttribDefault><AttribRange>0-1000</AttribRange></录像最大缓存时间></短时录像设置><车辆属性识别><识别车辆类型><AttribType>4</AttribType><AttribInfo>识别车辆类型</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车辆类型><识别车标><AttribType>4</AttribType><AttribInfo>识别车标</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车标><识别车身颜色><AttribType>4</AttribType><AttribInfo>识别车身颜色</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别车身颜色><识别驾驶员><AttribType>4</AttribType><AttribInfo>识别驾驶员</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别驾驶员><识别危险品标识><AttribType>4</AttribType><AttribInfo>识别危险品标识</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></识别危险品标识></车辆属性识别><算法功能><是否开启车牌验证同一辆车><AttribType>4</AttribType><AttribInfo>是否开启车牌验证同一辆车</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></是否开启车牌验证同一辆车></算法功能><算法参数设置><抓拍前等待时间-秒><AttribType>0</AttribType><AttribInfo>抓拍前等待时间</AttribInfo><AttribDefault>2</AttribDefault><AttribRange>0-600</AttribRange></抓拍前等待时间-秒><违法图片间隔时间-秒><时间1><AttribType>0</AttribType><AttribInfo>图1图2间隔时间</AttribInfo><AttribDefault>10</AttribDefault><AttribRange>0-1000</AttribRange></时间1><时间2><AttribType>0</AttribType><AttribInfo>图2图3间隔时间</AttribInfo><AttribDefault>10</AttribDefault><AttribRange>0-1000</AttribRange></时间2><时间3><AttribType>0</AttribType><AttribInfo>图3图4间隔时间</AttribInfo><AttribDefault>10</AttribDefault><AttribRange>0-1000</AttribRange></时间3></违法图片间隔时间-秒><同时计时抓拍><AttribType>4</AttribType><AttribInfo>同时计时抓拍</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></同时计时抓拍><车头检测分数阈值><AttribType>0</AttribType><AttribInfo>车检分数阈值</AttribInfo><AttribDefault>50</AttribDefault><AttribRange>10-100</AttribRange></车头检测分数阈值><车尾检测分数阈值><AttribType>0</AttribType><AttribInfo>车检分数阈值</AttribInfo><AttribDefault>50</AttribDefault><AttribRange>10-100</AttribRange></车尾检测分数阈值><是否画检测区域><AttribType>4</AttribType><AttribInfo>是否画检测区域</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></是否画检测区域><是否输出无牌结果><AttribType>4</AttribType><AttribInfo>是否输出无牌结果</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></是否输出无牌结果><调试信息><字体大小><AttribType>0</AttribType><AttribInfo/><AttribDefault>20</AttribDefault><AttribRange>10-100</AttribRange></字体大小><是否显示Scale><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示Scale><是否显示耗时><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示耗时><是否显示版本><AttribType>4</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange /></是否显示版本></调试信息><车牌识别><本地汉字><AttribType>3</AttribType><AttribInfo/><AttribDefault>0</AttribDefault><AttribRange>31:0-京&amp;1-沪&amp;2-津&amp;3-渝&amp;4-冀&amp;5-晋&amp;6-蒙&amp;7-辽&amp;8-吉&amp;9-黑&amp;10-苏&amp;11-浙&amp;12-皖&amp;13-闽&amp;14-赣&amp;15-鲁&amp;16-豫&amp;17-鄂&amp;18-湘&amp;19-粤&amp;20-桂&amp;21-琼&amp;22-川&amp;23-贵&amp;24-云&amp;25-藏&amp;26-陕&amp;27-甘&amp;28-青&amp;29-宁&amp;30-新</AttribRange></本地汉字><车牌最小宽度><AttribType>0</AttribType><AttribInfo/><AttribDefault>90</AttribDefault><AttribRange>60-230</AttribRange></车牌最小宽度><车牌最大宽度><AttribType>0</AttribType><AttribInfo/><AttribDefault>130</AttribDefault><AttribRange>60-230</AttribRange></车牌最大宽度><是否识别新能源车牌><AttribType>4</AttribType><AttribInfo/><AttribDefault>1</AttribDefault><AttribRange /></是否识别新能源车牌></车牌识别></算法参数设置><动态跟踪参数><使用球机3D定位-重启生效><AttribType>4</AttribType><AttribInfo>使用球机3D定位</AttribInfo><AttribDefault>1</AttribDefault><AttribRange /></使用球机3D定位-重启生效></动态跟踪参数></root>',
'defaultConfig');
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!