From eb440e88db0f1a2c405a1e256d33df39f091404d Mon Sep 17 00:00:00 2001 From: shikeying <shikeying@163.com> Date: 星期五, 23 九月 2022 18:48:29 +0800 Subject: [PATCH] 视频采集1 --- recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user_mapper.java | 255 ++++++ recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java | 29 recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status.java | 265 ++++++ recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2.java | 155 +++ recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status_mapper.java | 323 ++++++++ deploy-jar-template/src/main/resources/application-dev.yml | 11 recommend-video/src/main/java/com/iplatform/recvideo/util/VideoFileUtils.java | 63 + pom.xml | 9 recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1.java | 177 ++++ recommend-video/src/main/java/com/iplatform/recvideo/VideoFolderInfo.java | 54 + recommend-common/src/main/java/com/iplatform/reccommon/TaskType.java | 36 recommend-model-pojo/pom.xml | 32 recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2_mapper.java | 251 ++++++ recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java | 171 ++++ recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1_mapper.java | 263 ++++++ recommend-video/src/main/java/com/iplatform/recvideo/Constants.java | 6 recommend-video/pom.xml | 24 recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarProperties.java | 18 recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user.java | 155 +++ recommend-video/src/main/java/com/iplatform/recvideo/service/VideoExecutorServiceImpl.java | 9 recommend-video/src/main/java/com/iplatform/recvideo/ImageInfo.java | 45 + recommend-video/src/test/java/com/iplatform/recvideo/VideoSimilarTest.java | 25 22 files changed, 2,375 insertions(+), 1 deletions(-) diff --git a/deploy-jar-template/src/main/resources/application-dev.yml b/deploy-jar-template/src/main/resources/application-dev.yml index a11d24f..96d7b2c 100644 --- a/deploy-jar-template/src/main/resources/application-dev.yml +++ b/deploy-jar-template/src/main/resources/application-dev.yml @@ -77,4 +77,13 @@ # 鏁版嵁閲囬泦妯″潡 gather: - enabled: true \ No newline at end of file + enabled: true + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 涓氬姟鍔熻兘閰嶇疆鍙傛暟 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +recommend: + + video: + # 瑙嗛閲囬泦瀛樺偍鏍硅矾寰� + data-folder: D:/dev_tools/ai/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 91b4595..238cf1c 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,7 @@ <module>recommend-common</module> <module>recommend-text</module> <module>recommend-video</module> + <module>recommend-model-pojo</module> <module>deploy-jar-template</module> </modules> @@ -26,6 +27,7 @@ <recommend-common.version>1.0.0-SNAPSHOT</recommend-common.version> <recommend-text.version>1.0.0-SNAPSHOT</recommend-text.version> <recommend-video.version>1.0.0-SNAPSHOT</recommend-video.version> + <recommend-model-pojo.version>1.0.0-SNAPSHOT</recommend-model-pojo.version> <deploy-jar-template.version>1.0.0-SNAPSHOT</deploy-jar-template.version> </properties> @@ -60,6 +62,13 @@ <version>${recommend-video.version}</version> </dependency> + <!-- 鎺ュ彛瀵硅薄(pojo)妯″潡锛�2022/09/22 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>recommend-model-pojo</artifactId> + <version>${recommend-model-pojo.version}</version> + </dependency> + </dependencies> </dependencyManagement> diff --git a/recommend-common/src/main/java/com/iplatform/reccommon/TaskType.java b/recommend-common/src/main/java/com/iplatform/reccommon/TaskType.java new file mode 100644 index 0000000..c8761dd --- /dev/null +++ b/recommend-common/src/main/java/com/iplatform/reccommon/TaskType.java @@ -0,0 +1,36 @@ +package com.iplatform.reccommon; + +/** + * 閲囬泦浠诲姟绫诲瀷瀹氫箟銆� + */ +public enum TaskType { + + VideoLoad { + public String getIndex(){ + return INDEX_VIDEO_LOAD; + } + }, + TextLoad { + public String getIndex(){ + return INDEX_TEXT_LOAD; + } + }; + + public String getIndex(){ + throw new AbstractMethodError(); + } + + public static final TaskType getType(String index){ + if(index.equals(INDEX_VIDEO_LOAD)){ + return VideoLoad; + } else if(index.equals(INDEX_TEXT_LOAD)){ + return TextLoad; + } else { + throw new UnsupportedOperationException("index '" + index + "' is not supported!"); + } + } + + public static final String INDEX_VIDEO_LOAD = "video_load"; + public static final String INDEX_TEXT_LOAD = "text_load"; + +} diff --git a/recommend-model-pojo/pom.xml b/recommend-model-pojo/pom.xml new file mode 100644 index 0000000..5d3042c --- /dev/null +++ b/recommend-model-pojo/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>train_recommend</artifactId> + <groupId>com.iplatform</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>recommend-model-pojo</artifactId> + <name>recommend-model-pojo</name> + <packaging>jar</packaging> + + <properties> + </properties> + + <dependencies> + <!-- jdbc pojo閫氱敤渚濊禆 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-jdbc-common</artifactId> + </dependency> + <!-- json娉ㄨВ锛氬睘鎬х粦瀹氫緷璧� --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + </dependencies> + +</project> diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status.java new file mode 100644 index 0000000..b639073 --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status.java @@ -0,0 +1,265 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:RC_TASK_STATUS * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class Rc_task_status extends BasePo<Rc_task_status> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final Rc_task_status ROW_MAPPER = new Rc_task_status(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private Long last_value = null; + @JsonIgnore + protected boolean isset_last_value = false; + + private String status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Long start_time = null; + @JsonIgnore + protected boolean isset_start_time = false; + + private Long end_time = null; + @JsonIgnore + protected boolean isset_end_time = false; + + private String msg = null; + @JsonIgnore + protected boolean isset_msg = false; + + private String task_type = null; + @JsonIgnore + protected boolean isset_task_type = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_task_status() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public Rc_task_status(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public Long getLast_value() { + return this.last_value; + } + + public void setLast_value(Long last_value) { + this.last_value = last_value; + this.isset_last_value = true; + } + + @JsonIgnore + public boolean isEmptyLast_value() { + return this.last_value == null; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null || this.status.length() == 0; + } + + public Long getStart_time() { + return this.start_time; + } + + public void setStart_time(Long start_time) { + this.start_time = start_time; + this.isset_start_time = true; + } + + @JsonIgnore + public boolean isEmptyStart_time() { + return this.start_time == null; + } + + public Long getEnd_time() { + return this.end_time; + } + + public void setEnd_time(Long end_time) { + this.end_time = end_time; + this.isset_end_time = true; + } + + @JsonIgnore + public boolean isEmptyEnd_time() { + return this.end_time == null; + } + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + this.isset_msg = true; + } + + @JsonIgnore + public boolean isEmptyMsg() { + return this.msg == null || this.msg.length() == 0; + } + + public String getTask_type() { + return this.task_type; + } + + public void setTask_type(String task_type) { + this.task_type = task_type; + this.isset_task_type = true; + } + + @JsonIgnore + public boolean isEmptyTask_type() { + return this.task_type == null || this.task_type.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("name=").append(this.name) + .append("last_value=").append(this.last_value) + .append("status=").append(this.status) + .append("start_time=").append(this.start_time) + .append("end_time=").append(this.end_time) + .append("msg=").append(this.msg) + .append("task_type=").append(this.task_type) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public Rc_task_status $clone() { + Rc_task_status rc_task_status = new Rc_task_status(); + + // 鏁版嵁搴撳悕绉� + //rc_task_status.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + rc_task_status.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + rc_task_status.setCreate_time(this.getCreate_time()); + } + if (this.isset_name) { + rc_task_status.setName(this.getName()); + } + if (this.isset_last_value) { + rc_task_status.setLast_value(this.getLast_value()); + } + if (this.isset_status) { + rc_task_status.setStatus(this.getStatus()); + } + if (this.isset_start_time) { + rc_task_status.setStart_time(this.getStart_time()); + } + if (this.isset_end_time) { + rc_task_status.setEnd_time(this.getEnd_time()); + } + if (this.isset_msg) { + rc_task_status.setMsg(this.getMsg()); + } + if (this.isset_task_type) { + rc_task_status.setTask_type(this.getTask_type()); + } + return rc_task_status; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status_mapper.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status_mapper.java new file mode 100644 index 0000000..2ba830f --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_task_status_mapper.java @@ -0,0 +1,323 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:RC_TASK_STATUS * + * @author genrator + */ +public class Rc_task_status_mapper extends Rc_task_status implements BaseMapper<Rc_task_status> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<Rc_task_status> ROW_MAPPER = new Rc_task_statusRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String NAME = "name"; + public static final String LAST_VALUE = "last_value"; + public static final String STATUS = "status"; + public static final String START_TIME = "start_time"; + public static final String END_TIME = "end_time"; + public static final String MSG = "msg"; + public static final String TASK_TYPE = "task_type"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_task_status_mapper(Rc_task_status rc_task_status) { + if (rc_task_status == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (rc_task_status.isset_id) { + this.setId(rc_task_status.getId()); + } + //鏅�氬睘鎬� + if (rc_task_status.isset_create_time) { + this.setCreate_time(rc_task_status.getCreate_time()); + } + if (rc_task_status.isset_name) { + this.setName(rc_task_status.getName()); + } + if (rc_task_status.isset_last_value) { + this.setLast_value(rc_task_status.getLast_value()); + } + if (rc_task_status.isset_status) { + this.setStatus(rc_task_status.getStatus()); + } + if (rc_task_status.isset_start_time) { + this.setStart_time(rc_task_status.getStart_time()); + } + if (rc_task_status.isset_end_time) { + this.setEnd_time(rc_task_status.getEnd_time()); + } + if (rc_task_status.isset_msg) { + this.setMsg(rc_task_status.getMsg()); + } + if (rc_task_status.isset_task_type) { + this.setTask_type(rc_task_status.getTask_type()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(rc_task_status.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "rc_task_status"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(START_TIME, this.getStart_time(), this.isset_start_time); + ib.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ib.set(MSG, this.getMsg(), this.isset_msg); + ib.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, name, last_value, status, start_time, end_time, msg, task_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, name, last_value, status, start_time, end_time, msg, task_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public Rc_task_status mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public Rc_task_status toRc_task_status() { + return super.$clone(); + } +} + +/** + * rc_task_status RowMapper + * + * @author genrator + */ +class Rc_task_statusRowMapper implements RowMapper<Rc_task_status> { + + @Override + public Rc_task_status mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + Rc_task_status rc_task_status = new Rc_task_status(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.ID); + if (columnIndex > 0) { + rc_task_status.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_task_status.setCreate_time(null); + } else { + rc_task_status.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.NAME); + if (columnIndex > 0) { + rc_task_status.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.LAST_VALUE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_task_status.setLast_value(null); + } else { + rc_task_status.setLast_value(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.STATUS); + if (columnIndex > 0) { + rc_task_status.setStatus(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.START_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_task_status.setStart_time(null); + } else { + rc_task_status.setStart_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.END_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_task_status.setEnd_time(null); + } else { + rc_task_status.setEnd_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.MSG); + if (columnIndex > 0) { + rc_task_status.setMsg(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.TASK_TYPE); + if (columnIndex > 0) { + rc_task_status.setTask_type(rs.getString(columnIndex)); + } + return rc_task_status; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1.java new file mode 100644 index 0000000..95a024d --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1.java @@ -0,0 +1,177 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:RC_VIDEO_T1 * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class Rc_video_t1 extends BasePo<Rc_video_t1> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final Rc_video_t1 ROW_MAPPER = new Rc_video_t1(); + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String src_img = null; + @JsonIgnore + protected boolean isset_src_img = false; + + private String src_video_id = null; + @JsonIgnore + protected boolean isset_src_video_id = false; + + private String sim_video_id = null; + @JsonIgnore + protected boolean isset_sim_video_id = false; + + private Double distance = null; + @JsonIgnore + protected boolean isset_distance = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_t1() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public Rc_video_t1(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + public String getSrc_img() { + return this.src_img; + } + + public void setSrc_img(String src_img) { + this.src_img = src_img; + this.isset_src_img = true; + } + + @JsonIgnore + public boolean isEmptySrc_img() { + return this.src_img == null || this.src_img.length() == 0; + } + + public String getSrc_video_id() { + return this.src_video_id; + } + + public void setSrc_video_id(String src_video_id) { + this.src_video_id = src_video_id; + this.isset_src_video_id = true; + } + + @JsonIgnore + public boolean isEmptySrc_video_id() { + return this.src_video_id == null || this.src_video_id.length() == 0; + } + + public String getSim_video_id() { + return this.sim_video_id; + } + + public void setSim_video_id(String sim_video_id) { + this.sim_video_id = sim_video_id; + this.isset_sim_video_id = true; + } + + @JsonIgnore + public boolean isEmptySim_video_id() { + return this.sim_video_id == null || this.sim_video_id.length() == 0; + } + + public Double getDistance() { + return this.distance; + } + + public void setDistance(Double distance) { + this.distance = distance; + this.isset_distance = true; + } + + @JsonIgnore + public boolean isEmptyDistance() { + return this.distance == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("src_img=").append(this.src_img) + .append("src_video_id=").append(this.src_video_id) + .append("sim_video_id=").append(this.sim_video_id) + .append("distance=").append(this.distance) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_t1 $clone() { + Rc_video_t1 rc_video_t1 = new Rc_video_t1(); + + // 鏁版嵁搴撳悕绉� + //rc_video_t1.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + rc_video_t1.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_src_img) { + rc_video_t1.setSrc_img(this.getSrc_img()); + } + if (this.isset_src_video_id) { + rc_video_t1.setSrc_video_id(this.getSrc_video_id()); + } + if (this.isset_sim_video_id) { + rc_video_t1.setSim_video_id(this.getSim_video_id()); + } + if (this.isset_distance) { + rc_video_t1.setDistance(this.getDistance()); + } + return rc_video_t1; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1_mapper.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1_mapper.java new file mode 100644 index 0000000..02735b1 --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t1_mapper.java @@ -0,0 +1,263 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:RC_VIDEO_T1 * + * @author genrator + */ +public class Rc_video_t1_mapper extends Rc_video_t1 implements BaseMapper<Rc_video_t1> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<Rc_video_t1> ROW_MAPPER = new Rc_video_t1RowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String SRC_IMG = "src_img"; + public static final String SRC_VIDEO_ID = "src_video_id"; + public static final String SIM_VIDEO_ID = "sim_video_id"; + public static final String DISTANCE = "distance"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_t1_mapper(Rc_video_t1 rc_video_t1) { + if (rc_video_t1 == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (rc_video_t1.isset_id) { + this.setId(rc_video_t1.getId()); + } + //鏅�氬睘鎬� + if (rc_video_t1.isset_src_img) { + this.setSrc_img(rc_video_t1.getSrc_img()); + } + if (rc_video_t1.isset_src_video_id) { + this.setSrc_video_id(rc_video_t1.getSrc_video_id()); + } + if (rc_video_t1.isset_sim_video_id) { + this.setSim_video_id(rc_video_t1.getSim_video_id()); + } + if (rc_video_t1.isset_distance) { + this.setDistance(rc_video_t1.getDistance()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(rc_video_t1.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "rc_video_t1"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); + ib.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ib.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ib.set(DISTANCE, this.getDistance(), this.isset_distance); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(DISTANCE, this.getDistance(), this.isset_distance); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(DISTANCE, this.getDistance(), this.isset_distance); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(DISTANCE, this.getDistance(), this.isset_distance); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, src_img, src_video_id, sim_video_id, distance from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, src_img, src_video_id, sim_video_id, distance from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public Rc_video_t1 mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_t1 toRc_video_t1() { + return super.$clone(); + } +} + +/** + * rc_video_t1 RowMapper + * + * @author genrator + */ +class Rc_video_t1RowMapper implements RowMapper<Rc_video_t1> { + + @Override + public Rc_video_t1 mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + Rc_video_t1 rc_video_t1 = new Rc_video_t1(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.ID); + if (columnIndex > 0) { + rc_video_t1.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SRC_IMG); + if (columnIndex > 0) { + rc_video_t1.setSrc_img(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SRC_VIDEO_ID); + if (columnIndex > 0) { + rc_video_t1.setSrc_video_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SIM_VIDEO_ID); + if (columnIndex > 0) { + rc_video_t1.setSim_video_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.DISTANCE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_video_t1.setDistance(null); + } else { + rc_video_t1.setDistance(rs.getDouble(columnIndex)); + } + } + return rc_video_t1; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2.java new file mode 100644 index 0000000..f091da4 --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2.java @@ -0,0 +1,155 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:RC_VIDEO_T2 * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class Rc_video_t2 extends BasePo<Rc_video_t2> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final Rc_video_t2 ROW_MAPPER = new Rc_video_t2(); + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String src_video_id = null; + @JsonIgnore + protected boolean isset_src_video_id = false; + + private String sim_video_id = null; + @JsonIgnore + protected boolean isset_sim_video_id = false; + + private Double score = null; + @JsonIgnore + protected boolean isset_score = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_t2() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public Rc_video_t2(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + public String getSrc_video_id() { + return this.src_video_id; + } + + public void setSrc_video_id(String src_video_id) { + this.src_video_id = src_video_id; + this.isset_src_video_id = true; + } + + @JsonIgnore + public boolean isEmptySrc_video_id() { + return this.src_video_id == null || this.src_video_id.length() == 0; + } + + public String getSim_video_id() { + return this.sim_video_id; + } + + public void setSim_video_id(String sim_video_id) { + this.sim_video_id = sim_video_id; + this.isset_sim_video_id = true; + } + + @JsonIgnore + public boolean isEmptySim_video_id() { + return this.sim_video_id == null || this.sim_video_id.length() == 0; + } + + public Double getScore() { + return this.score; + } + + public void setScore(Double score) { + this.score = score; + this.isset_score = true; + } + + @JsonIgnore + public boolean isEmptyScore() { + return this.score == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("src_video_id=").append(this.src_video_id) + .append("sim_video_id=").append(this.sim_video_id) + .append("score=").append(this.score) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_t2 $clone() { + Rc_video_t2 rc_video_t2 = new Rc_video_t2(); + + // 鏁版嵁搴撳悕绉� + //rc_video_t2.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + rc_video_t2.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_src_video_id) { + rc_video_t2.setSrc_video_id(this.getSrc_video_id()); + } + if (this.isset_sim_video_id) { + rc_video_t2.setSim_video_id(this.getSim_video_id()); + } + if (this.isset_score) { + rc_video_t2.setScore(this.getScore()); + } + return rc_video_t2; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2_mapper.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2_mapper.java new file mode 100644 index 0000000..1411a5c --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_t2_mapper.java @@ -0,0 +1,251 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:RC_VIDEO_T2 * + * @author genrator + */ +public class Rc_video_t2_mapper extends Rc_video_t2 implements BaseMapper<Rc_video_t2> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<Rc_video_t2> ROW_MAPPER = new Rc_video_t2RowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String SRC_VIDEO_ID = "src_video_id"; + public static final String SIM_VIDEO_ID = "sim_video_id"; + public static final String SCORE = "score"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_t2_mapper(Rc_video_t2 rc_video_t2) { + if (rc_video_t2 == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (rc_video_t2.isset_id) { + this.setId(rc_video_t2.getId()); + } + //鏅�氬睘鎬� + if (rc_video_t2.isset_src_video_id) { + this.setSrc_video_id(rc_video_t2.getSrc_video_id()); + } + if (rc_video_t2.isset_sim_video_id) { + this.setSim_video_id(rc_video_t2.getSim_video_id()); + } + if (rc_video_t2.isset_score) { + this.setScore(rc_video_t2.getScore()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(rc_video_t2.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "rc_video_t2"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ib.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ib.set(SCORE, this.getScore(), this.isset_score); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); + ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, src_video_id, sim_video_id, score from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, src_video_id, sim_video_id, score from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public Rc_video_t2 mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_t2 toRc_video_t2() { + return super.$clone(); + } +} + +/** + * rc_video_t2 RowMapper + * + * @author genrator + */ +class Rc_video_t2RowMapper implements RowMapper<Rc_video_t2> { + + @Override + public Rc_video_t2 mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + Rc_video_t2 rc_video_t2 = new Rc_video_t2(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.ID); + if (columnIndex > 0) { + rc_video_t2.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SRC_VIDEO_ID); + if (columnIndex > 0) { + rc_video_t2.setSrc_video_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SIM_VIDEO_ID); + if (columnIndex > 0) { + rc_video_t2.setSim_video_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SCORE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_video_t2.setScore(null); + } else { + rc_video_t2.setScore(rs.getDouble(columnIndex)); + } + } + return rc_video_t2; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user.java new file mode 100644 index 0000000..f49c32f --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user.java @@ -0,0 +1,155 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:RC_VIDEO_USER * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class Rc_video_user extends BasePo<Rc_video_user> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final Rc_video_user ROW_MAPPER = new Rc_video_user(); + + // 涓婚敭 + private Long user_id = null; + @JsonIgnore + protected boolean isset_user_id = false; + + // 灞炴�у垪琛� + private String video_id = null; + @JsonIgnore + protected boolean isset_video_id = false; + + private Double score = null; + @JsonIgnore + protected boolean isset_score = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_user() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public Rc_video_user(Long user_id) { + this.setUser_id(user_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setUser_id((Long) value); + } + + public Long getUser_id() { + return this.user_id; + } + + public void setUser_id(Long user_id) { + this.user_id = user_id; + this.isset_user_id = true; + } + + @JsonIgnore + public boolean isEmptyUser_id() { + return this.user_id == null; + } + + public String getVideo_id() { + return this.video_id; + } + + public void setVideo_id(String video_id) { + this.video_id = video_id; + this.isset_video_id = true; + } + + @JsonIgnore + public boolean isEmptyVideo_id() { + return this.video_id == null || this.video_id.length() == 0; + } + + public Double getScore() { + return this.score; + } + + public void setScore(Double score) { + this.score = score; + this.isset_score = true; + } + + @JsonIgnore + public boolean isEmptyScore() { + return this.score == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("user_id=").append(this.user_id) + .append("video_id=").append(this.video_id) + .append("score=").append(this.score) + .append("create_time=").append(this.create_time) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_user $clone() { + Rc_video_user rc_video_user = new Rc_video_user(); + + // 鏁版嵁搴撳悕绉� + //rc_video_user.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_user_id) { + rc_video_user.setUser_id(this.getUser_id()); + } + // 鏅�氬睘鎬� + if (this.isset_video_id) { + rc_video_user.setVideo_id(this.getVideo_id()); + } + if (this.isset_score) { + rc_video_user.setScore(this.getScore()); + } + if (this.isset_create_time) { + rc_video_user.setCreate_time(this.getCreate_time()); + } + return rc_video_user; + } +} diff --git a/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user_mapper.java b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user_mapper.java new file mode 100644 index 0000000..eb950b3 --- /dev/null +++ b/recommend-model-pojo/src/main/java/com/iplatform/model/po/Rc_video_user_mapper.java @@ -0,0 +1,255 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:RC_VIDEO_USER * + * @author genrator + */ +public class Rc_video_user_mapper extends Rc_video_user implements BaseMapper<Rc_video_user> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<Rc_video_user> ROW_MAPPER = new Rc_video_userRowMapper(); + + // 涓婚敭 + public static final String USER_ID = "user_id"; + // 鏅�氬睘鎬� + public static final String VIDEO_ID = "video_id"; + public static final String SCORE = "score"; + public static final String CREATE_TIME = "create_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public Rc_video_user_mapper(Rc_video_user rc_video_user) { + if (rc_video_user == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (rc_video_user.isset_user_id) { + this.setUser_id(rc_video_user.getUser_id()); + } + //鏅�氬睘鎬� + if (rc_video_user.isset_video_id) { + this.setVideo_id(rc_video_user.getVideo_id()); + } + if (rc_video_user.isset_score) { + this.setScore(rc_video_user.getScore()); + } + if (rc_video_user.isset_create_time) { + this.setCreate_time(rc_video_user.getCreate_time()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(rc_video_user.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "rc_video_user"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return USER_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getUser_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(USER_ID, this.getUser_id()); + ib.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); + ib.set(SCORE, this.getScore(), this.isset_score); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); + ub.set(SCORE, this.getScore(), this.isset_score); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select user_id, video_id, score, create_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select user_id, video_id, score, create_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public Rc_video_user mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public Rc_video_user toRc_video_user() { + return super.$clone(); + } +} + +/** + * rc_video_user RowMapper + * + * @author genrator + */ +class Rc_video_userRowMapper implements RowMapper<Rc_video_user> { + + @Override + public Rc_video_user mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + Rc_video_user rc_video_user = new Rc_video_user(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.USER_ID); + if (columnIndex > 0) { + rc_video_user.setUser_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.VIDEO_ID); + if (columnIndex > 0) { + rc_video_user.setVideo_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.SCORE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_video_user.setScore(null); + } else { + rc_video_user.setScore(rs.getDouble(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + rc_video_user.setCreate_time(null); + } else { + rc_video_user.setCreate_time(rs.getLong(columnIndex)); + } + } + return rc_video_user; + } +} diff --git a/recommend-video/pom.xml b/recommend-video/pom.xml index c273abd..6360c92 100644 --- a/recommend-video/pom.xml +++ b/recommend-video/pom.xml @@ -17,6 +17,30 @@ </properties> <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <!-- 鏁版嵁搴撳強鎺ュ彛瀵硅薄渚濊禆(pojo), 2022/09/23 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>recommend-model-pojo</artifactId> + </dependency> + + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>recommend-common</artifactId> + </dependency> + + <!-- RestTemplate渚濊禆锛�2022/09/23 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> </project> diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/Constants.java b/recommend-video/src/main/java/com/iplatform/recvideo/Constants.java new file mode 100644 index 0000000..b5f017f --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/Constants.java @@ -0,0 +1,6 @@ +package com.iplatform.recvideo; + +public class Constants { + + public static final String IMAGE_SUFFIX = ".jpg"; +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/ImageInfo.java b/recommend-video/src/main/java/com/iplatform/recvideo/ImageInfo.java new file mode 100644 index 0000000..412f703 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/ImageInfo.java @@ -0,0 +1,45 @@ +package com.iplatform.recvideo; + +/** + * 璋冨害浠诲姟閫氳繃鏂囦欢澶规壂鎻忓埌鐨勮棰戝浘鍍忎俊鎭�� + * @author 鏃跺厠鑻� + * @date 2022-09-23 + */ +public class ImageInfo { + + private String videoId; // 瑙嗛ID锛屾枃浠跺す鍚嶅瓧灏辨槸 + private String imagePath; // 鍥惧儚缁濆璺緞锛岃闂娇鐢� + + private String imageName; // 鍥惧儚鍚嶇О(涓嶅寘鎷矾寰勶紝濡傦細landscape_01.jpg)锛屾殏鏃舵病鏈変娇鐢� + + public String getVideoId() { + return videoId; + } + + public void setVideoId(String videoId) { + this.videoId = videoId; + } + + public String getImagePath() { + return imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getImageName() { + return imageName; + } + + public void setImageName(String imageName) { + this.imageName = imageName; + } + + @Override + public String toString(){ + return new StringBuilder("[videoId=").append(this.videoId) + .append(", imagePath=").append(this.imagePath) + .append("]").toString(); + } +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java b/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java new file mode 100644 index 0000000..90d4868 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/SimilarExecutor.java @@ -0,0 +1,171 @@ +package com.iplatform.recvideo; + +import com.iplatform.model.po.Rc_video_t1; +import com.iplatform.recvideo.util.VideoFileUtils; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.List; + +/** + * 瑙嗛鐩镐技搴︾粨鏋滆绠椾互鍙婂啓鍏ユ墽琛屽櫒銆� + * <pre> + * 1)璇ュ璞′负'鏈夌姸鎬�'锛屽湪姣忔瀹屾垚涓�涓噰闆嗚繃绋嬪悗锛岄渶瑕侀噸鏂板垱寤恒�� + * </pre> + * @author 鏃跺厠鑻� + * @date 2022-09-23 + */ +public abstract class SimilarExecutor { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + private String videoDataFolder = null; + + private String batchId = null; + + private List<VideoFolderInfo> videoFolderInfoList = null; + + // 璁板綍褰撳墠鎵ц鍒�(璇ユ壒娆�)鍝釜瑙嗛鏂囦欢瀵瑰簲鐨勭鍑犱釜鍥剧墖 + private int currentVideoFolderIndex = -1; + private int currentImageIndex = -1; +// private VideoFolderInfo currentVideoFolderInfo = null; +// private ImageInfo currentImageInfo = null; + + // + private boolean pythonLoadVideoDone = false; + + /** + * 鍒濆鍖栧璞¤皟鐢ㄤ竴娆� + * @param videoDataFolder + * @param batchId + */ + public void startup(String videoDataFolder, String batchId){ + if(StringUtils.isEmpty(videoDataFolder)){ + throw new IllegalArgumentException("瑙嗛鏂囦欢澶规牴鐩綍蹇呴』璁剧疆!"); + } + if(StringUtils.isEmpty(batchId)){ + throw new IllegalArgumentException("澶勭悊鎵规(鏃堕棿)蹇呴』璁剧疆!"); + } + this.videoDataFolder = videoDataFolder; + this.batchId = batchId; +// this.videoFolderInfoList = VideoFileUtils.getBatchVideoFolderInfo(this.videoDataFolder, batchId); + } + + /** + * 鍦ㄦ瘡娆¤皟搴︽椂閽熷懆鏈熸墽琛屼竴娆°�備緥濡�: 10绉掍竴娆°��<p></p> + * 娉ㄦ剰锛氳鏂规硶鑻辩‘淇濇瘡娆¤皟鐢ㄤ笉浼氶噸澶嶆暟鎹�� + */ + public void execute(){ + if(!this.pythonLoadVideoDone){ + logger.debug("褰撳墠 pythonLoadVideoDone = false, 闇�瑕佹煡璇㈡暟鎹簱鏄惁宸插姞杞借棰�"); + this.pythonLoadVideoDone = this.pythonLoadVideoDone(this.batchId, videoDataFolder + File.separator + batchId); + } + + // 1: 濡傛灉瑙嗛杩樻湭鍔犺浇锛屽垯鍏堝姞杞借棰� + if(!this.pythonLoadVideoDone){ + try{ + String error = this.requestStartPythonLoadVideo(this.batchId); + if(StringUtils.isNotEmpty(error)){ + // 缁堟璋冪敤锛岀瓑寰呬笅娆¤皟搴︾户缁皾璇曟墽琛� + logger.error("python璋冪敤鍔犺浇瑙嗛杩斿洖閿欒:" + error); + return; + } + this.pythonLoadVideoDone = true; + + } catch (Exception ex){ + logger.error("python璋冪敤鍔犺浇瑙嗛寮傚父:" + this.batchId, ex); + return; + } + } + + // 2: 鍔犺浇瀹岃棰戯紝闇�瑕佹煡璇㈡瘡涓浘鐗囩浉浼煎害缁撴灉锛屽苟瀛樺偍鍒版暟鎹簱 + // 杩欓噷娉ㄦ剰锛岀▼搴忓繀椤诲拰AI鏈嶅姟鍣ㄩ儴缃插湪涓�璧凤紝鏂逛究妫�绱㈣棰戝垎鏋愭枃浠跺す(鏈湴) + if(this.videoFolderInfoList == null){ + this.videoFolderInfoList = VideoFileUtils.getBatchVideoFolderInfo(this.videoDataFolder, batchId); + } + if(StringUtils.isEmptyList(this.videoFolderInfoList)){ + logger.warn("瑙嗛鍒嗘瀽鏂囦欢澶瑰唴瀹逛负绌猴紝鏃犳硶缁х画鏌ヨ鐩镐技搴︾粨鏋�! videoFolderInfoList = null"); + return; + } + + if(this.isSearchWriteDone()){ + logger.info("宸茬粡瀹屾垚鎵规鐩镐技缁撴灉鍐欏叆鏁版嵁搴擄紝涓嶅啀寰�涓嬪鐞嗐�俠atch = " + this.batchId); + return; + } + + // 寮�濮嬫绱㈢浉浼煎害 + if(this.currentVideoFolderIndex == -1){ + this.currentVideoFolderIndex ++; + } + + } + + private void processOneSearchAndWrite() throws Exception{ + if(this.currentVideoFolderIndex >= this.videoFolderInfoList.size()){ + throw new IllegalArgumentException("currentVideoFolderIndex 瓒婄晫: " + this.currentVideoFolderIndex); + } + VideoFolderInfo currentVideoFolderInfo = this.videoFolderInfoList.get(this.currentVideoFolderIndex); + + if(this.currentImageIndex == -1){ + this.currentImageIndex ++; + } + ImageInfo imageInfo = currentVideoFolderInfo.getImageInfoList().get(this.currentImageIndex); + + this.acquirePythonSearchSimilarOnce(imageInfo.getImagePath(), "30"); + + if((this.currentImageIndex + 1) >= currentVideoFolderInfo.getImageInfoSize()){ + if((this.currentVideoFolderIndex + 1) < this.videoFolderInfoList.size()){ + logger.debug("涓�涓棰戝浘鍍忛泦鍚堟绱㈠鐞嗗畬姣曪紝鍒囨崲鍒颁笅涓�涓紝currentImageIndex = " + this.currentImageIndex); + this.currentVideoFolderIndex ++; + this.currentImageIndex = -1; + } else { + // + logger.debug("鎵�鏈夎棰戝寘鍚殑鎵�鏈夊浘鍍忓鐞嗗畬姣曪紝currentVideoFolderIndex = " + this.currentVideoFolderIndex); + } + return; + } + + this.currentImageIndex ++; + } + + /** + * 鍒ゆ柇鏄惁宸茬粡鍏ㄩ儴鎶婂浘鐗囩浉浼煎害缁撴灉鍐欏叆鍒版暟鎹簱涓��(閽堝璇ユ壒娆�) + * @return + */ + private boolean isSearchWriteDone(){ + if(this.currentVideoFolderIndex == -1 || this.currentImageIndex == -1){ + return false; + } + if((this.currentVideoFolderIndex+1) == this.videoFolderInfoList.size()){ + VideoFolderInfo lastVideo = this.videoFolderInfoList.get(this.currentVideoFolderIndex); + // 濡傛灉鏈�鍚庝竴涓棰戝鐞嗗浘鐗囨暟閲忚秴杩囧凡鏈夋暟閲忥紝鍒ゆ柇鑲畾澶勭悊瀹屾瘯 + if((this.currentImageIndex+1) > lastVideo.getImageInfoSize()){ + return true; + } + } + return false; + } + + /** + * 鏌ヨ鏁版嵁搴擄紝妫�鏌ユ槸鍚﹀凡缁忓畬鎴愭湰娆℃壒娆¤棰戝姞杞姐�傝杩欎釜琛�: milvus_video_status + * @param batchId + * @param batchFolder 鎵规鎵�鍦ㄦ枃浠跺す鍏ㄨ矾寰勶紝濡�: /opt/ai/video/20220921 + * @return + */ + protected abstract boolean pythonLoadVideoDone(String batchId, String batchFolder); + + /** + * 璇锋眰AI鏈嶅姟锛屽紑濮嬩竴涓壒娆¤棰戞暟鎹鍏ャ�� + * @param batchId + * @return + */ + protected abstract String requestStartPythonLoadVideo(String batchId) throws Exception; + + /** + * 璇锋眰AI鏈嶅姟锛屾绱㈢粰瀹氬浘鐗囩殑鐩镐技搴︾粨鏋滈泦鍚堛�� + * @return + */ + protected abstract List<Rc_video_t1> acquirePythonSearchSimilarOnce(String imagePath, String topN); +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/VideoFolderInfo.java b/recommend-video/src/main/java/com/iplatform/recvideo/VideoFolderInfo.java new file mode 100644 index 0000000..ffd5722 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/VideoFolderInfo.java @@ -0,0 +1,54 @@ +package com.iplatform.recvideo; + +import java.util.ArrayList; +import java.util.List; + +/** + * 璋冨害浠诲姟鎵弿鍒扮殑瑙嗛鏂囦欢澶逛俊鎭紝鍖呭惈閲岄潰鍥剧墖闆嗗悎銆� + * @author 鏃跺厠鑻� + * @date 2022-09-23 + */ +public class VideoFolderInfo { + + private String videoId; + + private List<ImageInfo> imageInfoList; + + public VideoFolderInfo(String videoId){ + this.videoId = videoId; + } + + public void addImageInfo(String imagePath, String imageName){ + ImageInfo imageInfo = new ImageInfo(); + imageInfo.setImagePath(imagePath); + imageInfo.setImageName(imageName); + imageInfo.setVideoId(this.videoId); + if(this.imageInfoList == null){ + this.imageInfoList = new ArrayList<>(32); + } + this.imageInfoList.add(imageInfo); + } + + public String getVideoId() { + return videoId; + } + + public void setVideoId(String videoId) { + this.videoId = videoId; + } + + public List<ImageInfo> getImageInfoList() { + return imageInfoList; + } + + public void setImageInfoList(List<ImageInfo> imageInfoList) { + this.imageInfoList = imageInfoList; + } + + public int getImageInfoSize(){ + if(this.imageInfoList == null){ + return 0; + } + return this.imageInfoList.size(); + } +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java new file mode 100644 index 0000000..bf5eda8 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarConfig.java @@ -0,0 +1,29 @@ +package com.iplatform.recvideo.config; + +import com.iplatform.core.PlatformConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class VideoSimilarConfig extends PlatformConfiguration { + + @Bean + public VideoSimilarProperties videoSimilarProperties(){ + return new VideoSimilarProperties(); + } + + /** + * 鍒涘缓杩滅▼璋冪敤瀵硅薄锛屼复鏃朵娇鐢ㄥ唴缃瓾ttp閰嶇疆锛屽悗缁細鍗曠嫭鍙戝竷妯″潡鏀寔 okHttp + * @return + * @date 2022-09-23 + */ + @Bean + public RestTemplate restTemplate(){ + SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); + clientHttpRequestFactory.setConnectTimeout(10 * 1000); + clientHttpRequestFactory.setReadTimeout(1200 * 1000); + return new RestTemplate(clientHttpRequestFactory); + } +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarProperties.java b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarProperties.java new file mode 100644 index 0000000..5659418 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/config/VideoSimilarProperties.java @@ -0,0 +1,18 @@ +package com.iplatform.recvideo.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "recommend.video") +public class VideoSimilarProperties { + + private String dataFolder; + + public String getDataFolder() { + return dataFolder; + } + + public void setDataFolder(String dataFolder) { + this.dataFolder = dataFolder; + } + +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/service/VideoExecutorServiceImpl.java b/recommend-video/src/main/java/com/iplatform/recvideo/service/VideoExecutorServiceImpl.java new file mode 100644 index 0000000..bd4408f --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/service/VideoExecutorServiceImpl.java @@ -0,0 +1,9 @@ +package com.iplatform.recvideo.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class VideoExecutorServiceImpl extends BaseServiceImpl { + +} diff --git a/recommend-video/src/main/java/com/iplatform/recvideo/util/VideoFileUtils.java b/recommend-video/src/main/java/com/iplatform/recvideo/util/VideoFileUtils.java new file mode 100644 index 0000000..61b3707 --- /dev/null +++ b/recommend-video/src/main/java/com/iplatform/recvideo/util/VideoFileUtils.java @@ -0,0 +1,63 @@ +package com.iplatform.recvideo.util; + +import com.iplatform.recvideo.Constants; +import com.iplatform.recvideo.ImageInfo; +import com.iplatform.recvideo.VideoFolderInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class VideoFileUtils { + + protected static final transient Logger logger = LoggerFactory.getLogger(VideoFileUtils.class); + + public static final List<VideoFolderInfo> getBatchVideoFolderInfo(String videoDataFolder, String batchId){ + String batchFolderPath = videoDataFolder + File.separator + batchId; + File batchFolder = new File(batchFolderPath); + if(!batchFolder.exists()){ + logger.error("瑙嗛鏂囦欢澶逛笉瀛樺湪锛屾棤娉曡幏鍙栧浘鐗囬泦鍚堜俊鎭�俠atchFolderPath = " + batchFolderPath); + return null; + } + File[] files = batchFolder.listFiles(); + if(files == null || files.length == 0){ + logger.error("瑙嗛鏂囦欢澶逛笅娌℃湁浠讳綍鍥惧儚鏂囦欢澶�: " + batchFolderPath); + return null; + } + + List<VideoFolderInfo> resultList = new ArrayList<>(); + + VideoFolderInfo videoFolderInfo = null; + for(File file : files){ + if(file.isFile()){ + continue; // 瑙嗛鏂囦欢蹇界暐锛屽彧鐪嬫枃浠跺す + } + videoFolderInfo = new VideoFolderInfo(file.getName()); +// logger.debug("find folder = " + file.getName() + ", " + file.getAbsolutePath()); + acquireImagesInVideoFolder(file, videoFolderInfo); + resultList.add(videoFolderInfo); + } + return resultList; + } + + private static void acquireImagesInVideoFolder(File imageFolder, VideoFolderInfo videoFolderInfo){ +// ImageInfo imageInfo = null; + File[] imageFiles = imageFolder.listFiles(); + for(File file : imageFiles){ + if(!file.isFile()){ + continue; + } + if(!file.getName().endsWith(Constants.IMAGE_SUFFIX)){ + logger.warn("鍥惧儚鍚庣紑鍚嶄笉鏄寚瀹氭牸寮�'.jpg', name = " + file.getName()); + continue; + } +// imageInfo = new ImageInfo(); +// imageInfo.setVideoId(videoFolderInfo.getVideoId()); +// imageInfo.setImagePath(file.getAbsolutePath()); +// imageInfo.setImageName(file.getName()); + videoFolderInfo.addImageInfo(file.getAbsolutePath(), file.getName()); + } + } +} diff --git a/recommend-video/src/test/java/com/iplatform/recvideo/VideoSimilarTest.java b/recommend-video/src/test/java/com/iplatform/recvideo/VideoSimilarTest.java new file mode 100644 index 0000000..ef88d0e --- /dev/null +++ b/recommend-video/src/test/java/com/iplatform/recvideo/VideoSimilarTest.java @@ -0,0 +1,25 @@ +package com.iplatform.recvideo; + +import com.iplatform.recvideo.util.VideoFileUtils; +import org.junit.Test; + +import java.util.List; + +public class VideoSimilarTest { + + @Test + public void testVideoFolderInfo(){ + List<VideoFolderInfo> list = VideoFileUtils.getBatchVideoFolderInfo("D:/dev_tools/ai", "video"); + if(list != null){ + for(VideoFolderInfo e : list){ + System.out.println("------------> video folder: " + e.getVideoId()); + List<ImageInfo> imageInfoList = e.getImageInfoList(); + if(imageInfoList != null){ + for(ImageInfo im : imageInfoList){ + System.out.println(im); + } + } + } + } + } +} -- Gitblit v1.9.1