|
|
|
|
package com.threecloud.dataserviceyy.config;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* FTP同步配置
|
|
|
|
|
* 对应 application-external.yml 中的 ftp-sync 配置节点
|
|
|
|
|
*
|
|
|
|
|
* 示例:
|
|
|
|
|
* ftp-sync:
|
|
|
|
|
* enabled: true
|
|
|
|
|
* sync-interval-cron: "0 0 0/2 * * ?"
|
|
|
|
|
* cities:
|
|
|
|
|
* - city-code: "340100"
|
|
|
|
|
* city-name: "合肥"
|
|
|
|
|
* ftp-host: 10.126.129.7
|
|
|
|
|
* ...
|
|
|
|
|
*/
|
|
|
|
|
@Configuration
|
|
|
|
|
@ConfigurationProperties(prefix = "ftp-sync")
|
|
|
|
|
public class FtpSyncProperties {
|
|
|
|
|
|
|
|
|
|
/** 是否启用FTP同步 */
|
|
|
|
|
private boolean enabled = true;
|
|
|
|
|
|
|
|
|
|
/** 本地临时文件目录(存放下载的mp3/wav) */
|
|
|
|
|
private String tempPath = "./vaa-ftp-temp";
|
|
|
|
|
|
|
|
|
|
/** 文件保留天数 */
|
|
|
|
|
private int retainDays = 10;
|
|
|
|
|
|
|
|
|
|
/** txt文件编码(老系统用GBK) */
|
|
|
|
|
private String txtEncoding = "GBK";
|
|
|
|
|
|
|
|
|
|
/** 字段分隔符(老系统用※) */
|
|
|
|
|
private String fieldSeparator = "※";
|
|
|
|
|
|
|
|
|
|
/** OSS服务基础地址(用于mp3直接URL拼接) */
|
|
|
|
|
private String ossBaseUrl;
|
|
|
|
|
|
|
|
|
|
/** 地市FTP配置列表 */
|
|
|
|
|
private List<FtpCityConfig> cities = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
public boolean isEnabled() { return enabled; }
|
|
|
|
|
public void setEnabled(boolean enabled) { this.enabled = enabled; }
|
|
|
|
|
|
|
|
|
|
public String getTempPath() { return tempPath; }
|
|
|
|
|
public void setTempPath(String tempPath) { this.tempPath = tempPath; }
|
|
|
|
|
|
|
|
|
|
public int getRetainDays() { return retainDays; }
|
|
|
|
|
public void setRetainDays(int retainDays) { this.retainDays = retainDays; }
|
|
|
|
|
|
|
|
|
|
public String getTxtEncoding() { return txtEncoding; }
|
|
|
|
|
public void setTxtEncoding(String txtEncoding) { this.txtEncoding = txtEncoding; }
|
|
|
|
|
|
|
|
|
|
public String getFieldSeparator() { return fieldSeparator; }
|
|
|
|
|
public void setFieldSeparator(String fieldSeparator) { this.fieldSeparator = fieldSeparator; }
|
|
|
|
|
|
|
|
|
|
public String getOssBaseUrl() { return ossBaseUrl; }
|
|
|
|
|
public void setOssBaseUrl(String ossBaseUrl) { this.ossBaseUrl = ossBaseUrl; }
|
|
|
|
|
|
|
|
|
|
public List<FtpCityConfig> getCities() { return cities; }
|
|
|
|
|
public void setCities(List<FtpCityConfig> cities) { this.cities = cities; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 单个地市的FTP配置
|
|
|
|
|
*/
|
|
|
|
|
public static class FtpCityConfig {
|
|
|
|
|
/** 地市编码(与mid_voice_device_config.city_code对应) */
|
|
|
|
|
private String cityCode;
|
|
|
|
|
/** 地市名称 */
|
|
|
|
|
private String cityName;
|
|
|
|
|
/** FTP服务器IP */
|
|
|
|
|
private String ftpHost;
|
|
|
|
|
/** FTP服务器端口 */
|
|
|
|
|
private int ftpPort = 21;
|
|
|
|
|
/** FTP用户名 */
|
|
|
|
|
private String ftpUsername;
|
|
|
|
|
/** FTP密码 */
|
|
|
|
|
private String ftpPassword;
|
|
|
|
|
/** 录音数据源目录(txt文件目录) */
|
|
|
|
|
private String ftpSourceDir;
|
|
|
|
|
/** 录音文件存储目录(mp3/wav文件目录) */
|
|
|
|
|
private String ftpRecordDir;
|
|
|
|
|
/** 归档目录(处理完的txt移到这里) */
|
|
|
|
|
private String ftpArchiveDir;
|
|
|
|
|
/**
|
|
|
|
|
* 电话区号前缀(处理主被叫号码时去除)
|
|
|
|
|
* - 配正确区号(如合肥 0551):号码以 0551 开头则去除
|
|
|
|
|
* - 配不存在的区号(如 "0000"):号码匹配不上,保留原始号码
|
|
|
|
|
* - 留空:保留原始号码
|
|
|
|
|
*/
|
|
|
|
|
private String phoneAreaCode;
|
|
|
|
|
|
|
|
|
|
public String getCityCode() { return cityCode; }
|
|
|
|
|
public void setCityCode(String cityCode) { this.cityCode = cityCode; }
|
|
|
|
|
|
|
|
|
|
public String getCityName() { return cityName; }
|
|
|
|
|
public void setCityName(String cityName) { this.cityName = cityName; }
|
|
|
|
|
|
|
|
|
|
public String getFtpHost() { return ftpHost; }
|
|
|
|
|
public void setFtpHost(String ftpHost) { this.ftpHost = ftpHost; }
|
|
|
|
|
|
|
|
|
|
public int getFtpPort() { return ftpPort; }
|
|
|
|
|
public void setFtpPort(int ftpPort) { this.ftpPort = ftpPort; }
|
|
|
|
|
|
|
|
|
|
public String getFtpUsername() { return ftpUsername; }
|
|
|
|
|
public void setFtpUsername(String ftpUsername) { this.ftpUsername = ftpUsername; }
|
|
|
|
|
|
|
|
|
|
public String getFtpPassword() { return ftpPassword; }
|
|
|
|
|
public void setFtpPassword(String ftpPassword) { this.ftpPassword = ftpPassword; }
|
|
|
|
|
|
|
|
|
|
public String getFtpSourceDir() { return ftpSourceDir; }
|
|
|
|
|
public void setFtpSourceDir(String ftpSourceDir) { this.ftpSourceDir = ftpSourceDir; }
|
|
|
|
|
|
|
|
|
|
public String getFtpRecordDir() { return ftpRecordDir; }
|
|
|
|
|
public void setFtpRecordDir(String ftpRecordDir) { this.ftpRecordDir = ftpRecordDir; }
|
|
|
|
|
|
|
|
|
|
public String getFtpArchiveDir() { return ftpArchiveDir; }
|
|
|
|
|
public void setFtpArchiveDir(String ftpArchiveDir) { this.ftpArchiveDir = ftpArchiveDir; }
|
|
|
|
|
|
|
|
|
|
public String getPhoneAreaCode() { return phoneAreaCode; }
|
|
|
|
|
public void setPhoneAreaCode(String phoneAreaCode) { this.phoneAreaCode = phoneAreaCode; }
|
|
|
|
|
}
|
|
|
|
|
}
|