|
@@ -63,18 +63,27 @@ func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) ([]map[strin
|
|
|
if configData != nil {
|
|
|
batchEmploy = gconv.Int64((*configData)["batch_employ"])
|
|
|
}
|
|
|
+ //版本查询
|
|
|
+ res := MC.Middleground.ResourceCenter.Haspowers(in.AccountId, in.EntAccountId, in.EntId, in.EntUserId)
|
|
|
+ version := 0
|
|
|
+ for _, pCode := range res.Powers {
|
|
|
+ //0:通用版 1:物业专版
|
|
|
+ if pCode == "bi_yx_wyzb" {
|
|
|
+ version = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
for _, v := range strings.Split(in.IdArr, ",") {
|
|
|
id := ""
|
|
|
id = idFormat(v, in.EmployType)
|
|
|
- table, findKey, employKey, source, projectId, isNiJian := employKeyFormat(in.EmployType, id)
|
|
|
+ table, findKey, employKey, source, projectId, isNiJian, subtype := employKeyFormat(in.EmployType, id)
|
|
|
if id == "" {
|
|
|
log.Println(v, in.EmployType, "该信息查询不到数据")
|
|
|
continue
|
|
|
}
|
|
|
if in.EntNicheDis > 0 {
|
|
|
- data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in, projectId, isNiJian))
|
|
|
+ data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in, projectId, isNiJian, version, subtype))
|
|
|
} else {
|
|
|
- data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in, projectId, isNiJian))
|
|
|
+ data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in, projectId, isNiJian, version, subtype))
|
|
|
}
|
|
|
}
|
|
|
return data, batchEmploy
|
|
@@ -94,7 +103,7 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string)
|
|
|
findMap := map[string]interface{}{}
|
|
|
findMap["position_id"] = in.PositionId
|
|
|
id = idFormat(v1, in.EmployType)
|
|
|
- table, _, employKey, source, projectId, isNijian := employKeyFormat(in.EmployType, id)
|
|
|
+ table, _, employKey, source, projectId, isNijian, _ := employKeyFormat(in.EmployType, id)
|
|
|
findMap["source"] = source
|
|
|
if isNijian {
|
|
|
findMap[employKey] = projectId
|
|
@@ -137,6 +146,9 @@ func (e *EmPloyService) EmployOperate(in *types.EmployOperateReq) (bool, string)
|
|
|
fool = true
|
|
|
} else {
|
|
|
//取消收录
|
|
|
+ if in.From == "jhfp" {
|
|
|
+ findMap["type"] = 3
|
|
|
+ }
|
|
|
if MC.CrmMysql.Count(table, findMap) > 0 {
|
|
|
ok := MC.CrmMysql.UpdateByTx(tx, table, findMap, map[string]interface{}{
|
|
|
"status": -1,
|
|
@@ -235,14 +247,12 @@ func infoFind(id string, v1 string) map[string]interface{} {
|
|
|
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"]
|
|
@@ -295,13 +305,14 @@ func idFormat(encryptionId string, employType int64) string {
|
|
|
}
|
|
|
|
|
|
// employKeyFormat 根据收录类型 字段处理 table,findKey,employKey,source
|
|
|
-func employKeyFormat(employType int64, id string) (string, string, string, int64, string, bool) {
|
|
|
+func employKeyFormat(employType int64, id string) (string, string, string, int64, string, bool, string) {
|
|
|
table := ""
|
|
|
employKey := "company_id"
|
|
|
findKey := "employ_custom_id"
|
|
|
projectId := ""
|
|
|
source := int64(0)
|
|
|
IsNiJian := false
|
|
|
+ subtype := ""
|
|
|
switch employType {
|
|
|
case 1:
|
|
|
table = entity.EMPLOY_INFO
|
|
@@ -320,7 +331,7 @@ func employKeyFormat(employType int64, id string) (string, string, string, int64
|
|
|
obj = *aobj
|
|
|
}
|
|
|
if ok && obj != nil && len(obj) > 0 {
|
|
|
- subtype := common.InterfaceToStr(obj["subtype"])
|
|
|
+ subtype = common.InterfaceToStr(obj["subtype"])
|
|
|
if subtype == "拟建" {
|
|
|
project, _ := MC.MgoProject.FindOne("projectset_proposed", map[string]interface{}{
|
|
|
"ids": id,
|
|
@@ -344,7 +355,7 @@ func employKeyFormat(employType int64, id string) (string, string, string, int64
|
|
|
employKey = "source_id"
|
|
|
findKey = "employ_info_id"
|
|
|
}
|
|
|
- return table, findKey, employKey, source, projectId, IsNiJian
|
|
|
+ return table, findKey, employKey, source, projectId, IsNiJian, subtype
|
|
|
|
|
|
}
|
|
|
|
|
@@ -570,7 +581,7 @@ func niJianHandle(infoId string, data map[string]interface{}, v1, pushTime strin
|
|
|
}
|
|
|
|
|
|
// 个人收录情况查询
|
|
|
-func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool) map[string]interface{} {
|
|
|
+func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool, version int, subtype string) map[string]interface{} {
|
|
|
valueMap := map[string]interface{}{
|
|
|
"id": v,
|
|
|
}
|
|
@@ -580,27 +591,60 @@ func employInfoPerson(v, table, id, employKey, findKey string, source int64, in
|
|
|
} else {
|
|
|
sourceId = id
|
|
|
}
|
|
|
- employData := &map[string]interface{}{}
|
|
|
+
|
|
|
+ employData := &[]map[string]interface{}{}
|
|
|
if in.EmployType == 1 {
|
|
|
- employData = MC.CrmMysql.FindOne(table, map[string]interface{}{
|
|
|
+ employData = MC.CrmMysql.Find(table, map[string]interface{}{
|
|
|
employKey: sourceId,
|
|
|
"position_id": in.PositionId,
|
|
|
"source": source,
|
|
|
- }, "is_ignore,status,id,type", "")
|
|
|
+ }, "is_ignore,status,id,type", "id", -1, -1)
|
|
|
} else {
|
|
|
- employData = MC.CrmMysql.FindOne(table, map[string]interface{}{
|
|
|
+ employData = MC.CrmMysql.Find(table, map[string]interface{}{
|
|
|
employKey: sourceId,
|
|
|
"position_id": in.PositionId,
|
|
|
"source": source,
|
|
|
- }, "is_ignore,status,id", "")
|
|
|
+ }, "is_ignore,status,id", "id", -1, -1)
|
|
|
}
|
|
|
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)
|
|
|
- valueMap["type"] = common.Int64All((*employData)["type"])
|
|
|
- employId = common.Int64All((*employData)["id"])
|
|
|
- valueMap["employId"] = employId
|
|
|
+ if (subtype == "成交" || subtype == "中标" || subtype == "合同" || subtype == "验收" || subtype == "违规") && in.EmployType == 1 {
|
|
|
+ employ2 := false
|
|
|
+ employ3 := false
|
|
|
+ employIgnore := false
|
|
|
+ employType := int64(0)
|
|
|
+ for _, v1 := range *employData {
|
|
|
+ employType := common.Int64All(v1["type"])
|
|
|
+ employStatus := common.Int64All(v1["status"])
|
|
|
+ is_ignore := common.Int64All(v1["is_ignore"])
|
|
|
+ switch employType {
|
|
|
+ case 2:
|
|
|
+ if employStatus == 1 {
|
|
|
+ employ2 = true
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ if employStatus == 1 {
|
|
|
+ employ3 = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if is_ignore > 0 {
|
|
|
+ employIgnore = true
|
|
|
+ }
|
|
|
+ employType = common.Int64All(v1["type"])
|
|
|
+ employId = common.Int64All(v1["id"])
|
|
|
+ }
|
|
|
+ valueMap["isIgnore"] = employIgnore
|
|
|
+ valueMap["isEmploy"] = common.If(employ2 && employ3, true, false)
|
|
|
+ valueMap["type"] = employType
|
|
|
+ valueMap["employId"] = employId
|
|
|
+ } else {
|
|
|
+ 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)
|
|
|
+ valueMap["type"] = common.Int64All((*employData)[0]["type"])
|
|
|
+ employId = common.Int64All((*employData)[0]["id"])
|
|
|
+ valueMap["employId"] = employId
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
valueMap["isIgnore"] = false
|
|
|
valueMap["isEmploy"] = false
|
|
@@ -639,7 +683,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, projectId string, isNiJian bool) map[string]interface{} {
|
|
|
+func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool, version int, subtype string) map[string]interface{} {
|
|
|
valueMap := map[string]interface{}{
|
|
|
"id": v,
|
|
|
"isIgnore": false,
|
|
@@ -657,17 +701,54 @@ func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int
|
|
|
}
|
|
|
employData := &[]map[string]interface{}{}
|
|
|
if in.EmployType == 1 {
|
|
|
- employData = MC.CrmMysql.SelectBySql(fmt.Sprintf("select GROUP_CONCAT(id) as employIdArr,MAX(is_ignore) as is_ignore,MAX(status) as status,MAX(type) as type from %s where %s=? and source=? and ent_dept_id in (%s) ", table, employKey, depIDArr), sourceId, source)
|
|
|
+ if (subtype == "成交" || subtype == "中标" || subtype == "合同" || subtype == "验收" || subtype == "违规") && in.EmployType == 1 {
|
|
|
+ //物业版本查询
|
|
|
+ employData = MC.CrmMysql.SelectBySql(fmt.Sprintf("select id,is_ignore,status ,type from %s where %s=? and status =1 and source=? and ent_dept_id in (%s) ", table, employKey, depIDArr), sourceId, source)
|
|
|
+ } else {
|
|
|
+ employData = MC.CrmMysql.SelectBySql(fmt.Sprintf("select GROUP_CONCAT(id) as employIdArr,MAX(is_ignore) as is_ignore,MAX(status) as status,MAX(type) as type from %s where %s=? and source=? and ent_dept_id in (%s) ", table, employKey, depIDArr), sourceId, source)
|
|
|
+ }
|
|
|
} else {
|
|
|
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) ", 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)
|
|
|
- valueMap["isEmploy"] = common.If(common.Int64All((*employData)[0]["status"]) == 1, true, false)
|
|
|
- valueMap["type"] = common.Int64All((*employData)[0]["type"])
|
|
|
- employArrStr = common.InterfaceToStr((*employData)[0]["employIdArr"])
|
|
|
- valueMap["employId"] = strings.Split(employArrStr, ",")[0]
|
|
|
+ if (subtype == "成交" || subtype == "中标" || subtype == "合同" || subtype == "验收" || subtype == "违规") && in.EmployType == 1 {
|
|
|
+ employ2 := false
|
|
|
+ employ3 := false
|
|
|
+ employIgnore := false
|
|
|
+ employType := int64(0)
|
|
|
+ employId := int64(0)
|
|
|
+ for _, v1 := range *employData {
|
|
|
+ employType := common.Int64All(v1["type"])
|
|
|
+ employStatus := common.Int64All(v1["status"])
|
|
|
+ is_ignore := common.Int64All(v1["is_ignore"])
|
|
|
+ switch employType {
|
|
|
+ case 2:
|
|
|
+ if employStatus == 1 {
|
|
|
+ employ2 = true
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ if employStatus == 1 {
|
|
|
+ employ3 = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if is_ignore > 0 {
|
|
|
+ employIgnore = true
|
|
|
+ }
|
|
|
+ employType = common.Int64All(v1["type"])
|
|
|
+ employId = common.Int64All(v1["id"])
|
|
|
+ }
|
|
|
+ valueMap["isIgnore"] = employIgnore
|
|
|
+ valueMap["isEmploy"] = common.If(employ2 && employ3, true, false)
|
|
|
+ valueMap["type"] = employType
|
|
|
+ valueMap["employId"] = employId
|
|
|
+ } else {
|
|
|
+ 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)
|
|
|
+ valueMap["type"] = common.Int64All((*employData)[0]["type"])
|
|
|
+ employArrStr = common.InterfaceToStr((*employData)[0]["employIdArr"])
|
|
|
+ valueMap["employId"] = strings.Split(employArrStr, ",")[0]
|
|
|
+ }
|
|
|
} else {
|
|
|
valueMap["isIgnore"] = false
|
|
|
valueMap["isIgnore"] = false
|