|
@@ -40,6 +40,14 @@ public class CalculationFormulaRepositoryImpl implements CalculationFormulaRepos
|
|
|
*/
|
|
|
@Override
|
|
|
public void initTable() {
|
|
|
+ log.info("初始化建表");
|
|
|
+ // 获取数据库类型
|
|
|
+ String dbType = properties.getDbType();
|
|
|
+ // 如果是金仓数据库,直接初始化表
|
|
|
+ if(CalculateResult.DB_KINGBASE.equals(dbType)){
|
|
|
+ this.createTable();
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
// 从配置文件中获取版本
|
|
|
String version = properties.getVersion();
|
|
@@ -51,11 +59,8 @@ public class CalculationFormulaRepositoryImpl implements CalculationFormulaRepos
|
|
|
count = jdbcTemplate.queryForObject(checkSql, Integer.class);
|
|
|
} catch (DataAccessException e) {
|
|
|
// 如果表不存在,则创建表
|
|
|
- if(CalculateResult.DB_ERROR_TABLE_EXIST.equals(e.getCause().toString()) || e.getCause().toString().indexOf("exist")>-1){
|
|
|
- this.createTable();
|
|
|
- }else{
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ log.error(e.toString());
|
|
|
+ this.createTable();
|
|
|
}
|
|
|
|
|
|
// 再次查询表中数据
|
|
@@ -347,6 +352,7 @@ public class CalculationFormulaRepositoryImpl implements CalculationFormulaRepos
|
|
|
*/
|
|
|
private void createTable() {
|
|
|
try {
|
|
|
+ log.info("---------------开始创建准确率计算表---------------");
|
|
|
// 从配置文件中获取版本
|
|
|
String dbType = properties.getDbType();
|
|
|
String path;
|
|
@@ -379,6 +385,7 @@ public class CalculationFormulaRepositoryImpl implements CalculationFormulaRepos
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ log.info("---------------结束创建准确率计算表---------------");
|
|
|
// 更新公式
|
|
|
updateVersion();
|
|
|
}
|