Browse Source

Merge branch 'bugfix_3457'

ziwen 1 year ago
parent
commit
0b2db504a2
2 changed files with 17 additions and 1 deletions
  1. 11 0
      controllers/target.go
  2. 6 1
      models/data_manage/excel_style.go

+ 11 - 0
controllers/target.go

@@ -3483,6 +3483,17 @@ func (this *TargetController) ExcelDataAdd() {
 						continue
 					}
 					valueListMap[index] = valueMap["m"].(string)
+
+					// 09-27 千位分隔符时用 "m" 取字符串存数据库会把逗号当小数点,现在换用 "v" 直接取数字再转为字符串,看看会不会有问题
+					if ct, ok := valueMap["ct"].(map[string]interface{}); ok{
+						fa, _ := ct["fa"]
+						if fa == "#,##0.000" {
+							value = valueMap["v"]
+							floatValue := valueMap["v"].(float64)
+							valueListMap[index] = strconv.FormatFloat(floatValue, 'f', -1, 64)
+						}
+					}
+
 					//valueList = append(valueList, valueMap["m"].(string))
 					//fmt.Println("valueList:", valueList)
 				}

+ 6 - 1
models/data_manage/excel_style.go

@@ -203,4 +203,9 @@ func GetExcelEdbdataMappingCount(classifyId int, tradeCode, frequency string) (c
 //	o := orm.NewOrmUsingDB("edb")
 //	_, err = o.Raw(sql, close, tradeCode, dt).Exec()
 //	return
-//}
+//}
+
+type Ct struct {
+	Fa string `json:"fa"`
+	T  string `json:"t"`
+}