|
@@ -12,10 +12,9 @@ import (
|
|
"database/sql"
|
|
"database/sql"
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/RoaringBitmap/roaring"
|
|
"github.com/RoaringBitmap/roaring"
|
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"log"
|
|
"log"
|
|
- "regexp"
|
|
|
|
- "strconv"
|
|
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
@@ -26,87 +25,60 @@ const (
|
|
)
|
|
)
|
|
|
|
|
|
type EmPloyService struct{}
|
|
type EmPloyService struct{}
|
|
|
|
+type PersonSmmary struct {
|
|
|
|
+ EntUserId int64
|
|
|
|
+ Summary map[int64]*roaring.Bitmap
|
|
|
|
+}
|
|
|
|
|
|
// InfoEmployinfo 收录情况查询
|
|
// InfoEmployinfo 收录情况查询
|
|
func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string]interface{} {
|
|
func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string]interface{} {
|
|
var data []map[string]interface{}
|
|
var data []map[string]interface{}
|
|
|
|
+ depIDArr := ""
|
|
|
|
+ if in.EntNicheDis > 0 {
|
|
|
|
+ //查询所有部门标识
|
|
|
|
+ deptArr := MC.MainMysql.SelectBySql("select GROUP_CONCAT(DISTINCT b.id) as depIDArr from entniche_department_parent a"+
|
|
|
|
+ " INNER JOIN entniche_department b "+
|
|
|
|
+ "on (b.ent_id=? and (b.id=? or (a.pid=? and a.id=b.id)))", in.EntId, in.EntDeptId, in.EntDeptId)
|
|
|
|
+ if len(*deptArr) == 0 {
|
|
|
|
+ return data
|
|
|
|
+ }
|
|
|
|
+ depIDArr = common.InterfaceToStr((*deptArr)[0]["depIDArr"])
|
|
|
|
+ if depIDArr == "" {
|
|
|
|
+ return data
|
|
|
|
+ }
|
|
|
|
+ }
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
- table, findKey, employKey, source := EmployKeyFormat(in.EmployType)
|
|
|
|
id := ""
|
|
id := ""
|
|
- id = IdFormat(v, in.EmployType)
|
|
|
|
|
|
+ id = idFormat(v, in.EmployType)
|
|
|
|
+ table, findKey, employKey, source := employKeyFormat(in.EmployType, id)
|
|
if id == "" {
|
|
if id == "" {
|
|
log.Println(v, in.EmployType, "该信息查询不到数据")
|
|
log.Println(v, in.EmployType, "该信息查询不到数据")
|
|
break
|
|
break
|
|
}
|
|
}
|
|
- valueMap := map[string]interface{}{
|
|
|
|
- "id": v,
|
|
|
|
- }
|
|
|
|
- //有收录情况
|
|
|
|
- //summaryMap := SummaryFormat(in.PositionId)
|
|
|
|
- //vint = mongodb.StringTOBsonId(id).Timestamp().Unix()
|
|
|
|
- //vint = extractNumbers(id)
|
|
|
|
- //valueMap["isEmploy"] = summaryMap[in.EmployType].Contains(uint32(vint))
|
|
|
|
- employData := MC.CrmMysql.FindOne(table, map[string]interface{}{
|
|
|
|
- employKey: id,
|
|
|
|
- "position_id": in.PositionId,
|
|
|
|
- "source": source,
|
|
|
|
- }, "is_ignore,status,id", "")
|
|
|
|
- employId := int64(0)
|
|
|
|
- if employData != nil && len(*employData) > 0 {
|
|
|
|
- valueMap["isIgnore"] = common.If(common.Int64All((*employData)["is_ignore"]) == 1, true, false)
|
|
|
|
- valueMap["isEmploy"] = common.If(common.Int64All((*employData)["status"]) == 1, true, false)
|
|
|
|
- employId = common.Int64All((*employData)["id"])
|
|
|
|
- valueMap["employId"] = employId
|
|
|
|
- } else {
|
|
|
|
- valueMap["isIgnore"] = false
|
|
|
|
- valueMap["isEmploy"] = false
|
|
|
|
- }
|
|
|
|
- if len(strings.Split(in.IdArr, ",")) == 1 && employId > 0 {
|
|
|
|
- //列表查询
|
|
|
|
- //是否忽略处理
|
|
|
|
- //客户数量
|
|
|
|
- customCount := MC.CrmMysql.Count(entity.CUSTOM, map[string]interface{}{
|
|
|
|
- findKey: employId,
|
|
|
|
- "position_id": in.PositionId,
|
|
|
|
- })
|
|
|
|
- valueMap["customCount"] = customCount
|
|
|
|
- if in.EmployType == 1 || in.EmployType == 4 {
|
|
|
|
- //销售线索数量
|
|
|
|
- clueCount := MC.CrmMysql.Count(entity.SALE_CLUE, map[string]interface{}{
|
|
|
|
- "employ_info_id": employId,
|
|
|
|
- "position_id": in.PositionId,
|
|
|
|
- })
|
|
|
|
- valueMap["clueCount"] = clueCount
|
|
|
|
- //销售机会数量
|
|
|
|
- chanceCount := MC.CrmMysql.Count(entity.SALE_CHANCE, map[string]interface{}{
|
|
|
|
- "employ_info_id": id,
|
|
|
|
- "position_id": in.PositionId,
|
|
|
|
- })
|
|
|
|
- valueMap["chanceCount"] = chanceCount
|
|
|
|
- }
|
|
|
|
|
|
+ if in.EntNicheDis > 0 {
|
|
|
|
+ data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in))
|
|
} else {
|
|
} else {
|
|
- valueMap["chanceCount"] = 0
|
|
|
|
- valueMap["clueCount"] = 0
|
|
|
|
- valueMap["isIgnore"] = false
|
|
|
|
- valueMap["customCount"] = 0
|
|
|
|
|
|
+ data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in))
|
|
}
|
|
}
|
|
- data = append(data, valueMap)
|
|
|
|
}
|
|
}
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
|
|
// EmployOperate 收录操作
|
|
// EmployOperate 收录操作
|
|
-func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) bool {
|
|
|
|
|
|
+func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string) {
|
|
//收录汇总表
|
|
//收录汇总表
|
|
- table, _, employKey, source := EmployKeyFormat(in.EmployType)
|
|
|
|
//summaryMap := SummaryFormat(in.PositionId)
|
|
//summaryMap := SummaryFormat(in.PositionId)
|
|
|
|
+ msg := ""
|
|
return MC.CrmMysql.ExecTx("收录操作", func(tx *sql.Tx) bool {
|
|
return MC.CrmMysql.ExecTx("收录操作", func(tx *sql.Tx) bool {
|
|
|
|
+ fool := true
|
|
for _, v1 := range strings.Split(in.IdArr, ",") {
|
|
for _, v1 := range strings.Split(in.IdArr, ",") {
|
|
|
|
+
|
|
//id转中文
|
|
//id转中文
|
|
id := ""
|
|
id := ""
|
|
findMap := map[string]interface{}{}
|
|
findMap := map[string]interface{}{}
|
|
findMap["position_id"] = in.PositionId
|
|
findMap["position_id"] = in.PositionId
|
|
- id = IdFormat(v1, in.EmployType)
|
|
|
|
|
|
+ id = idFormat(v1, in.EmployType)
|
|
|
|
+ table, _, employKey, source := employKeyFormat(in.EmployType, id)
|
|
findMap[employKey] = id
|
|
findMap[employKey] = id
|
|
if id == "" {
|
|
if id == "" {
|
|
log.Println(v1, in.EmployType, "该信息查询不到数据")
|
|
log.Println(v1, in.EmployType, "该信息查询不到数据")
|
|
@@ -120,55 +92,53 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) bool {
|
|
} else {
|
|
} else {
|
|
//收录新增
|
|
//收录新增
|
|
data := map[string]interface{}{}
|
|
data := map[string]interface{}{}
|
|
|
|
+ data["source"] = source
|
|
if in.EmployType == 1 || in.EmployType == 4 {
|
|
if in.EmployType == 1 || in.EmployType == 4 {
|
|
- data = InfoFind(id, in.EmployType)
|
|
|
|
- data["employ_way"] = 1
|
|
|
|
- data["jybx_url"] = "/article/content/" + v1 + ".html"
|
|
|
|
|
|
+ data = infoFind(id, v1)
|
|
} else if in.EmployType == 2 {
|
|
} else if in.EmployType == 2 {
|
|
- data = CustomFind(id, in.EmployType)
|
|
|
|
|
|
+ data = customFind(id, in.EmployType)
|
|
data["jybx_url"] = "/swordfish/page_big_pc/svip/ent_ser_portrait/" + v1
|
|
data["jybx_url"] = "/swordfish/page_big_pc/svip/ent_ser_portrait/" + v1
|
|
} else if in.EmployType == 3 {
|
|
} else if in.EmployType == 3 {
|
|
- data = CustomFind(id, in.EmployType)
|
|
|
|
|
|
+ data = customFind(id, in.EmployType)
|
|
data["jybx_url"] = "/swordfish/page_big_pc/unit_portrayal/" + v1
|
|
data["jybx_url"] = "/swordfish/page_big_pc/unit_portrayal/" + v1
|
|
}
|
|
}
|
|
data["position_id"] = in.PositionId
|
|
data["position_id"] = in.PositionId
|
|
data["ent_id"] = in.EntId
|
|
data["ent_id"] = in.EntId
|
|
- data["source"] = source
|
|
|
|
|
|
+ data["ent_dept_id"] = in.EntDeptId
|
|
ok := MC.CrmMysql.InsertByTx(tx, table, data)
|
|
ok := MC.CrmMysql.InsertByTx(tx, table, data)
|
|
if ok <= 0 {
|
|
if ok <= 0 {
|
|
log.Println(v1, id, in.EmployType, "收录失败")
|
|
log.Println(v1, id, in.EmployType, "收录失败")
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ fool = true
|
|
} else {
|
|
} else {
|
|
//取消收录
|
|
//取消收录
|
|
- ok := MC.CrmMysql.UpdateByTx(tx, table, findMap, map[string]interface{}{
|
|
|
|
- "status": -1,
|
|
|
|
- })
|
|
|
|
- if !ok {
|
|
|
|
- log.Println(v1, id, in.EmployType, "取消收录失败")
|
|
|
|
|
|
+ if MC.CrmMysql.Count(table, findMap) > 0 {
|
|
|
|
+ ok := MC.CrmMysql.UpdateByTx(tx, table, findMap, map[string]interface{}{
|
|
|
|
+ "status": -1,
|
|
|
|
+ })
|
|
|
|
+ if !ok {
|
|
|
|
+ log.Println(v1, id, in.EmployType, "取消收录失败")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ fool = false
|
|
|
|
+ if in.EmployType == 1 {
|
|
|
|
+ msg = "该资讯已有员工收录,不可取消收录。"
|
|
|
|
+ } else {
|
|
|
|
+ msg = "该企业已有员工收录,不可取消收录。"
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- /*//收录汇总表处理
|
|
|
|
- vint := extractNumbers(id)
|
|
|
|
- if in.IsEmploy {
|
|
|
|
- summaryMap[in.EmployType].Add(uint32(vint))
|
|
|
|
- } else {
|
|
|
|
- summaryMap[in.EmployType].Remove(uint32(vint))
|
|
|
|
- }*/
|
|
|
|
- //fool = true
|
|
|
|
|
|
+ return fool
|
|
}
|
|
}
|
|
- /*if fool {
|
|
|
|
- return SummarySave(tx, in.PositionId, summaryMap)
|
|
|
|
- } else {
|
|
|
|
- return false
|
|
|
|
- }*/
|
|
|
|
- return true
|
|
|
|
- })
|
|
|
|
|
|
+ return fool
|
|
|
|
+ }), msg
|
|
}
|
|
}
|
|
|
|
|
|
-// CustomFind 企业信息查询
|
|
|
|
-func CustomFind(id string, employType int64) map[string]interface{} {
|
|
|
|
|
|
+// customFind 企业信息查询
|
|
|
|
+func customFind(id string, employType int64) map[string]interface{} {
|
|
data := map[string]interface{}{}
|
|
data := map[string]interface{}{}
|
|
//company_id 企业id name户名称 address 地址 industry 行业
|
|
//company_id 企业id name户名称 address 地址 industry 行业
|
|
if employType == 2 {
|
|
if employType == 2 {
|
|
@@ -196,43 +166,47 @@ func CustomFind(id string, employType int64) map[string]interface{} {
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
|
|
-// InfoFind 标讯信息查询
|
|
|
|
-func InfoFind(id string, employType int64) map[string]interface{} {
|
|
|
|
|
|
+// infoFind 标讯信息查询
|
|
|
|
+func infoFind(id string, v1 string) map[string]interface{} {
|
|
data := map[string]interface{}{}
|
|
data := map[string]interface{}{}
|
|
//source_id 信息id、项目id- title 标题-area 省 -city 市 -subtype 信息类型二级分类
|
|
//source_id 信息id、项目id- title 标题-area 省 -city 市 -subtype 信息类型二级分类
|
|
//buyerclass 采购单位行业 -budget 预算 -bidamount 中标金额 buyer采购单位 annex有无附件 publishtime发布时间 projectname 项目时间
|
|
//buyerclass 采购单位行业 -budget 预算 -bidamount 中标金额 buyer采购单位 annex有无附件 publishtime发布时间 projectname 项目时间
|
|
//ownerclass 业主类型(拟在建搜索) expurasing_time 预计采购时间 jybx_url 标讯详情页
|
|
//ownerclass 业主类型(拟在建搜索) expurasing_time 预计采购时间 jybx_url 标讯详情页
|
|
- if employType == 1 {
|
|
|
|
- //标讯信息
|
|
|
|
- obj := map[string]interface{}{}
|
|
|
|
- brobj, ok := MC.Mgo.Find("bidding_rec", bson.M{"s_id": id}, `{"l_recoverydate":-1}`, public.MgoBiddingFields, false, 0, 1)
|
|
|
|
- if ok && (*brobj) != nil && len(*brobj) == 1 && (*brobj)[0] != nil {
|
|
|
|
- obj = (*brobj)[0]
|
|
|
|
- } else {
|
|
|
|
- aobj, ok := MC.MgoBidding.FindById("bidding", id, public.MgoBiddingFields)
|
|
|
|
- if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
|
|
|
|
- aobj, ok = MC.MgoBidding.FindById("bidding_back", id, public.MgoBiddingFields)
|
|
|
|
- }
|
|
|
|
- obj = *aobj
|
|
|
|
|
|
+ //标讯信息
|
|
|
|
+ obj := map[string]interface{}{}
|
|
|
|
+ brobj, ok := MC.Mgo.Find("bidding_rec", bson.M{"s_id": id}, `{"l_recoverydate":-1}`, public.MgoBiddingFields, false, 0, 1)
|
|
|
|
+ if ok && (*brobj) != nil && len(*brobj) == 1 && (*brobj)[0] != nil {
|
|
|
|
+ obj = (*brobj)[0]
|
|
|
|
+ } else {
|
|
|
|
+ aobj, ok := MC.MgoBidding.FindById("bidding", id, public.MgoBiddingFields)
|
|
|
|
+ if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
|
|
|
|
+ aobj, ok = MC.MgoBidding.FindById("bidding_back", id, public.MgoBiddingFields)
|
|
}
|
|
}
|
|
- if ok && obj != nil && len(obj) > 0 {
|
|
|
|
- toptype := common.InterfaceToStr(obj["toptype"])
|
|
|
|
- subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
|
- data["title"] = common.ObjToString(obj["title"])
|
|
|
|
- data["city"] = obj["city"]
|
|
|
|
- data["area"] = obj["area"]
|
|
|
|
- data["subtype"] = obj["subtype"]
|
|
|
|
- data["buyerclass"] = obj["buyerclass"]
|
|
|
|
- data["budget"] = obj["budget"]
|
|
|
|
- data["bidamount"] = obj["bidamount"]
|
|
|
|
- data["annex"] = 0
|
|
|
|
- data["buyer"] = obj["buyer"]
|
|
|
|
- data["winner"] = obj["s_winner"]
|
|
|
|
- //类型处理
|
|
|
|
- /*if subtype == "拟建" {
|
|
|
|
- data["type"] = 1
|
|
|
|
- data["type"] = 2
|
|
|
|
- } else */
|
|
|
|
|
|
+ obj = *aobj
|
|
|
|
+ }
|
|
|
|
+ if ok && obj != nil && len(obj) > 0 {
|
|
|
|
+ toptype := common.InterfaceToStr(obj["toptype"])
|
|
|
|
+ subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
|
+ data["title"] = common.ObjToString(obj["title"])
|
|
|
|
+ data["city"] = obj["city"]
|
|
|
|
+ data["area"] = obj["area"]
|
|
|
|
+ data["subtype"] = obj["subtype"]
|
|
|
|
+ data["buyerclass"] = obj["buyerclass"]
|
|
|
|
+ data["budget"] = obj["budget"]
|
|
|
|
+ data["bidamount"] = obj["bidamount"]
|
|
|
|
+ data["annex"] = 0
|
|
|
|
+ data["buyer"] = obj["buyer"]
|
|
|
|
+ data["winner"] = obj["s_winner"]
|
|
|
|
+ data["jybx_url"] = "/article/content/" + v1 + ".html"
|
|
|
|
+ //类型处理
|
|
|
|
+ /*if subtype == "拟建" {
|
|
|
|
+ data["type"] = 1
|
|
|
|
+ data["type"] = 2
|
|
|
|
+ } else */
|
|
|
|
+ if subtype == "拟建" {
|
|
|
|
+ data = niJianHandle(id, data, v1)
|
|
|
|
+ data["type"] = 1
|
|
|
|
+ } else {
|
|
if toptype == "采购意向" || toptype == "预告" || toptype == "招标" {
|
|
if toptype == "采购意向" || toptype == "预告" || toptype == "招标" {
|
|
data["type"] = 2
|
|
data["type"] = 2
|
|
} else {
|
|
} else {
|
|
@@ -244,28 +218,22 @@ func InfoFind(id string, employType int64) map[string]interface{} {
|
|
data["type"] = 1
|
|
data["type"] = 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if common.InterfaceToStr(obj["subtype"]) == "拟建" {
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- //data["type"] = in.SourceType
|
|
|
|
- if obj["projectinfo"] != nil {
|
|
|
|
- projectinfo := common.ObjToMap(obj["projectinfo"])
|
|
|
|
- if (*projectinfo)["attachments"] != nil {
|
|
|
|
- data["annex"] = 1
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if obj["projectinfo"] != nil {
|
|
|
|
+ projectinfo := common.ObjToMap(obj["projectinfo"])
|
|
|
|
+ if (*projectinfo)["attachments"] != nil {
|
|
|
|
+ data["annex"] = 1
|
|
}
|
|
}
|
|
- data["publishtime"] = time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
|
- data["show_time"] = time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
|
- data["projectname"] = obj["projectname"]
|
|
|
|
- procurementlist, _ := obj["procurementlist"].([]interface{})
|
|
|
|
- for _, vs := range procurementlist { //1.采购意向清单数据集打码处理
|
|
|
|
- vsMap, _ := vs.(map[string]interface{})
|
|
|
|
- if vsMap["expurasingtime"] != nil {
|
|
|
|
- data["expurasing_time"] = vsMap["expurasingtime"]
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ data["publishtime"] = time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
|
+ data["show_time"] = time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
|
+ data["projectname"] = obj["projectname"]
|
|
|
|
+ procurementlist, _ := obj["procurementlist"].([]interface{})
|
|
|
|
+ for _, vs := range procurementlist { //1.采购意向清单数据集打码处理
|
|
|
|
+ vsMap, _ := vs.(map[string]interface{})
|
|
|
|
+ if vsMap["expurasingtime"] != nil {
|
|
|
|
+ data["expurasing_time"] = vsMap["expurasingtime"]
|
|
|
|
+ break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -277,7 +245,7 @@ func InfoFind(id string, employType int64) map[string]interface{} {
|
|
}
|
|
}
|
|
|
|
|
|
// GetBuyerIdByName 通过采购单位名称获取id
|
|
// GetBuyerIdByName 通过采购单位名称获取id
|
|
-func GetBuyerIdByName(buyerName string) (buyerId string) {
|
|
|
|
|
|
+func getBuyerIdByName(buyerName string) (buyerId string) {
|
|
r := elastic.Get(BuyerIndex, BuyerType, fmt.Sprintf(`{"query":{"bool":{"must":[{"term":{"buyer_name":"%s"}}]}},"size":1,"_source":["city","id"]}`, buyerName))
|
|
r := elastic.Get(BuyerIndex, BuyerType, fmt.Sprintf(`{"query":{"bool":{"must":[{"term":{"buyer_name":"%s"}}]}},"size":1,"_source":["city","id"]}`, buyerName))
|
|
if r == nil || len(*r) == 0 {
|
|
if r == nil || len(*r) == 0 {
|
|
return
|
|
return
|
|
@@ -287,7 +255,7 @@ func GetBuyerIdByName(buyerName string) (buyerId string) {
|
|
}
|
|
}
|
|
|
|
|
|
// IdFormat id解密
|
|
// IdFormat id解密
|
|
-func IdFormat(encryptionId string, employType int64) string {
|
|
|
|
|
|
+func idFormat(encryptionId string, employType int64) string {
|
|
decryptId := ""
|
|
decryptId := ""
|
|
switch employType {
|
|
switch employType {
|
|
case 1, 2:
|
|
case 1, 2:
|
|
@@ -299,77 +267,14 @@ func IdFormat(encryptionId string, employType int64) string {
|
|
decryptId = util.DecodeId(encryptionId)
|
|
decryptId = util.DecodeId(encryptionId)
|
|
} else {
|
|
} else {
|
|
//次数据传的名字
|
|
//次数据传的名字
|
|
- decryptId = GetBuyerIdByName(encryptionId)
|
|
|
|
|
|
+ decryptId = getBuyerIdByName(encryptionId)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return decryptId
|
|
return decryptId
|
|
}
|
|
}
|
|
|
|
|
|
-// SummaryFormat 汇总表处理
|
|
|
|
-func SummaryFormat(positionId int64) map[int64]*roaring.Bitmap {
|
|
|
|
- var byte1 []byte
|
|
|
|
- var byte2 []byte
|
|
|
|
- var byte3 []byte
|
|
|
|
- var byte4 []byte
|
|
|
|
- err := MC.CrmMysql.DB.QueryRow("select search_tencent, search_buyer, search_ent, search_nzj from employ_summary where position_id=?", positionId).Scan(&byte1, &byte3, &byte2, &byte4)
|
|
|
|
- if err != nil {
|
|
|
|
- return nil
|
|
|
|
- }
|
|
|
|
- rb1 := roaring.NewBitmap()
|
|
|
|
- rb2 := roaring.NewBitmap()
|
|
|
|
- rb3 := roaring.NewBitmap()
|
|
|
|
- rb4 := roaring.NewBitmap()
|
|
|
|
- data := map[int64]*roaring.Bitmap{}
|
|
|
|
- if byte1 != nil && len(byte1) > 0 {
|
|
|
|
- rb1.UnmarshalBinary(byte1)
|
|
|
|
- }
|
|
|
|
- if byte2 != nil && len(byte2) > 0 {
|
|
|
|
- rb2.UnmarshalBinary(byte2)
|
|
|
|
- }
|
|
|
|
- if byte3 != nil && len(byte3) > 0 {
|
|
|
|
- rb3.UnmarshalBinary(byte3)
|
|
|
|
- }
|
|
|
|
- if byte4 != nil && len(byte4) > 0 {
|
|
|
|
- rb4.UnmarshalBinary(byte4)
|
|
|
|
- }
|
|
|
|
- data[1] = rb1
|
|
|
|
- data[2] = rb2
|
|
|
|
- data[3] = rb3
|
|
|
|
- data[4] = rb4
|
|
|
|
- return data
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// SummarySave 汇总表保存
|
|
|
|
-func SummarySave(tx *sql.Tx, positionId int64, data map[int64]*roaring.Bitmap) bool {
|
|
|
|
- employSummaryData := MC.CrmMysql.FindOne(entity.EMPLOY_SUMMARY, map[string]interface{}{
|
|
|
|
- "position_id": positionId,
|
|
|
|
- }, "", "")
|
|
|
|
- if employSummaryData != nil && len(*employSummaryData) > 0 {
|
|
|
|
- //修改
|
|
|
|
- updateData := map[string]interface{}{}
|
|
|
|
- updateData["search_tencent"], _ = data[1].ToBytes()
|
|
|
|
- updateData["search_buyer"], _ = data[3].ToBytes()
|
|
|
|
- updateData["search_ent"], _ = data[2].ToBytes()
|
|
|
|
- updateData["search_nzj"], _ = data[4].ToBytes()
|
|
|
|
- ok := MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_SUMMARY, map[string]interface{}{
|
|
|
|
- "position_id": positionId,
|
|
|
|
- }, updateData)
|
|
|
|
- return ok
|
|
|
|
- } else {
|
|
|
|
- //新增
|
|
|
|
- insertData := map[string]interface{}{}
|
|
|
|
- insertData["position_id"] = positionId
|
|
|
|
- insertData["search_tencent"], _ = data[1].ToBytes()
|
|
|
|
- insertData["search_buyer"], _ = data[3].ToBytes()
|
|
|
|
- insertData["search_ent"], _ = data[2].ToBytes()
|
|
|
|
- insertData["search_nzj"], _ = data[4].ToBytes()
|
|
|
|
- ok := MC.CrmMysql.InsertByTx(tx, entity.EMPLOY_SUMMARY, insertData)
|
|
|
|
- return ok > 0
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// EmployKeyFormat 根据收录类型 字段处理 table,findKey,employKey,source
|
|
|
|
-func EmployKeyFormat(employType int64) (string, string, string, int64) {
|
|
|
|
|
|
+// employKeyFormat 根据收录类型 字段处理 table,findKey,employKey,source
|
|
|
|
+func employKeyFormat(employType int64, id string) (string, string, string, int64) {
|
|
table := ""
|
|
table := ""
|
|
employKey := "company_id"
|
|
employKey := "company_id"
|
|
findKey := "employ_custom_id"
|
|
findKey := "employ_custom_id"
|
|
@@ -380,6 +285,23 @@ func EmployKeyFormat(employType int64) (string, string, string, int64) {
|
|
employKey = "source_id"
|
|
employKey = "source_id"
|
|
findKey = "employ_info_id"
|
|
findKey = "employ_info_id"
|
|
source = 1
|
|
source = 1
|
|
|
|
+ obj := map[string]interface{}{}
|
|
|
|
+ brobj, ok := MC.Mgo.Find("bidding_rec", bson.M{"s_id": id}, `{"l_recoverydate":-1}`, public.MgoBiddingFields, false, 0, 1)
|
|
|
|
+ if ok && (*brobj) != nil && len(*brobj) == 1 && (*brobj)[0] != nil {
|
|
|
|
+ obj = (*brobj)[0]
|
|
|
|
+ } else {
|
|
|
|
+ aobj, ok := MC.MgoBidding.FindById("bidding", id, public.MgoBiddingFields)
|
|
|
|
+ if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
|
|
|
|
+ aobj, ok = MC.MgoBidding.FindById("bidding_back", id, public.MgoBiddingFields)
|
|
|
|
+ }
|
|
|
|
+ obj = *aobj
|
|
|
|
+ }
|
|
|
|
+ if ok && obj != nil && len(obj) > 0 {
|
|
|
|
+ subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
|
+ if subtype == "拟建" {
|
|
|
|
+ source = 2
|
|
|
|
+ }
|
|
|
|
+ }
|
|
case 2:
|
|
case 2:
|
|
table = entity.EMPLOY_CUSTOM
|
|
table = entity.EMPLOY_CUSTOM
|
|
source = 1
|
|
source = 1
|
|
@@ -397,7 +319,7 @@ func EmployKeyFormat(employType int64) (string, string, string, int64) {
|
|
}
|
|
}
|
|
|
|
|
|
// IgnoreOperate 忽略操作
|
|
// IgnoreOperate 忽略操作
|
|
-func (e *EmPloyService) IgnoreOperate(in *types.IgnoreOperateReq) {
|
|
|
|
|
|
+func (e *EmPloyService) IgnoreOperate(in *types.IgnoreOperateReq) (bool, string) {
|
|
//
|
|
//
|
|
table := ""
|
|
table := ""
|
|
switch in.EmployType {
|
|
switch in.EmployType {
|
|
@@ -406,8 +328,10 @@ func (e *EmPloyService) IgnoreOperate(in *types.IgnoreOperateReq) {
|
|
case 2, 3:
|
|
case 2, 3:
|
|
table = entity.EMPLOY_CUSTOM
|
|
table = entity.EMPLOY_CUSTOM
|
|
}
|
|
}
|
|
|
|
+ msg := ""
|
|
|
|
+ fool := true
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
- id := IdFormat(v, in.EmployType)
|
|
|
|
|
|
+ id := idFormat(v, in.EmployType)
|
|
if id == "" {
|
|
if id == "" {
|
|
log.Println(v, id, in.EmployType, "忽略处理,id解析失败")
|
|
log.Println(v, id, in.EmployType, "忽略处理,id解析失败")
|
|
break
|
|
break
|
|
@@ -422,6 +346,20 @@ func (e *EmPloyService) IgnoreOperate(in *types.IgnoreOperateReq) {
|
|
}
|
|
}
|
|
if MC.CrmMysql.Count(table, findMap) == 0 {
|
|
if MC.CrmMysql.Count(table, findMap) == 0 {
|
|
log.Println(v, id, in.EmployType, "忽略处理,id所对应数据不存在")
|
|
log.Println(v, id, in.EmployType, "忽略处理,id所对应数据不存在")
|
|
|
|
+ fool = false
|
|
|
|
+ if in.EmployType == 1 {
|
|
|
|
+ if in.IsIgnore {
|
|
|
|
+ msg = "该资讯已有员工收录,不可忽略。"
|
|
|
|
+ } else {
|
|
|
|
+ msg = "该资讯已有员工收录,不可取消忽略。"
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if in.IsIgnore {
|
|
|
|
+ msg = "该企业已有员工收录,不可忽略。"
|
|
|
|
+ } else {
|
|
|
|
+ msg = "该企业已有员工收录,不可取消忽略。"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
break
|
|
break
|
|
}
|
|
}
|
|
if in.IsIgnore {
|
|
if in.IsIgnore {
|
|
@@ -436,18 +374,14 @@ func (e *EmPloyService) IgnoreOperate(in *types.IgnoreOperateReq) {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
-
|
|
|
|
-type PersonSmmary struct {
|
|
|
|
- EntUserId int64
|
|
|
|
- Summary map[int64]*roaring.Bitmap
|
|
|
|
|
|
+ return fool, msg
|
|
}
|
|
}
|
|
|
|
|
|
// DistributePerson 分发操作
|
|
// DistributePerson 分发操作
|
|
func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
return MC.CrmMysql.ExecTx("收录操作", func(tx *sql.Tx) bool {
|
|
return MC.CrmMysql.ExecTx("收录操作", func(tx *sql.Tx) bool {
|
|
personMap := map[int64]PersonSmmary{}
|
|
personMap := map[int64]PersonSmmary{}
|
|
- //汇总表查询
|
|
|
|
|
|
+ //人员信息处理
|
|
for _, person := range in.Person {
|
|
for _, person := range in.Person {
|
|
personMap[person.PositionId] = PersonSmmary{
|
|
personMap[person.PositionId] = PersonSmmary{
|
|
EntUserId: person.EntUserId,
|
|
EntUserId: person.EntUserId,
|
|
@@ -456,6 +390,7 @@ func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
//分发数据处理
|
|
//分发数据处理
|
|
infoMap := map[string]map[string]interface{}{}
|
|
infoMap := map[string]map[string]interface{}{}
|
|
onlyMap := map[string]interface{}{}
|
|
onlyMap := map[string]interface{}{}
|
|
|
|
+ //标讯数据处理
|
|
for _, v := range strings.Split(in.EmployIdArr, ",") {
|
|
for _, v := range strings.Split(in.EmployIdArr, ",") {
|
|
if onlyMap[v] == nil {
|
|
if onlyMap[v] == nil {
|
|
//查询信息
|
|
//查询信息
|
|
@@ -476,7 +411,8 @@ func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_INFO, map[string]interface{}{
|
|
MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_INFO, map[string]interface{}{
|
|
"id": v,
|
|
"id": v,
|
|
}, map[string]interface{}{
|
|
}, map[string]interface{}{
|
|
- "is_dis": 1,
|
|
|
|
|
|
+ "is_dis": 1,
|
|
|
|
+ "is_handle": 1,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
infoMap[source_id] = (*infoDataList)[0]
|
|
infoMap[source_id] = (*infoDataList)[0]
|
|
@@ -488,12 +424,15 @@ func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //普通人员分发
|
|
for positionId, personSmmary := range personMap {
|
|
for positionId, personSmmary := range personMap {
|
|
|
|
+ //查询时候收录过
|
|
for _, v := range infoMap {
|
|
for _, v := range infoMap {
|
|
//查询时候收录过
|
|
//查询时候收录过
|
|
findMap := map[string]interface{}{
|
|
findMap := map[string]interface{}{
|
|
"position_id": positionId,
|
|
"position_id": positionId,
|
|
"source_id": v["source_id"],
|
|
"source_id": v["source_id"],
|
|
|
|
+ "source": v["source"],
|
|
}
|
|
}
|
|
if MC.CrmMysql.Count(entity.EMPLOY_INFO, findMap) == 0 {
|
|
if MC.CrmMysql.Count(entity.EMPLOY_INFO, findMap) == 0 {
|
|
//新增
|
|
//新增
|
|
@@ -501,27 +440,192 @@ func (e *EmPloyService) DistributePerson(in *types.EmployDistributeReq) bool {
|
|
v["position_id"] = positionId
|
|
v["position_id"] = positionId
|
|
MC.CrmMysql.InsertByTx(tx, entity.EMPLOY_INFO, v)
|
|
MC.CrmMysql.InsertByTx(tx, entity.EMPLOY_INFO, v)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if in.EntNicheDis > 0 {
|
|
|
|
+ //查询分配员有没有该数据
|
|
|
|
+ for _, v := range infoMap {
|
|
|
|
+ //查询时候收录过
|
|
|
|
+ findMap := map[string]interface{}{
|
|
|
|
+ "position_id": in.PositionId,
|
|
|
|
+ "source_id": v["source_id"],
|
|
|
|
+ "source": v["source"],
|
|
|
|
+ }
|
|
|
|
+ employPositionId := v["position_id"]
|
|
|
|
+ if employPositionId != in.PositionId {
|
|
|
|
+ //分发消息不属于自己
|
|
|
|
+ if MC.CrmMysql.Count(entity.EMPLOY_INFO, findMap) == 0 {
|
|
|
|
+ v["ent_user_id"] = in.EntUserId
|
|
|
|
+ v["position_id"] = in.PositionId
|
|
|
|
+ v["is_handle"] = 1
|
|
|
|
+ MC.CrmMysql.InsertByTx(tx, entity.EMPLOY_INFO, v)
|
|
|
|
+ } else {
|
|
|
|
+ MC.CrmMysql.UpdateByTx(tx, entity.EMPLOY_INFO, findMap, map[string]interface{}{
|
|
|
|
+ "is_handle": 1,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true
|
|
return true
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-// 提取字符串中的数字
|
|
|
|
-func ExtractNumbers(str string) int64 {
|
|
|
|
- re := regexp.MustCompile(`\d+`)
|
|
|
|
- matches := re.FindAllString(str, -1)
|
|
|
|
- numbers := make([]int, len(matches))
|
|
|
|
- for i, match := range matches {
|
|
|
|
- number, err := strconv.Atoi(match)
|
|
|
|
- if err == nil {
|
|
|
|
- numbers[i] = number
|
|
|
|
|
|
+func niJianHandle(infoId string, data map[string]interface{}, v1 string) map[string]interface{} {
|
|
|
|
+ project, _ := MC.MgoProject.FindOne("projectset_proposed", map[string]interface{}{
|
|
|
|
+ "ids": infoId,
|
|
|
|
+ })
|
|
|
|
+ if project != nil && len(*project) > 0 {
|
|
|
|
+ city := common.InterfaceToStr((*project)["city"])
|
|
|
|
+ area := common.InterfaceToStr((*project)["area"])
|
|
|
|
+ category_code := common.InterfaceToStr((*project)["category_code"])
|
|
|
|
+ lasttime := common.Int64All((*project)["lasttime"])
|
|
|
|
+ ownerclass_code := common.InterfaceToStr((*project)["ownerclass_code"])
|
|
|
|
+ total_investment := common.InterfaceToStr((*project)["total_investment"])
|
|
|
|
+ project_stage_code := common.InterfaceToStr((*project)["project_stage_code"])
|
|
|
|
+ infoList := gconv.SliceMap((*project)["list"])
|
|
|
|
+ title := ""
|
|
|
|
+ projectname := ""
|
|
|
|
+ if len(infoList) > 0 {
|
|
|
|
+ title = common.InterfaceToStr(infoList[0]["title"])
|
|
|
|
+ projectname = common.InterfaceToStr(infoList[0]["projectname"])
|
|
|
|
+ }
|
|
|
|
+ category := ""
|
|
|
|
+ ownerclass := ""
|
|
|
|
+ project_stage := ""
|
|
|
|
+ if category_code != "" {
|
|
|
|
+ categoryData := MC.NiJian.FindOne("d_nzj_category_code", map[string]interface{}{
|
|
|
|
+ "code": category_code,
|
|
|
|
+ }, "name", "")
|
|
|
|
+ category = common.InterfaceToStr((*categoryData)["name"])
|
|
}
|
|
}
|
|
|
|
+ if ownerclass_code != "" {
|
|
|
|
+ ownerclassData := MC.NiJian.FindOne("d_nzj_ownerclass_code", map[string]interface{}{
|
|
|
|
+ "code": ownerclass_code,
|
|
|
|
+ }, "name", "")
|
|
|
|
+ ownerclass = common.InterfaceToStr((*ownerclassData)["name"])
|
|
|
|
+ }
|
|
|
|
+ if project_stage_code != "" {
|
|
|
|
+ projectStageData := MC.NiJian.FindOne("d_nzj_project_stage_code", map[string]interface{}{
|
|
|
|
+ "code": project_stage_code,
|
|
|
|
+ }, "name", "")
|
|
|
|
+ project_stage = common.InterfaceToStr((*projectStageData)["name"])
|
|
|
|
+ }
|
|
|
|
+ data["title"] = title
|
|
|
|
+ data["city"] = city
|
|
|
|
+ data["area"] = area
|
|
|
|
+ data["projectname"] = projectname
|
|
|
|
+ data["ownerclass"] = ownerclass
|
|
|
|
+ data["project_stage"] = project_stage
|
|
|
|
+ data["project_category"] = category
|
|
|
|
+ data["project_investment"] = total_investment
|
|
|
|
+ lastTimeStr := common.If(lasttime == 0, nil, time.Unix(lasttime, 0).Format(date.Date_Full_Layout))
|
|
|
|
+ data["project_evolve"] = lastTimeStr
|
|
|
|
+ data["show_time"] = lastTimeStr
|
|
|
|
+ data["publishtime"] = lastTimeStr
|
|
|
|
+ pid := common.InterfaceToStr((*project)["_id"])
|
|
|
|
+ data["jybx_url"] = "/succbi/nzj/app/nzj.app/nzj_detail_0.spg?pid=" + pid
|
|
|
|
+ } else {
|
|
|
|
+ data["jybx_url"] = "/article/content/" + v1 + ".html"
|
|
|
|
+ }
|
|
|
|
+ data["source"] = 2
|
|
|
|
+ return data
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 个人收录情况查询
|
|
|
|
+func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq) map[string]interface{} {
|
|
|
|
+ valueMap := map[string]interface{}{
|
|
|
|
+ "id": v,
|
|
}
|
|
}
|
|
- result := 0
|
|
|
|
- for _, number := range numbers {
|
|
|
|
- result = result*10 + number
|
|
|
|
|
|
+ employData := MC.CrmMysql.FindOne(table, map[string]interface{}{
|
|
|
|
+ employKey: id,
|
|
|
|
+ "position_id": in.PositionId,
|
|
|
|
+ "source": source,
|
|
|
|
+ }, "is_ignore,status,id", "")
|
|
|
|
+ employId := int64(0)
|
|
|
|
+ if employData != nil && len(*employData) > 0 {
|
|
|
|
+ valueMap["isIgnore"] = common.If(common.Int64All((*employData)["is_ignore"]) == 1, true, false)
|
|
|
|
+ valueMap["isEmploy"] = common.If(common.Int64All((*employData)["status"]) == 1, true, false)
|
|
|
|
+ employId = common.Int64All((*employData)["id"])
|
|
|
|
+ valueMap["employId"] = employId
|
|
|
|
+ } else {
|
|
|
|
+ valueMap["isIgnore"] = false
|
|
|
|
+ valueMap["isEmploy"] = false
|
|
|
|
+ }
|
|
|
|
+ if len(strings.Split(in.IdArr, ",")) == 1 && employId > 0 {
|
|
|
|
+ //列表查询
|
|
|
|
+ //是否忽略处理
|
|
|
|
+ //客户数量
|
|
|
|
+ customCount := MC.CrmMysql.Count(entity.CUSTOM, map[string]interface{}{
|
|
|
|
+ findKey: employId,
|
|
|
|
+ "position_id": in.PositionId,
|
|
|
|
+ })
|
|
|
|
+ valueMap["customCount"] = customCount
|
|
|
|
+ if in.EmployType == 1 || in.EmployType == 4 {
|
|
|
|
+ //销售线索数量
|
|
|
|
+ clueCount := MC.CrmMysql.Count(entity.SALE_CLUE, map[string]interface{}{
|
|
|
|
+ "employ_info_id": employId,
|
|
|
|
+ "position_id": in.PositionId,
|
|
|
|
+ })
|
|
|
|
+ valueMap["clueCount"] = clueCount
|
|
|
|
+ //销售机会数量
|
|
|
|
+ chanceCount := MC.CrmMysql.Count(entity.SALE_CHANCE, map[string]interface{}{
|
|
|
|
+ "employ_info_id": id,
|
|
|
|
+ "position_id": in.PositionId,
|
|
|
|
+ })
|
|
|
|
+ valueMap["chanceCount"] = chanceCount
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ valueMap["chanceCount"] = 0
|
|
|
|
+ valueMap["clueCount"] = 0
|
|
|
|
+ valueMap["isIgnore"] = false
|
|
|
|
+ valueMap["customCount"] = 0
|
|
|
|
+ }
|
|
|
|
+ return valueMap
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 企业收录情况查询
|
|
|
|
+func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq) map[string]interface{} {
|
|
|
|
+ valueMap := map[string]interface{}{
|
|
|
|
+ "id": v,
|
|
|
|
+ "isIgnore": false,
|
|
|
|
+ "isEmploy": false,
|
|
|
|
+ "customCount": 0,
|
|
|
|
+ "clueCount": 0,
|
|
|
|
+ "chanceCount": 0,
|
|
|
|
+ }
|
|
|
|
+ employData := MC.CrmMysql.SelectBySql(fmt.Sprintf("select GROUP_CONCAT(id) as employIdArr,MAX(is_ignore) as is_ignore,MAX(status) as status from %s where %s=? and source=? and ent_dept_id in (%s) and status=1", table, employKey, depIDArr), id, source)
|
|
|
|
+ employArrStr := ""
|
|
|
|
+ if employData != nil && len(*employData) > 0 {
|
|
|
|
+ valueMap["isIgnore"] = common.If(common.Int64All((*employData)[0]["is_ignore"]) == 1, true, false)
|
|
|
|
+ valueMap["isEmploy"] = common.If(common.Int64All((*employData)[0]["status"]) == 1, true, false)
|
|
|
|
+ employArrStr = common.InterfaceToStr((*employData)[0]["employIdArr"])
|
|
|
|
+ valueMap["employId"] = strings.Split(employArrStr, ",")[0]
|
|
|
|
+ } else {
|
|
|
|
+ valueMap["isIgnore"] = false
|
|
|
|
+ valueMap["isIgnore"] = false
|
|
|
|
+ }
|
|
|
|
+ if len(strings.Split(in.IdArr, ",")) == 1 && employArrStr != "" {
|
|
|
|
+ //列表查询
|
|
|
|
+ //是否忽略处理
|
|
|
|
+ //客户数量
|
|
|
|
+ customSql := fmt.Sprintf("select COUNT(1) from %s where %s in (%s)", entity.CUSTOM, findKey, employArrStr)
|
|
|
|
+ customCount := MC.CrmMysql.CountBySql(customSql)
|
|
|
|
+ valueMap["customCount"] = customCount
|
|
|
|
+ if in.EmployType == 1 || in.EmployType == 4 {
|
|
|
|
+ //销售线索数量
|
|
|
|
+ clueSql := fmt.Sprintf("select COUNT(1) from %s where employ_info_id in (%s)", entity.SALE_CLUE, employArrStr)
|
|
|
|
+ clueCount := MC.CrmMysql.CountBySql(clueSql)
|
|
|
|
+ valueMap["clueCount"] = clueCount
|
|
|
|
+ //销售机会数量
|
|
|
|
+ chanceSql := fmt.Sprintf("select COUNT(1) from %s where employ_info_id in (%s)", entity.SALE_CHANCE, employArrStr)
|
|
|
|
+ chanceCount := MC.CrmMysql.CountBySql(chanceSql)
|
|
|
|
+ valueMap["chanceCount"] = chanceCount
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ valueMap["chanceCount"] = 0
|
|
|
|
+ valueMap["clueCount"] = 0
|
|
|
|
+ valueMap["customCount"] = 0
|
|
}
|
|
}
|
|
- return int64(result)
|
|
|
|
|
|
+ return valueMap
|
|
}
|
|
}
|