瀏覽代碼

项目数量处理

WH01243 1 年之前
父節點
當前提交
04cca8b046
共有 1 個文件被更改,包括 16 次插入23 次删除
  1. 16 23
      api/internal/service/owner.go

+ 16 - 23
api/internal/service/owner.go

@@ -501,12 +501,13 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
 	monitorNumber := int64(0)
 	for buyerId, buyerMap := range *dataMap {
 		buyerName := gconv.String(buyerMap["buyerName"])
+		count := int64(0)
 		if _, ok := (*projectMap)[buyerName]; ok {
 			projectMap := (*projectMap)[buyerName]
 			if isMonitor := gconv.Bool(buyerMap["isMonitor"]); isMonitor {
 				monitorNumber++
 			}
-			count := gconv.Int64(projectMap["count"])
+			count = gconv.Int64(projectMap["count"])
 			money := gconv.Int64(projectMap["money"])
 			zbtime := gconv.Int64(projectMap["zbtime"])
 			if sourceType == "1" {
@@ -528,26 +529,13 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
 					IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
 					IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
 				})
-			} else {
-				if count > 2 {
-					highSuccessNumber++
-				}
-				returnData = append(returnData, BuyerProject{
-					BuyerId:   buyerId,
-					BuyerName: buyerName,
-					Project: ProjectEntity{
-						Number:          count,
-						EstimatedAmount: money,
-						Connections:     []map[string]interface{}{},
-					},
-					Area:             gconv.String(projectMap["area"]),
-					Zbtime:           zbtime,
-					IsIgnore:         gconv.Bool(buyerMap["isIgnore"]),
-					IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
-					IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
-				})
 			}
 		} else {
+			if sourceType == "1" {
+				if count < 2 {
+					continue
+				}
+			}
 			returnData = append(returnData, BuyerProject{
 				BuyerId:   buyerId,
 				BuyerName: buyerName,
@@ -562,6 +550,7 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
 				IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
 				IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
 			})
+
 		}
 		connectionsNumber++
 	}
@@ -588,14 +577,18 @@ func MonitorStatusInit(positionId int64, dataMap *map[string]map[string]interfac
 			v["isMonitor"] = true
 			(*newMap)[k] = v
 		} else {
-			if sourceType != "2" && sourceType != "1" {
+			if sourceType != "2" {
 				v["isMonitor"] = false
 				(*newMap)[k] = v
 			}
 		}
 	}
+	if sourceType == "2" {
+		*dataMap = *newMap
+		return
+	}
 	if newMap != nil {
-		dataMap = newMap
+		*dataMap = *newMap
 	}
 }
 func FindStatus(positionId int64) (map[string]bool, map[string]bool, map[string]bool) {
@@ -654,7 +647,7 @@ func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]inter
 		}
 	}
 	if newMap != nil {
-		dataMap = newMap
+		*dataMap = *newMap
 	}
 }
 
@@ -778,7 +771,7 @@ func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, project
 			(*projectMap)[buyerName] = map[string]interface{}{
 				"area":    area,
 				"zbtime":  v.Zbtime_count.Value,
-				"money":   common.RetainDecimal((common.Float64All(v.Money_count.Value) / 10000), 2),
+				"money":   common.RetainDecimal(common.Float64All(v.Money_count.Value)/10000, 2),
 				"count":   v.Doc_count,
 				"buyerId": buyerId,
 			}