|
@@ -5,7 +5,6 @@ import (
|
|
|
"github.com/shopspring/decimal"
|
|
|
"jy/clear"
|
|
|
u "jy/util"
|
|
|
- qutil "qfw/common/src/qfw/util"
|
|
|
qu "qfw/util"
|
|
|
"regexp"
|
|
|
"strings"
|
|
@@ -491,7 +490,7 @@ func isResetUnitAmountSortKV(table *Table) {
|
|
|
}
|
|
|
}
|
|
|
if isUnitAmount > 1 {
|
|
|
- table.SortKV.Map["中标金额"] = qutil.ObjToString(table.SortKV.Map["中标金额"]) + "万元"
|
|
|
+ table.SortKV.Map["中标金额"] = qu.ObjToString(table.SortKV.Map["中标金额"]) + "万元"
|
|
|
}
|
|
|
}
|
|
|
func isResetUnitPriceSortKV(table *Table) {
|
|
@@ -504,8 +503,8 @@ func isResetUnitPriceSortKV(table *Table) {
|
|
|
}
|
|
|
}
|
|
|
if isMatch && table.SortKV.Map["总价(元)"] == nil {
|
|
|
- if qutil.ObjToString(table.SortKV.Map["序号"]) == "1" &&
|
|
|
- qutil.ObjToString(table.SortKV.Map["数量"]) == "1" {
|
|
|
+ if qu.ObjToString(table.SortKV.Map["序号"]) == "1" &&
|
|
|
+ qu.ObjToString(table.SortKV.Map["数量"]) == "1" {
|
|
|
table.SortKV.Map["总价(元)"] = table.SortKV.Map["单价"]
|
|
|
table.SortKV.Keys = append(table.SortKV.Keys, "总价(元)")
|
|
|
}
|
|
@@ -525,7 +524,7 @@ func isResetAmountAggregateSortKV(table *Table) {
|
|
|
if len(arr1) > 1 && len(arr1) == len(arr2) && len(arr1) == len(arr3) {
|
|
|
amount := float64(0)
|
|
|
for _, nv := range arr3 {
|
|
|
- amount = precisionFloat(amount, qutil.Float64All(nv))
|
|
|
+ amount = precisionFloat(amount, qu.Float64All(nv))
|
|
|
}
|
|
|
if amount > float64(0) {
|
|
|
table.SortKV.Map[v[2]] = fmt.Sprintf("%f", amount)
|
|
@@ -541,7 +540,7 @@ func isResetAmountAggregateSortKV(table *Table) {
|
|
|
if len(arr1) > 1 && len(arr1) == len(arr2) && len(arr1) == len(arr3) && len(arr1) == len(arr4) {
|
|
|
amount := float64(0)
|
|
|
for kv, nv := range arr3 {
|
|
|
- amount = precisionFloat(amount, qutil.Float64All(nv)*qutil.Float64All(arr4[kv]))
|
|
|
+ amount = precisionFloat(amount, qu.Float64All(nv)*qu.Float64All(arr4[kv]))
|
|
|
}
|
|
|
if amount > float64(0) {
|
|
|
if table.SortKV.Map["总价(元)"] == nil {
|
|
@@ -679,7 +678,7 @@ func initLineMapLineMapArr(table *Table) (lineMapArr map[string]*SortMap, lineMa
|
|
|
val := table.SortKV.Map[key]
|
|
|
key = regReplAllSpace.ReplaceAllString(key, "")
|
|
|
key = strings.Replace(key, "", "", -1) //处理一个特殊的采购量 经上层处理空格后未处理掉
|
|
|
- //qutil.Debug(key, "---------------------------", val)
|
|
|
+ //qu.Debug(key, "---------------------------", val)
|
|
|
if realTypeVal, ok := val.([]string); ok { //val为数组 {"数量":["1","2","3"]}
|
|
|
/*
|
|
|
{
|
|
@@ -719,7 +718,7 @@ func initLineMapLineMapArr(table *Table) (lineMapArr map[string]*SortMap, lineMa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //qutil.Debug("lineMapArr---", lineMapArr[line].Keys, lineMapArr[line].Map)
|
|
|
+ //qu.Debug("lineMapArr---", lineMapArr[line].Keys, lineMapArr[line].Map)
|
|
|
} else if realTypeVal, b := val.(string); b { //val为字符串 {"数量":"1"}
|
|
|
/*
|
|
|
{
|
|
@@ -742,11 +741,11 @@ func initLineMapLineMapArr(table *Table) (lineMapArr map[string]*SortMap, lineMa
|
|
|
} else {
|
|
|
lineValMap2.AddKey(key, realTypeVal)
|
|
|
}
|
|
|
- //qutil.Debug("lineMap---", lineMap[line].Keys, lineMap[line].Map)
|
|
|
+ //qu.Debug("lineMap---", lineMap[line].Keys, lineMap[line].Map)
|
|
|
} else {
|
|
|
// "_id" : ObjectId("5c2c3802a5cb26b9b78646c4")5c2b0551a5cb26b9b7cb05db否5c2a42e6a5cb26b9b763ba5a采购人:一、采购人5c2b06f5a5cb26b9b7cc4409
|
|
|
//成交供应商排名 [map[entname:昆明合优科技有限公司 sortstr:第一中标候选人 sort:1] map[sort:2 entname:昆明厚起科技有限公司 sortstr:第二中标候选人] map[entname:云南远安科技发展有限公司 sortstr:第三中标候选人 sort:3]]
|
|
|
- //qutil.Debug("err data:", key, val)
|
|
|
+ //qu.Debug("err data:", key, val)
|
|
|
}
|
|
|
}
|
|
|
return lineMapArr, lineMap
|
|
@@ -776,7 +775,7 @@ func dealStrData(kv map[string]string) []map[string]string {
|
|
|
|
|
|
//组装数据,每一行的数据为一数据集合
|
|
|
func assembleData(m interface{}, n int) []map[string]string {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
/*
|
|
|
{
|
|
|
"itemname":["计算机","打印机","机柜"],
|
|
@@ -836,7 +835,7 @@ func assembleData(m interface{}, n int) []map[string]string {
|
|
|
}
|
|
|
|
|
|
func convert(key, r string) bool {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
flag := false
|
|
|
key = tabletitleclear.ReplaceAllString(key, "")
|
|
|
reg, err := regexp.Compile(r)
|
|
@@ -849,7 +848,7 @@ func convert(key, r string) bool {
|
|
|
}
|
|
|
|
|
|
func hasKey(table *Table, n int) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if table.TableResult.HasKey == 1 {
|
|
|
return
|
|
|
}
|
|
@@ -859,7 +858,7 @@ func hasKey(table *Table, n int) {
|
|
|
}
|
|
|
|
|
|
func hasGoods(table *Table, data ...string) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
goodsArr := make([]string, len(data))
|
|
|
//fmt.Println("table.TableResult.HasGoods=====", table.TableResult.HasGoods)
|
|
|
if table.TableResult.HasGoods == 1 {
|
|
@@ -879,7 +878,7 @@ func hasGoods(table *Table, data ...string) {
|
|
|
}
|
|
|
|
|
|
func hasBrand(table *Table, data ...string) ([]string, bool) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
//fmt.Println("table.TableResult.HasBrand---------", table.TableResult.HasBrand)
|
|
|
brandArr := make([]string, len(data))
|
|
|
// if table.TableResult.HasBrand == 1 {
|
|
@@ -904,7 +903,7 @@ func hasBrand(table *Table, data ...string) ([]string, bool) {
|
|
|
|
|
|
//过滤td值
|
|
|
func filterVal(val ...string) ([]string, bool) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
n := 0 //记录被过滤的个数
|
|
|
for i, v := range val {
|
|
|
if len(clearnn.FindStringSubmatch(v)) > 0 {
|
|
@@ -929,7 +928,7 @@ func filterVal(val ...string) ([]string, bool) {
|
|
|
|
|
|
//过滤itemname全是数字
|
|
|
func filterItem(itemval ...string) []string {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
result := []string{}
|
|
|
for _, v := range itemval {
|
|
|
afterFilter := numclear.ReplaceAllString(v, "")
|
|
@@ -944,7 +943,7 @@ func filterItem(itemval ...string) []string {
|
|
|
|
|
|
//处理价格
|
|
|
func dealPriceInterface(key string, val ...string) (result []interface{}) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
for _, v := range val {
|
|
|
if num1.MatchString(v) { //含数字
|
|
|
tdIsWan := strings.Contains(v, "万")
|
|
@@ -965,7 +964,7 @@ func dealPriceInterface(key string, val ...string) (result []interface{}) {
|
|
|
|
|
|
//处理number
|
|
|
func dealNumberInterface(val ...string) (result []interface{}) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
for _, v := range val { //1个 1.00个
|
|
|
n := numclear.FindString(v)
|
|
|
if n == "" {
|
|
@@ -973,7 +972,7 @@ func dealNumberInterface(val ...string) (result []interface{}) {
|
|
|
} else if tmp := clear.NumChar[n]; tmp != nil { //一二三...
|
|
|
result = append(result, tmp)
|
|
|
} else { //数字
|
|
|
- result = append(result, qutil.IntAll(strings.Split(n, ".")[0]))
|
|
|
+ result = append(result, qu.IntAll(strings.Split(n, ".")[0]))
|
|
|
}
|
|
|
}
|
|
|
return
|
|
@@ -981,7 +980,7 @@ func dealNumberInterface(val ...string) (result []interface{}) {
|
|
|
|
|
|
//处理价格
|
|
|
func dealPrice(key string, val ...string) []string {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
result := []string{}
|
|
|
for _, v := range val {
|
|
|
data := []interface{}{v, key}
|
|
@@ -1008,7 +1007,7 @@ func dealPrice(key string, val ...string) []string {
|
|
|
|
|
|
//处理number
|
|
|
func dealNumber(val ...string) ([]string, []string) {
|
|
|
- defer qutil.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
unitnameArr := []string{}
|
|
|
result := []string{}
|
|
|
for _, v := range val { //1个 1.00个
|