|
@@ -71,7 +71,7 @@ func RefreshEdbDataByThs(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
if len(item.Tables) > 0 {
|
|
|
table := item.Tables[0]
|
|
|
dataLen := len(table.Time)
|
|
|
- addSql := ` INSERT INTO edb_data_ths(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_ths(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
nowStr := time.Now().Format(utils.FormatDateTime)
|
|
|
var isAdd bool
|
|
|
for i := 0; i < dataLen; i++ {
|
|
@@ -92,7 +92,7 @@ func RefreshEdbDataByThs(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
addSql += "("
|
|
|
addSql += strconv.Itoa(edbInfoId) + "," + "'" + edbCode + "'" + "," + "'" + eDate + "'" + "," + utils.SubFloatToString(sValue, 30) + "," + "'" + nowStr + "'" +
|
|
|
- "," + "'" + nowStr + "'" + "," + "1"
|
|
|
+ "," + "'" + nowStr + "'"
|
|
|
addSql += "," + "'" + timeStr + "'"
|
|
|
addSql += "),"
|
|
|
isAdd = true
|
|
@@ -155,7 +155,7 @@ func RefreshEdbDataByWind(edbInfoId int, edbCode, startDate, endDate string) (er
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- addSql := ` INSERT INTO edb_data_wind(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_wind(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
nowStr := time.Now().Format(utils.FormatDateTime)
|
|
|
var isAdd bool
|
|
|
for k, v := range item.Dt {
|
|
@@ -175,7 +175,7 @@ func RefreshEdbDataByWind(edbInfoId int, edbCode, startDate, endDate string) (er
|
|
|
fmt.Println(dateTime)
|
|
|
addSql += "("
|
|
|
addSql += strconv.Itoa(edbInfoId) + "," + "'" + edbCode + "'" + "," + "'" + dateTime + "'" + "," + utils.SubFloatToString(val, 30) + "," + "'" + nowStr + "'" +
|
|
|
- "," + "'" + nowStr + "'" + "," + "1"
|
|
|
+ "," + "'" + nowStr + "'"
|
|
|
addSql += "," + "'" + timeStr + "'"
|
|
|
addSql += "),"
|
|
|
} else {
|
|
@@ -322,7 +322,7 @@ func RefreshAllEdbDataByManual(edbInfoId, source int, edbCode string) (err error
|
|
|
existDataMap[v.DataTime] = v
|
|
|
}
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_manual(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_manual(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
manualMap := make(map[string]*edbDataModel.ManualEdbdata)
|
|
|
for _, v := range manualDataList {
|
|
@@ -391,7 +391,7 @@ func GetAddSql(edbInfoId, edbCode, dataTime, timestampStr string, value string)
|
|
|
nowStr := time.Now().Format(utils.FormatDateTime)
|
|
|
addSql += "("
|
|
|
addSql += edbInfoId + "," + "'" + edbCode + "'" + "," + "'" + dataTime + "'" + "," + value + "," + "'" + nowStr + "'" +
|
|
|
- "," + "'" + nowStr + "'" + "," + "1"
|
|
|
+ "," + "'" + nowStr + "'"
|
|
|
addSql += "," + "'" + timestampStr + "'"
|
|
|
addSql += "),"
|
|
|
return
|
|
@@ -434,7 +434,7 @@ func RefreshEdbDataByLz(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
lzDataList, err := edbDataModel.GetLzSurveyDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_lz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_lz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
for _, v := range lzDataList {
|
|
|
item := v
|
|
@@ -454,7 +454,7 @@ func RefreshEdbDataByLz(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
timeStr := fmt.Sprintf("%d", timestamp)
|
|
|
addSql += "("
|
|
|
addSql += edbInfoIdStr + "," + "'" + edbCode + "'" + "," + "'" + eDate + "'" + "," + sValue + "," + "'" + nowStr + "'" +
|
|
|
- "," + "'" + nowStr + "'" + "," + "1" + "," + "'" + timeStr + "'"
|
|
|
+ "," + "'" + nowStr + "'" + "," + "'" + timeStr + "'"
|
|
|
addSql += "),"
|
|
|
isAdd = true
|
|
|
} else {
|
|
@@ -529,7 +529,7 @@ func RefreshAllEdbDataByYs(edbInfoId, source int, edbCode, startDate, endDate st
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_ys(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_ys(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
for _, sv := range smmDateList {
|
|
|
if existVal, ok := existDataMap[sv.DataTime]; !ok {
|
|
@@ -920,7 +920,7 @@ func RefreshEdbDataByGl(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
glDataList, err := edbDataModel.GetGlDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_gl(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_gl(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -999,7 +999,7 @@ func RefreshAllEdbDataByLt(edbInfoId, source int, edbCode, startDate, endDate st
|
|
|
}
|
|
|
edbInfoIdStr := strconv.Itoa(edbInfoId)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_lt(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_lt(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
|
|
|
for timestampInt, edbValue := range ltDataList {
|
|
@@ -1137,7 +1137,7 @@ func RefreshEdbDataByZz(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
glDataList, err := edbDataModel.GetZzDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_zz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_zz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -1240,7 +1240,7 @@ func RefreshEdbDataByDl(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
glDataList, err := edbDataModel.GetDlDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_dl(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_dl(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -1343,7 +1343,7 @@ func RefreshEdbDataBySh(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
glDataList, err := edbDataModel.GetShDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_sh(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_sh(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -1446,7 +1446,7 @@ func RefreshEdbDataByCffex(edbInfoId int, edbCode, startDate, endDate string) (e
|
|
|
|
|
|
glDataList, err := edbDataModel.GetCffexDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_cffex(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_cffex(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -1551,7 +1551,7 @@ func RefreshEdbDataByShfe(edbInfoId int, edbCode, startDate, endDate string) (er
|
|
|
|
|
|
glDataList, err := edbDataModel.GetShfeDataByTradeCode(condition, pars)
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_ine(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_ine(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range glDataList {
|
|
@@ -1662,7 +1662,7 @@ func RefreshEdbDataByGie(edbInfoId int, edbCode, startDate, endDate string) (err
|
|
|
|
|
|
eicDataList, err := edbDataModel.GetGieDataByTradeCode(condition, pars)
|
|
|
fmt.Println("eicDataList", len(eicDataList))
|
|
|
- addSql := ` INSERT INTO edb_data_gie(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_gie(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
for _, v := range eicDataList {
|
|
@@ -1775,7 +1775,7 @@ func RefreshAllCalculate(edbInfoIdArr []*edbInfoModel.EdbInfo, edbInfoId, source
|
|
|
}
|
|
|
|
|
|
formulaMap := CheckFormula(formulaStr)
|
|
|
- addSql := ` INSERT INTO edb_data_calculate(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
|
|
|
//获取指标所有数据
|
|
@@ -2010,6 +2010,7 @@ func RefreshAllCalculateLjzzy(edbInfoId, source int, fromEdbInfo *edbInfoModel.E
|
|
|
return
|
|
|
}
|
|
|
edbInfoIdStr := strconv.Itoa(edbInfoId)
|
|
|
+ fmt.Println(edbInfoIdStr)
|
|
|
//计算数据
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
@@ -2051,7 +2052,7 @@ func RefreshAllCalculateLjzzy(edbInfoId, source int, fromEdbInfo *edbInfoModel.E
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_ljzzy(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_ljzzy(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
//获取指标所有数据
|
|
|
existDataList := make([]*edbDataModel.EdbDataBase, 0)
|
|
@@ -2068,6 +2069,7 @@ func RefreshAllCalculateLjzzy(edbInfoId, source int, fromEdbInfo *edbInfoModel.E
|
|
|
dataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
existDataMap := make(map[string]string)
|
|
|
+
|
|
|
for yk, yv := range yearMap {
|
|
|
_, oneMonthOk := yv[1]
|
|
|
_, twoMonthOk := yv[2]
|
|
@@ -2087,10 +2089,12 @@ func RefreshAllCalculateLjzzy(edbInfoId, source int, fromEdbInfo *edbInfoModel.E
|
|
|
}
|
|
|
if i == 2 {
|
|
|
dataOneItem := yv[1]
|
|
|
- date = dataCurrentItem.DataTime
|
|
|
- twoMonth := decimal.NewFromFloat(dataCurrentItem.Value)
|
|
|
- oneMonth := decimal.NewFromFloat(dataOneItem.Value)
|
|
|
- val, _ = twoMonth.Sub(oneMonth).Float64()
|
|
|
+ if dataOneItem != nil {
|
|
|
+ date = dataCurrentItem.DataTime
|
|
|
+ twoMonth := decimal.NewFromFloat(dataCurrentItem.Value)
|
|
|
+ oneMonth := decimal.NewFromFloat(dataOneItem.Value)
|
|
|
+ val, _ = twoMonth.Sub(oneMonth).Float64()
|
|
|
+ }
|
|
|
}
|
|
|
} else { //1月无值
|
|
|
dataTwoItem := yv[2]
|
|
@@ -2213,7 +2217,7 @@ func RefreshAllCalculateTbz(edbInfoId, source int, fromEdbInfo *edbInfoModel.Edb
|
|
|
existDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
//fmt.Println("existDataMap:", existDataMap)
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_tbz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_tbz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existAddDataMap := make(map[string]string)
|
|
|
for _, av := range dateArr {
|
|
@@ -2483,7 +2487,7 @@ func RefreshAllCalculateTcz(edbInfoId, source int, fromEdbInfo *edbInfoModel.Edb
|
|
|
existDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_tcz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_tcz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existAddDataMap := make(map[string]string)
|
|
|
for _, av := range dateArr {
|
|
@@ -2741,7 +2745,7 @@ func RefreshAllCalculateNszydpjjs(edbInfoId, source, formulaInt int, fromEdbInfo
|
|
|
fromDataMap[v.DataTime] = v
|
|
|
}
|
|
|
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_nszydpjjs(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_nszydpjjs(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
dataTableName := edbDataModel.GetEdbDataTableName(source)
|
|
|
arrLen := len(fromDateArr)
|
|
@@ -2875,7 +2879,7 @@ func RefreshAllCalculateHbz(edbInfoId, source int, fromEdbInfo *edbInfoModel.Edb
|
|
|
for _, v := range existDataList {
|
|
|
existDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_hbz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_hbz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
dataLen := len(dataList)
|
|
@@ -2996,8 +3000,8 @@ func RefreshAllCalculateHcz(edbInfoId, source int, fromEdbInfo *edbInfoModel.Edb
|
|
|
for _, v := range existDataList {
|
|
|
existDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
- fmt.Println("existDataMap:", existDataMap)
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_hcz(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ //fmt.Println("existDataMap:", existDataMap)
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_hcz(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
existMap := make(map[string]string)
|
|
|
dataLen := len(dataList)
|
|
@@ -3118,8 +3122,8 @@ func RefreshAllCalculateBp(edbInfoId, source int, fromEdbInfo *edbInfoModel.EdbI
|
|
|
for _, v := range existDataList {
|
|
|
existDataMap[v.DataTime] = v.Value
|
|
|
}
|
|
|
- fmt.Println("existDataMap:", existDataMap)
|
|
|
- addSql := ` INSERT INTO edb_data_calculate_bp(edb_info_id,edb_code,data_time,value,create_time,modify_time,status,data_timestamp) values `
|
|
|
+ //fmt.Println("existDataMap:", existDataMap)
|
|
|
+ addSql := ` INSERT INTO edb_data_calculate_bp(edb_info_id,edb_code,data_time,value,create_time,modify_time,data_timestamp) values `
|
|
|
var isAdd bool
|
|
|
|
|
|
existMap := make(map[string]string)
|