|
@@ -51,15 +51,15 @@ func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string
|
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
|
id := ""
|
|
|
id = idFormat(v, in.EmployType)
|
|
|
- table, findKey, employKey, source := employKeyFormat(in.EmployType, id)
|
|
|
+ table, findKey, employKey, source, projectId, isNiJian := employKeyFormat(in.EmployType, id)
|
|
|
if id == "" {
|
|
|
log.Println(v, in.EmployType, "该信息查询不到数据")
|
|
|
break
|
|
|
}
|
|
|
if in.EntNicheDis > 0 {
|
|
|
- data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in))
|
|
|
+ data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in, projectId, isNiJian))
|
|
|
} else {
|
|
|
- data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in))
|
|
|
+ data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in, projectId, isNiJian))
|
|
|
}
|
|
|
}
|
|
|
return data
|
|
@@ -74,15 +74,18 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string)
|
|
|
return MC.CrmMysql.ExecTx("收录操作", func(tx *sql.Tx) bool {
|
|
|
fool := true
|
|
|
for _, v1 := range strings.Split(in.IdArr, ",") {
|
|
|
-
|
|
|
//id转中文
|
|
|
id := ""
|
|
|
findMap := map[string]interface{}{}
|
|
|
findMap["position_id"] = in.PositionId
|
|
|
id = idFormat(v1, in.EmployType)
|
|
|
- table, _, employKey, source := employKeyFormat(in.EmployType, id)
|
|
|
- findMap[employKey] = id
|
|
|
+ table, _, employKey, source, projectId, isNijian := employKeyFormat(in.EmployType, id)
|
|
|
findMap["source"] = source
|
|
|
+ if isNijian {
|
|
|
+ findMap[employKey] = id
|
|
|
+ } else {
|
|
|
+ findMap[employKey] = projectId
|
|
|
+ }
|
|
|
if id == "" {
|
|
|
log.Println(v1, in.EmployType, "该信息查询不到数据")
|
|
|
break
|
|
@@ -100,11 +103,12 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string)
|
|
|
} else if in.EmployType == 2 {
|
|
|
data = customFind(id, in.EmployType)
|
|
|
data["jybx_url"] = "/swordfish/page_big_pc/svip/ent_ser_portrait/" + v1
|
|
|
+ data["source"] = source
|
|
|
} else if in.EmployType == 3 {
|
|
|
data = customFind(id, in.EmployType)
|
|
|
data["jybx_url"] = "/swordfish/page_big_pc/unit_portrayal/" + v1
|
|
|
+ data["source"] = source
|
|
|
}
|
|
|
- data["source"] = source
|
|
|
data["position_id"] = in.PositionId
|
|
|
data["ent_id"] = in.EntId
|
|
|
data["ent_dept_id"] = in.EntDeptId
|
|
@@ -125,7 +129,6 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string)
|
|
|
if !ok {
|
|
|
log.Println(v1, id, in.EmployType, "取消收录失败")
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
fool = false
|
|
|
if in.EmployType == 1 {
|
|
@@ -178,19 +181,15 @@ func infoFind(id string, v1 string) map[string]interface{} {
|
|
|
//ownerclass 业主类型(拟在建搜索) expurasing_time 预计采购时间 jybx_url 标讯详情页
|
|
|
//标讯信息
|
|
|
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
|
|
|
+
|
|
|
+ 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)
|
|
|
}
|
|
|
+ toptype := common.InterfaceToStr(obj["toptype"])
|
|
|
+ subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
+ pushTime := ""
|
|
|
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"]
|
|
@@ -203,29 +202,28 @@ func infoFind(id string, v1 string) map[string]interface{} {
|
|
|
data["winner"] = obj["s_winner"]
|
|
|
data["jybx_url"] = "/article/content/" + v1 + ".html"
|
|
|
//类型处理
|
|
|
- pushTime := time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
- if subtype == "拟建" {
|
|
|
- data = niJianHandle(id, data, v1, pushTime)
|
|
|
- data["type"] = 1
|
|
|
+ pushTime = time.Unix(common.Int64All(obj["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
|
+ data["source"] = 1
|
|
|
+ data["source_id"] = id
|
|
|
+ if toptype == "采购意向" || toptype == "预告" || toptype == "招标" {
|
|
|
+ data["type"] = 2
|
|
|
} else {
|
|
|
- if toptype == "采购意向" || toptype == "预告" || toptype == "招标" {
|
|
|
+ if subtype == "废标" || subtype == "流标" || subtype == "其它" {
|
|
|
data["type"] = 2
|
|
|
+ } else if subtype == "成交" || subtype == "中标" || subtype == "合同" || subtype == "验收" || subtype == "违规" {
|
|
|
+ data["type"] = 3
|
|
|
} else {
|
|
|
- if subtype == "废标" || subtype == "流标" || subtype == "其它" {
|
|
|
- data["type"] = 2
|
|
|
- } else if subtype == "成交" || subtype == "中标" || subtype == "合同" || subtype == "验收" || subtype == "违规" {
|
|
|
- data["type"] = 3
|
|
|
- } else {
|
|
|
- data["type"] = 1
|
|
|
- }
|
|
|
+ data["type"] = 1
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if obj["projectinfo"] != nil {
|
|
|
projectinfo := common.ObjToMap(obj["projectinfo"])
|
|
|
if (*projectinfo)["attachments"] != nil {
|
|
|
data["annex"] = 1
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
data["publishtime"] = pushTime
|
|
|
data["show_time"] = pushTime
|
|
|
data["projectname"] = obj["projectname"]
|
|
@@ -240,8 +238,11 @@ func infoFind(id string, v1 string) map[string]interface{} {
|
|
|
}
|
|
|
data["status"] = 1
|
|
|
data["employ_way"] = 1
|
|
|
- data["source_id"] = id
|
|
|
data["create_time"] = time.Now().Format(date.Date_Full_Layout)
|
|
|
+ if subtype == "拟建" {
|
|
|
+ data = niJianHandle(id, data, v1, pushTime)
|
|
|
+ data["type"] = 1
|
|
|
+ }
|
|
|
return data
|
|
|
}
|
|
|
|
|
@@ -275,11 +276,13 @@ func idFormat(encryptionId string, employType int64) string {
|
|
|
}
|
|
|
|
|
|
// employKeyFormat 根据收录类型 字段处理 table,findKey,employKey,source
|
|
|
-func employKeyFormat(employType int64, id string) (string, string, string, int64) {
|
|
|
+func employKeyFormat(employType int64, id string) (string, string, string, int64, string, bool) {
|
|
|
table := ""
|
|
|
employKey := "company_id"
|
|
|
findKey := "employ_custom_id"
|
|
|
+ projectId := ""
|
|
|
source := int64(0)
|
|
|
+ IsNiJian := false
|
|
|
switch employType {
|
|
|
case 1:
|
|
|
table = entity.EMPLOY_INFO
|
|
@@ -300,7 +303,14 @@ func employKeyFormat(employType int64, id string) (string, string, string, int64
|
|
|
if ok && obj != nil && len(obj) > 0 {
|
|
|
subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
if subtype == "拟建" {
|
|
|
+ project, _ := MC.MgoProject.FindOne("projectset_proposed", map[string]interface{}{
|
|
|
+ "ids": id,
|
|
|
+ })
|
|
|
source = 2
|
|
|
+ if project != nil && len(*project) > 0 {
|
|
|
+ projectId = common.InterfaceToStr((*project)["_id"])
|
|
|
+ IsNiJian = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
case 2:
|
|
@@ -315,7 +325,7 @@ func employKeyFormat(employType int64, id string) (string, string, string, int64
|
|
|
employKey = "source_id"
|
|
|
findKey = "employ_info_id"
|
|
|
}
|
|
|
- return table, findKey, employKey, source
|
|
|
+ return table, findKey, employKey, source, projectId, IsNiJian
|
|
|
|
|
|
}
|
|
|
|
|
@@ -529,20 +539,31 @@ func niJianHandle(infoId string, data map[string]interface{}, v1, pushTime strin
|
|
|
data["publishtime"] = lastTimeStr
|
|
|
pid := common.InterfaceToStr((*project)["_id"])
|
|
|
data["jybx_url"] = "/succbi/nzj/app/nzj.app/nzj_detail_0.spg?pid=" + pid
|
|
|
+ data["source"] = 2
|
|
|
+ data["source_id"] = pid
|
|
|
} else {
|
|
|
+ data["source"] = 1
|
|
|
+ data["source_id"] = infoId
|
|
|
+ data["jybx_url"] = "/article/content/" + v1 + ".html"
|
|
|
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{} {
|
|
|
+func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool) map[string]interface{} {
|
|
|
valueMap := map[string]interface{}{
|
|
|
"id": v,
|
|
|
}
|
|
|
+ sourceId := ""
|
|
|
+ if isNiJian {
|
|
|
+ sourceId = id
|
|
|
+ } else {
|
|
|
+ sourceId = projectId
|
|
|
+ }
|
|
|
employData := MC.CrmMysql.FindOne(table, map[string]interface{}{
|
|
|
- employKey: id,
|
|
|
+ employKey: sourceId,
|
|
|
"position_id": in.PositionId,
|
|
|
"source": source,
|
|
|
}, "is_ignore,status,id", "")
|
|
@@ -589,7 +610,7 @@ func employInfoPerson(v, table, id, employKey, findKey string, source int64, in
|
|
|
}
|
|
|
|
|
|
// 企业收录情况查询
|
|
|
-func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq) map[string]interface{} {
|
|
|
+func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool) map[string]interface{} {
|
|
|
valueMap := map[string]interface{}{
|
|
|
"id": v,
|
|
|
"isIgnore": false,
|
|
@@ -598,7 +619,13 @@ func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int
|
|
|
"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)
|
|
|
+ sourceId := ""
|
|
|
+ if isNiJian {
|
|
|
+ sourceId = projectId
|
|
|
+ } else {
|
|
|
+ sourceId = id
|
|
|
+ }
|
|
|
+ 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), sourceId, source)
|
|
|
employArrStr := ""
|
|
|
if employData != nil && len(*employData) > 0 {
|
|
|
valueMap["isIgnore"] = common.If(common.Int64All((*employData)[0]["is_ignore"]) == 1, true, false)
|