|
@@ -9,6 +9,7 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"github.com/shopspring/decimal"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
@@ -53,7 +54,8 @@ type ProjectEntry struct {
|
|
|
SourceType string `json:"SourceType"` // firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
|
Person string `json:"Person"`
|
|
|
Num int `json:"Num"`
|
|
|
- FocusId string `json:"FocusId"`
|
|
|
+ FocusId string `json:"FocusId"` // 监控主键
|
|
|
+ IsFocus int `json:"IsFocus"`
|
|
|
}
|
|
|
|
|
|
func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
|
|
@@ -226,22 +228,25 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
|
|
|
// @Date 2024/4/18
|
|
|
func filterData(req *types.ProjectListReq, resultList []*ProjectEntry, preSales, mmp map[string]interface{}, isSqlPage bool) []*ProjectEntry {
|
|
|
var newList []*ProjectEntry
|
|
|
- f := make(map[string]int, 3)
|
|
|
- if strings.Contains(req.SaleStatus, "1") {
|
|
|
+ f := make(map[string]int, 1)
|
|
|
+ if req.SaleStatus == "1" {
|
|
|
f["is_handle"] = 0
|
|
|
- } else if strings.Contains(req.SaleStatus, "2") {
|
|
|
+ } else if req.SaleStatus == "2" {
|
|
|
f["is_ignore"] = 1
|
|
|
- } else if strings.Contains(req.SaleStatus, "3") {
|
|
|
+ } else if req.SaleStatus == "3" {
|
|
|
f["is_create"] = 1
|
|
|
}
|
|
|
for _, m := range resultList {
|
|
|
+ // 处理/忽略/销售机会
|
|
|
if m1, ok := preSales[m.ProjectId].(map[string]interface{}); ok {
|
|
|
+ m.IsIgnore = common.IntAll(m1["is_handle"])
|
|
|
m.IsIgnore = common.IntAll(m1["is_ignore"])
|
|
|
m.IsCreate = common.IntAll(m1["is_create"])
|
|
|
}
|
|
|
+ // 监控
|
|
|
for _, s := range strings.Split(m.InfoId, ",") {
|
|
|
if mmp[s] != nil {
|
|
|
- m.IsHandle = 1
|
|
|
+ m.IsFocus = 1
|
|
|
m.FocusId = common.ObjToString(mmp[s])
|
|
|
break
|
|
|
}
|
|
@@ -250,13 +255,10 @@ func filterData(req *types.ProjectListReq, resultList []*ProjectEntry, preSales,
|
|
|
for k, v := range f {
|
|
|
if k == "is_handle" && m.IsHandle == v {
|
|
|
newList = append(newList, m)
|
|
|
- break
|
|
|
} else if k == "is_ignore" && m.IsIgnore == v {
|
|
|
newList = append(newList, m)
|
|
|
- break
|
|
|
} else if k == "is_create" && m.IsCreate == v {
|
|
|
newList = append(newList, m)
|
|
|
- break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -384,7 +386,7 @@ func MonitorStatus(uid string) map[string]interface{} {
|
|
|
m1 := make(map[string]interface{})
|
|
|
info := T.BaseMysql.SelectBySql(sql_4, uid)
|
|
|
for _, m := range *info {
|
|
|
- m1[common.ObjToString(m["s_id"])] = util.EncodeId(common.ObjToString(m["id"]))
|
|
|
+ m1[common.ObjToString(m["s_id"])] = util.EncodeId(strconv.Itoa(common.IntAll(m["id"])))
|
|
|
}
|
|
|
return m1
|
|
|
}
|